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
This commit is contained in:
Dan Gohman 2008-10-04 00:56:36 +00:00
parent 022b21ff7c
commit 241f464d24
2 changed files with 13 additions and 2 deletions

View File

@ -55,12 +55,20 @@ protected:
const TargetLowering &TLI; const TargetLowering &TLI;
public: 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 /// setCurrentBlock - Set the current block, to which generated
/// machine instructions will be appended. /// machine instructions will be appended.
/// ///
void setCurrentBlock(MachineBasicBlock *mbb) { void setCurrentBlock(MachineBasicBlock *mbb) {
MBB = mbb; MBB = mbb;
LocalValueMap.clear();
} }
/// SelectInstruction - Do "fast" instruction selection for the given /// SelectInstruction - Do "fast" instruction selection for the given

View File

@ -756,7 +756,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
CodeGenAndEmitDAG(); CodeGenAndEmitDAG();
SDL->clear(); SDL->clear();
} }
FastIS->setCurrentBlock(BB); FastIS->startNewBlock(BB);
// Do FastISel on as many instructions as possible. // Do FastISel on as many instructions as possible.
for (; BI != End; ++BI) { for (; BI != End; ++BI) {
// Just before the terminator instruction, insert instructions to // Just before the terminator instruction, insert instructions to
@ -794,6 +794,9 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
} }
SelectBasicBlock(LLVMBB, BI, next(BI)); 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; continue;
} }