[llvm-commits] [dragonegg] r103613 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed May 12 06:38:44 PDT 2010


Author: baldrick
Date: Wed May 12 08:38:44 2010
New Revision: 103613

URL: http://llvm.org/viewvc/llvm-project?rev=103613&view=rev
Log:
Port commit 99593 (echristo) from llvm-gcc:
Try to lower in the backend first, it may know what to do better for the
target.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=103613&r1=103612&r2=103613&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Wed May 12 08:38:44 2010
@@ -3428,8 +3428,7 @@
 //                     ... Builtin Function Expansion ...
 //===----------------------------------------------------------------------===//
 
-/// EmitFrontendExpandedBuiltinCall - For MD builtins that do not have a
-/// directly corresponding LLVM intrinsic, we allow the target to do some amount
+/// EmitFrontendExpandedBuiltinCall - We allow the target to do some amount
 /// of lowering.  This allows us to avoid having intrinsics for operations that
 /// directly correspond to LLVM constructs.
 ///
@@ -3581,15 +3580,17 @@
 #ifdef LLVM_TARGET_INTRINSIC_PREFIX
       TargetPrefix = LLVM_TARGET_INTRINSIC_PREFIX;
 #endif
+      // If the backend has some special code to lower, go ahead and try to
+      // do that first.
+      if (EmitFrontendExpandedBuiltinCall(stmt, fndecl, DestLoc, Result))
+        return true;
+
       // If this builtin directly corresponds to an LLVM intrinsic, get the
       // IntrinsicID now.
       const char *BuiltinName = IDENTIFIER_POINTER(DECL_NAME(fndecl));
       Intrinsic::ID IntrinsicID =
         Intrinsic::getIntrinsicForGCCBuiltin(TargetPrefix, BuiltinName);
       if (IntrinsicID == Intrinsic::not_intrinsic) {
-        if (EmitFrontendExpandedBuiltinCall(stmt, fndecl, DestLoc, Result))
-          return true;
-
         error_at(gimple_location(stmt),
                  "unsupported target builtin %<%s%> used", BuiltinName);
         const Type *ResTy = ConvertType(gimple_call_return_type(stmt));





More information about the llvm-commits mailing list