mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-13 08:25:27 +00:00
Fix for PR1224.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34610 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -500,6 +500,7 @@ public:
|
|||||||
|
|
||||||
// These all get lowered before this pass.
|
// These all get lowered before this pass.
|
||||||
void visitInvoke(InvokeInst &I);
|
void visitInvoke(InvokeInst &I);
|
||||||
|
void visitInvoke(InvokeInst &I, bool AsTerminator);
|
||||||
void visitUnwind(UnwindInst &I);
|
void visitUnwind(UnwindInst &I);
|
||||||
|
|
||||||
void visitScalarBinary(User &I, unsigned OpCode);
|
void visitScalarBinary(User &I, unsigned OpCode);
|
||||||
@@ -1102,10 +1103,14 @@ void SelectionDAGLowering::visitJumpTable(SelectionDAGISel::JumpTable &JT) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SelectionDAGLowering::visitInvoke(InvokeInst &I) {
|
void SelectionDAGLowering::visitInvoke(InvokeInst &I) {
|
||||||
|
assert(0 && "Should never be visited directly");
|
||||||
|
}
|
||||||
|
void SelectionDAGLowering::visitInvoke(InvokeInst &I, bool AsTerminator) {
|
||||||
// Retrieve successors.
|
// Retrieve successors.
|
||||||
MachineBasicBlock *Return = FuncInfo.MBBMap[I.getSuccessor(0)];
|
MachineBasicBlock *Return = FuncInfo.MBBMap[I.getSuccessor(0)];
|
||||||
MachineBasicBlock *LandingPad = FuncInfo.MBBMap[I.getSuccessor(1)];
|
MachineBasicBlock *LandingPad = FuncInfo.MBBMap[I.getSuccessor(1)];
|
||||||
|
|
||||||
|
if (!AsTerminator) {
|
||||||
// Mark landing pad so that it doesn't get deleted in branch folding.
|
// Mark landing pad so that it doesn't get deleted in branch folding.
|
||||||
LandingPad->setIsLandingPad();
|
LandingPad->setIsLandingPad();
|
||||||
|
|
||||||
@@ -1133,13 +1138,14 @@ void SelectionDAGLowering::visitInvoke(InvokeInst &I) {
|
|||||||
// Inform MachineModuleInfo of range.
|
// Inform MachineModuleInfo of range.
|
||||||
MMI->addInvoke(LandingPad, BeginLabel, EndLabel);
|
MMI->addInvoke(LandingPad, BeginLabel, EndLabel);
|
||||||
|
|
||||||
// Drop into normal successor.
|
|
||||||
DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(),
|
|
||||||
DAG.getBasicBlock(Return)));
|
|
||||||
|
|
||||||
// Update successor info
|
// Update successor info
|
||||||
CurMBB->addSuccessor(Return);
|
CurMBB->addSuccessor(Return);
|
||||||
CurMBB->addSuccessor(LandingPad);
|
CurMBB->addSuccessor(LandingPad);
|
||||||
|
} else {
|
||||||
|
// Drop into normal successor.
|
||||||
|
DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(),
|
||||||
|
DAG.getBasicBlock(Return)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionDAGLowering::visitUnwind(UnwindInst &I) {
|
void SelectionDAGLowering::visitUnwind(UnwindInst &I) {
|
||||||
@@ -4217,6 +4223,10 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
|
|||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
SDL.visit(*I);
|
SDL.visit(*I);
|
||||||
|
|
||||||
|
// Lower call part of invoke.
|
||||||
|
InvokeInst *Invoke = dyn_cast<InvokeInst>(LLVMBB->getTerminator());
|
||||||
|
if (Invoke) SDL.visitInvoke(*Invoke, false);
|
||||||
|
|
||||||
// Ensure that all instructions which are used outside of their defining
|
// Ensure that all instructions which are used outside of their defining
|
||||||
// blocks are available as virtual registers.
|
// blocks are available as virtual registers.
|
||||||
for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I)
|
for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I)
|
||||||
@@ -4328,7 +4338,12 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lower the terminator after the copies are emitted.
|
// Lower the terminator after the copies are emitted.
|
||||||
|
if (Invoke) {
|
||||||
|
// Just the branch part of invoke.
|
||||||
|
SDL.visitInvoke(*Invoke, true);
|
||||||
|
} else {
|
||||||
SDL.visit(*LLVMBB->getTerminator());
|
SDL.visit(*LLVMBB->getTerminator());
|
||||||
|
}
|
||||||
|
|
||||||
// Copy over any CaseBlock records that may now exist due to SwitchInst
|
// Copy over any CaseBlock records that may now exist due to SwitchInst
|
||||||
// lowering, as well as any jump table information.
|
// lowering, as well as any jump table information.
|
||||||
|
Reference in New Issue
Block a user