aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-10-04 00:56:36 +0000
committerDan Gohman <gohman@apple.com>2008-10-04 00:56:36 +0000
commit241f464d24a6c22721607841069bbeb17b3f71e6 (patch)
treee26168775e92a51bb8b31aa637ef834345308a9b
parent022b21ff7c047f8c1615a6588052c55427bcd9b0 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57040 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/FastISel.h10
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp5
2 files changed, 13 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h
index 2b112c878c..8bf8827481 100644
--- a/include/llvm/CodeGen/FastISel.h
+++ b/include/llvm/CodeGen/FastISel.h
@@ -55,12 +55,20 @@ protected:
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
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index f2f14490b1..dce46ab414 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -756,7 +756,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
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 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
}
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;
}