[llvm-commits] llvm-gcc patch

Chris Lattner clattner at apple.com
Tue Nov 28 17:17:27 PST 2006


Applied.


Index: llvm-convert.cpp
===================================================================
--- llvm-convert.cpp    (revision 120665)
+++ llvm-convert.cpp    (working copy)
@@ -34,8 +34,9 @@
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/Module.h"
+#include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
#include "llvm/ADT/StringExtras.h"
#include <iostream>
@@ -2881,12 +2882,19 @@

    Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr,
                                ASM_VOLATILE_P(exp) || !ASM_OUTPUTS 
(exp));
-  Value *CV = new CallInst(Asm, CallOps, StoreCallResultAddr ?  
"tmp" : "",
-                           CurBB);
+  CallInst *CV = new CallInst(Asm, CallOps, StoreCallResultAddr ?  
"tmp" : "",
+                              CurBB);

    // If the call produces a value, store it into the destination.
    if (StoreCallResultAddr)
      new StoreInst(CV, StoreCallResultAddr, CurBB);
+
+  // Give the backend a chance to upgrade the inline asm to LLVM  
code.  This
+  // handles some common cases that LLVM has intrinsics for, e.g.  
x86 bswap ->
+  // llvm.bswap.
+  if (const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo())
+    TAI->ExpandInlineAsm(CV);
+
    return 0;
}


-Chris



More information about the llvm-commits mailing list