[cfe-commits] r57335 - in /cfe/trunk/lib/CodeGen: CGBuiltin.cpp CodeGenFunction.h

Daniel Dunbar daniel at zuster.org
Thu Oct 9 17:24:54 PDT 2008


Author: ddunbar
Date: Thu Oct  9 19:24:54 2008
New Revision: 57335

URL: http://llvm.org/viewvc/llvm-project?rev=57335&view=rev
Log:
Lift EmitTargetBuiltinExpr out of EmitBuiltinExpr.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct  9 19:24:54 2008
@@ -382,14 +382,7 @@
   }
   
   // See if we have a target specific builtin that needs to be lowered.
-  Value *V = 0;
-  
-  if (strcmp(TargetPrefix, "x86") == 0)
-    V = EmitX86BuiltinExpr(BuiltinID, E);
-  else if (strcmp(TargetPrefix, "ppc") == 0)
-    V = EmitPPCBuiltinExpr(BuiltinID, E);
-  
-  if (V)
+  if (Value *V = EmitTargetBuiltinExpr(BuiltinID, E))
     return RValue::get(V);
   
   ErrorUnsupported(E, "builtin function");
@@ -400,6 +393,16 @@
   return RValue::get(UndefValue::get(ConvertType(E->getType())));
 }    
 
+Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
+                                              const CallExpr *E) {
+  const char *TargetPrefix = Target.getTargetPrefix();
+  if (strcmp(TargetPrefix, "x86") == 0)
+    return EmitX86BuiltinExpr(BuiltinID, E);
+  else if (strcmp(TargetPrefix, "ppc") == 0)
+    return EmitPPCBuiltinExpr(BuiltinID, E);
+  return 0;
+}
+
 Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 
                                            const CallExpr *E) {
   

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=57335&r1=57334&r2=57335&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Oct  9 19:24:54 2008
@@ -418,6 +418,10 @@
   
   RValue EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
 
+  /// EmitTargetBuiltinExpr - Emit the given builtin call. Returns 0
+  /// if the call is unhandled by the current target.
+  llvm::Value *EmitTargetBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
+
   llvm::Value *EmitX86BuiltinExpr(unsigned BuiltinID, const CallExpr *E);
   llvm::Value *EmitPPCBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
   





More information about the cfe-commits mailing list