]> granicus.if.org Git - clang/commitdiff
ARM: Support marking intrinsic definitions as 'unavailable'
authorJim Grosbach <grosbach@apple.com>
Wed, 9 May 2012 18:17:30 +0000 (18:17 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 9 May 2012 18:17:30 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156490 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/arm_neon.td
utils/TableGen/NeonEmitter.cpp
utils/TableGen/NeonEmitter.h

index 71a0aa2726c0f63a19fc7ffb193127d5f6218ab3..451d56292363c480e9ece754c2c1a5abed04bcf1 100644 (file)
@@ -15,6 +15,7 @@
 class Op;
 
 def OP_NONE  : Op;
+def OP_UNAVAILABLE : Op;
 def OP_ADD   : Op;
 def OP_ADDL  : Op;
 def OP_ADDW  : Op;
index e6f2e53aa70685fe55388681964dfaa6c7693be8..658890cb1e8656762d6efa55411b27710c4ccc9e 100644 (file)
@@ -1012,7 +1012,7 @@ static std::string GenIntrinsic(const std::string &name,
                                 StringRef outTypeStr, StringRef inTypeStr,
                                 OpKind kind, ClassKind classKind) {
   assert(!proto.empty() && "");
-  bool define = UseMacro(proto);
+  bool define = UseMacro(proto) && kind != OpUnavailable;
   std::string s;
 
   // static always inline + return type
@@ -1040,9 +1040,11 @@ static std::string GenIntrinsic(const std::string &name,
   if (define) {
     s += " __extension__ ({ \\\n  ";
     s += GenMacroLocals(proto, inTypeStr);
-  } else {
+  } else if (kind == OpUnavailable) {
+    s += " __attribute__((unavailable));\n";
+    return s;
+  } else
     s += " { \\\n  ";
-  }
 
   if (kind != OpNone)
     s += GenOpString(kind, proto, outTypeStr);
@@ -1238,7 +1240,7 @@ static unsigned RangeFromType(const char mod, StringRef typestr) {
 /// runHeader - Emit a file with sections defining:
 /// 1. the NEON section of BuiltinsARM.def.
 /// 2. the SemaChecking code for the type overload checking.
-/// 3. the SemaChecking code for validation of intrinsic immedate arguments.
+/// 3. the SemaChecking code for validation of intrinsic immediate arguments.
 void NeonEmitter::runHeader(raw_ostream &OS) {
   std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
 
@@ -1551,6 +1553,8 @@ void NeonEmitter::runTests(raw_ostream &OS) {
     ParseTypes(R, Types, TypeVec);
 
     OpKind kind = OpMap[R->getValueAsDef("Operand")->getName()];
+    if (kind == OpUnavailable)
+      continue;
     for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
       if (kind == OpReinterpret) {
         bool outQuad = false;
index dec7451111643a80f2f9513dec84e25e54b6d892..7a703feb18b568ea58f7f9fc5b5bc26b6b50c3b1 100644 (file)
@@ -23,6 +23,7 @@
 
 enum OpKind {
   OpNone,
+  OpUnavailable,
   OpAdd,
   OpAddl,
   OpAddw,
@@ -130,6 +131,7 @@ namespace llvm {
   public:
     NeonEmitter(RecordKeeper &R) : Records(R) {
       OpMap["OP_NONE"]  = OpNone;
+      OpMap["OP_UNAVAILABLE"] = OpUnavailable;
       OpMap["OP_ADD"]   = OpAdd;
       OpMap["OP_ADDL"]  = OpAddl;
       OpMap["OP_ADDW"]  = OpAddw;