[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner sabre at nondot.org
Tue Nov 28 17:12:50 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.321 -> 1.322
---
Log message:

add a hook to allow targets to hack on inline asms to lower them to llvm
when they want to.


---
Diffs of the changes:  (+13 -1)

 SelectionDAGISel.cpp |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.321 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.322
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.321	Mon Nov 27 17:36:08 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Tue Nov 28 19:12:32 2006
@@ -33,6 +33,7 @@
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/SSARegMap.h"
 #include "llvm/Target/MRegisterInfo.h"
+#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetFrameInfo.h"
 #include "llvm/Target/TargetInstrInfo.h"
@@ -3780,7 +3781,17 @@
     
     for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) {
       Instruction *I = BBI++;
-      if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I)) {
+      
+      if (CallInst *CI = dyn_cast<CallInst>(I)) {
+        // If we found an inline asm expession, and if the target knows how to
+        // lower it to normal LLVM code, do so now.
+        if (isa<InlineAsm>(CI->getCalledValue()))
+          if (const TargetAsmInfo *TAI = 
+                TLI.getTargetMachine().getTargetAsmInfo()) {
+            if (TAI->ExpandInlineAsm(CI))
+              BBI = BB->begin();
+          }
+      } else if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I)) {
         MadeChange |= OptimizeGEPExpression(GEPI, TLI.getTargetData());
       } else if (CastInst *CI = dyn_cast<CastInst>(I)) {
         // If the source of the cast is a constant, then this should have
@@ -4004,6 +4015,7 @@
       
       unsigned Reg;
       Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB);
+      
       if (Constant *C = dyn_cast<Constant>(PHIOp)) {
         unsigned &RegOut = ConstantsOut[C];
         if (RegOut == 0) {






More information about the llvm-commits mailing list