[llvm-commits] [llvm] r57040 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Dan Gohman gohman at apple.com
Fri Oct 3 17:56:36 PDT 2008


Author: djg
Date: Fri Oct  3 19:56:36 2008
New Revision: 57040

URL: http://llvm.org/viewvc/llvm-project?rev=57040&view=rev
Log:
Fix fast-isel's handling of atomic instructions. They may
expand to multiple basic blocks, in which case fast-isel
needs to informed of which block to use as it resumes
inserting instructions.

Modified:
    llvm/trunk/include/llvm/CodeGen/FastISel.h
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=57040&r1=57039&r2=57040&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/FastISel.h (original)
+++ llvm/trunk/include/llvm/CodeGen/FastISel.h Fri Oct  3 19:56:36 2008
@@ -55,12 +55,20 @@
   const TargetLowering &TLI;
 
 public:
+  /// startNewBlock - Set the current block, to which generated
+  /// machine instructions will be appended, and clear the local
+  /// CSE map.
+  ///
+  void startNewBlock(MachineBasicBlock *mbb) {
+    setCurrentBlock(mbb);
+    LocalValueMap.clear();
+  }
+
   /// setCurrentBlock - Set the current block, to which generated
   /// machine instructions will be appended.
   ///
   void setCurrentBlock(MachineBasicBlock *mbb) {
     MBB = mbb;
-    LocalValueMap.clear();
   }
 
   /// SelectInstruction - Do "fast" instruction selection for the given

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=57040&r1=57039&r2=57040&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct  3 19:56:36 2008
@@ -756,7 +756,7 @@
         CodeGenAndEmitDAG();
         SDL->clear();
       }
-      FastIS->setCurrentBlock(BB);
+      FastIS->startNewBlock(BB);
       // Do FastISel on as many instructions as possible.
       for (; BI != End; ++BI) {
         // Just before the terminator instruction, insert instructions to
@@ -794,6 +794,9 @@
           }
 
           SelectBasicBlock(LLVMBB, BI, next(BI));
+          // If the instruction was codegen'd with multiple blocks,
+          // inform the FastISel object where to resume inserting.
+          FastIS->setCurrentBlock(BB);
           continue;
         }
 





More information about the llvm-commits mailing list