[cfe-commits] r44497 - in /cfe/trunk: CodeGen/CGBuiltin.cpp CodeGen/CGStmt.cpp include/clang/AST/Builtins.def

Oliver Hunt oliver at apple.com
Sat Dec 1 17:03:25 PST 2007


Author: oliver
Date: Sat Dec  1 19:03:24 2007
New Revision: 44497

URL: http://llvm.org/viewvc/llvm-project?rev=44497&view=rev
Log:
Add support for __builtin_expect which is needed for assert, 
among other things.

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


Modified:
    cfe/trunk/CodeGen/CGBuiltin.cpp
    cfe/trunk/CodeGen/CGStmt.cpp
    cfe/trunk/include/clang/AST/Builtins.def

Modified: cfe/trunk/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGBuiltin.cpp?rev=44497&r1=44496&r2=44497&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/CodeGen/CGBuiltin.cpp Sat Dec  1 19:03:24 2007
@@ -97,6 +97,10 @@
     
     return RValue::get(Result);
   }
+  case Builtin::BI__builtin_expect: {
+    llvm::Value *Condition = EmitScalarExpr(E->getArg(0));   
+    return RValue::get(Condition);
+  }
   }
   
   return RValue::get(0);

Modified: cfe/trunk/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGStmt.cpp?rev=44497&r1=44496&r2=44497&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/CodeGen/CGStmt.cpp Sat Dec  1 19:03:24 2007
@@ -38,7 +38,7 @@
       else
         EmitAggExpr(E, 0, false);
     } else {
-      printf("Unimplemented stmt!\n");
+      fprintf(stderr, "Unimplemented stmt!\n");
       S->dump(getContext().SourceMgr);
     }
     break;

Modified: cfe/trunk/include/clang/AST/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Builtins.def?rev=44497&r1=44496&r2=44497&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Builtins.def (original)
+++ cfe/trunk/include/clang/AST/Builtins.def Sat Dec  1 19:03:24 2007
@@ -67,5 +67,6 @@
 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





More information about the cfe-commits mailing list