]> granicus.if.org Git - clang/commitdiff
Add support for __builtin_expect which is needed for assert,
authorOliver Hunt <oliver@apple.com>
Sun, 2 Dec 2007 01:03:24 +0000 (01:03 +0000)
committerOliver Hunt <oliver@apple.com>
Sun, 2 Dec 2007 01:03:24 +0000 (01:03 +0000)
among other things.

Also change a codegen warning to dump to stderr so it doesn't
mess with -emit-llvm output

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44497 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGBuiltin.cpp
CodeGen/CGStmt.cpp
include/clang/AST/Builtins.def

index 803d89ee5423f530067aa6eca6aaac91da5362cb..52a41d85339379fe834b345718ccfd93da38ed54 100644 (file)
@@ -97,6 +97,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
     
     return RValue::get(Result);
   }
+  case Builtin::BI__builtin_expect: {
+    llvm::Value *Condition = EmitScalarExpr(E->getArg(0));   
+    return RValue::get(Condition);
+  }
   }
   
   return RValue::get(0);
index 9059a83119e7f143b3cbad3759e362091578e047..b010e810091f4260271d8ddce64c86a311299ab7 100644 (file)
@@ -38,7 +38,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
       else
         EmitAggExpr(E, 0, false);
     } else {
-      printf("Unimplemented stmt!\n");
+      fprintf(stderr, "Unimplemented stmt!\n");
       S->dump(getContext().SourceMgr);
     }
     break;
index 7733a9b1b2a82726610fe570397c83c58fd723b7..f2f182401e57827375a584f75e326420469554fd 100644 (file)
@@ -67,5 +67,6 @@ BUILTIN(__builtin_va_start, "va&.", "n")
 BUILTIN(__builtin_va_end, "va&", "n")
 BUILTIN(__builtin_va_copy, "va&a", "n")
 BUILTIN(__builtin_memcpy, "v*v*vC*z", "n")
+BUILTIN(__builtin_expect, "iii"   , "nc")
 
 #undef BUILTIN