mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 02:33:53 +00:00
Simplify this code to not depend as much on CurMBB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
010b1b9e7b
commit
0d24bfbf92
@ -1239,7 +1239,7 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
|
|||||||
// Figure out which block is immediately after the current one.
|
// Figure out which block is immediately after the current one.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CurMBB;
|
MachineFunction::iterator BBI = CurMBB;
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
if (I.isUnconditional()) {
|
if (I.isUnconditional()) {
|
||||||
@ -1300,7 +1300,7 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
|
|||||||
// Okay, we decided not to do this, remove any inserted MBB's and clear
|
// Okay, we decided not to do this, remove any inserted MBB's and clear
|
||||||
// SwitchCases.
|
// SwitchCases.
|
||||||
for (unsigned i = 1, e = SwitchCases.size(); i != e; ++i)
|
for (unsigned i = 1, e = SwitchCases.size(); i != e; ++i)
|
||||||
CurMBB->getParent()->erase(SwitchCases[i].ThisBB);
|
FuncInfo.MF->erase(SwitchCases[i].ThisBB);
|
||||||
|
|
||||||
SwitchCases.clear();
|
SwitchCases.clear();
|
||||||
}
|
}
|
||||||
@ -1362,7 +1362,7 @@ void SelectionDAGLowering::visitSwitchCase(CaseBlock &CB) {
|
|||||||
// This is used to avoid emitting unnecessary branches to the next block.
|
// This is used to avoid emitting unnecessary branches to the next block.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CurMBB;
|
MachineFunction::iterator BBI = CurMBB;
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
// If the lhs block is the next block, invert the condition so that we can
|
// If the lhs block is the next block, invert the condition so that we can
|
||||||
@ -1447,7 +1447,7 @@ void SelectionDAGLowering::visitJumpTableHeader(JumpTable &JT,
|
|||||||
// This is used to avoid emitting unnecessary branches to the next block.
|
// This is used to avoid emitting unnecessary branches to the next block.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CurMBB;
|
MachineFunction::iterator BBI = CurMBB;
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
SDValue BrCond = DAG.getNode(ISD::BRCOND, getCurDebugLoc(),
|
SDValue BrCond = DAG.getNode(ISD::BRCOND, getCurDebugLoc(),
|
||||||
@ -1492,7 +1492,7 @@ void SelectionDAGLowering::visitBitTestHeader(BitTestBlock &B) {
|
|||||||
// This is used to avoid emitting unnecessary branches to the next block.
|
// This is used to avoid emitting unnecessary branches to the next block.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CurMBB;
|
MachineFunction::iterator BBI = CurMBB;
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
MachineBasicBlock* MBB = B.Cases[0].ThisBB;
|
MachineBasicBlock* MBB = B.Cases[0].ThisBB;
|
||||||
@ -1543,7 +1543,7 @@ void SelectionDAGLowering::visitBitTestCase(MachineBasicBlock* NextMBB,
|
|||||||
// This is used to avoid emitting unnecessary branches to the next block.
|
// This is used to avoid emitting unnecessary branches to the next block.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CurMBB;
|
MachineFunction::iterator BBI = CurMBB;
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
if (NextMBB == NextBlock)
|
if (NextMBB == NextBlock)
|
||||||
@ -1596,13 +1596,13 @@ bool SelectionDAGLowering::handleSmallSwitchRange(CaseRec& CR,
|
|||||||
|
|
||||||
// Get the MachineFunction which holds the current MBB. This is used when
|
// Get the MachineFunction which holds the current MBB. This is used when
|
||||||
// inserting any additional MBBs necessary to represent the switch.
|
// inserting any additional MBBs necessary to represent the switch.
|
||||||
MachineFunction *CurMF = CurMBB->getParent();
|
MachineFunction *CurMF = FuncInfo.MF;
|
||||||
|
|
||||||
// Figure out which block is immediately after the current one.
|
// Figure out which block is immediately after the current one.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CR.CaseBB;
|
MachineFunction::iterator BBI = CR.CaseBB;
|
||||||
|
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
// TODO: If any two of the cases has the same destination, and if one value
|
// TODO: If any two of the cases has the same destination, and if one value
|
||||||
@ -1710,13 +1710,13 @@ bool SelectionDAGLowering::handleJTSwitchCase(CaseRec& CR,
|
|||||||
|
|
||||||
// Get the MachineFunction which holds the current MBB. This is used when
|
// Get the MachineFunction which holds the current MBB. This is used when
|
||||||
// inserting any additional MBBs necessary to represent the switch.
|
// inserting any additional MBBs necessary to represent the switch.
|
||||||
MachineFunction *CurMF = CurMBB->getParent();
|
MachineFunction *CurMF = FuncInfo.MF;
|
||||||
|
|
||||||
// Figure out which block is immediately after the current one.
|
// Figure out which block is immediately after the current one.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CR.CaseBB;
|
MachineFunction::iterator BBI = CR.CaseBB;
|
||||||
|
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
const BasicBlock *LLVMBB = CR.CaseBB->getBasicBlock();
|
const BasicBlock *LLVMBB = CR.CaseBB->getBasicBlock();
|
||||||
@ -1783,13 +1783,13 @@ bool SelectionDAGLowering::handleBTSplitSwitchCase(CaseRec& CR,
|
|||||||
MachineBasicBlock* Default) {
|
MachineBasicBlock* Default) {
|
||||||
// Get the MachineFunction which holds the current MBB. This is used when
|
// Get the MachineFunction which holds the current MBB. This is used when
|
||||||
// inserting any additional MBBs necessary to represent the switch.
|
// inserting any additional MBBs necessary to represent the switch.
|
||||||
MachineFunction *CurMF = CurMBB->getParent();
|
MachineFunction *CurMF = FuncInfo.MF;
|
||||||
|
|
||||||
// Figure out which block is immediately after the current one.
|
// Figure out which block is immediately after the current one.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CR.CaseBB;
|
MachineFunction::iterator BBI = CR.CaseBB;
|
||||||
|
|
||||||
if (++BBI != CurMBB->getParent()->end())
|
if (++BBI != FuncInfo.MF->end())
|
||||||
NextBlock = BBI;
|
NextBlock = BBI;
|
||||||
|
|
||||||
Case& FrontCase = *CR.Range.first;
|
Case& FrontCase = *CR.Range.first;
|
||||||
@ -1918,7 +1918,7 @@ bool SelectionDAGLowering::handleBitTestsSwitchCase(CaseRec& CR,
|
|||||||
|
|
||||||
// Get the MachineFunction which holds the current MBB. This is used when
|
// Get the MachineFunction which holds the current MBB. This is used when
|
||||||
// inserting any additional MBBs necessary to represent the switch.
|
// inserting any additional MBBs necessary to represent the switch.
|
||||||
MachineFunction *CurMF = CurMBB->getParent();
|
MachineFunction *CurMF = FuncInfo.MF;
|
||||||
|
|
||||||
// If target does not have legal shift left, do not emit bit tests at all.
|
// If target does not have legal shift left, do not emit bit tests at all.
|
||||||
if (!TLI.isOperationLegal(ISD::SHL, TLI.getPointerTy()))
|
if (!TLI.isOperationLegal(ISD::SHL, TLI.getPointerTy()))
|
||||||
@ -2082,7 +2082,6 @@ size_t SelectionDAGLowering::Clusterify(CaseVector& Cases,
|
|||||||
void SelectionDAGLowering::visitSwitch(SwitchInst &SI) {
|
void SelectionDAGLowering::visitSwitch(SwitchInst &SI) {
|
||||||
// Figure out which block is immediately after the current one.
|
// Figure out which block is immediately after the current one.
|
||||||
MachineBasicBlock *NextBlock = 0;
|
MachineBasicBlock *NextBlock = 0;
|
||||||
MachineFunction::iterator BBI = CurMBB;
|
|
||||||
|
|
||||||
MachineBasicBlock *Default = FuncInfo.MBBMap[SI.getDefaultDest()];
|
MachineBasicBlock *Default = FuncInfo.MBBMap[SI.getDefaultDest()];
|
||||||
|
|
||||||
@ -2777,7 +2776,7 @@ void SelectionDAGLowering::visitAlloca(AllocaInst &I) {
|
|||||||
|
|
||||||
// Inform the Frame Information that we have just allocated a variable-sized
|
// Inform the Frame Information that we have just allocated a variable-sized
|
||||||
// object.
|
// object.
|
||||||
CurMBB->getParent()->getFrameInfo()->CreateVariableSizedObject();
|
FuncInfo.MF->getFrameInfo()->CreateVariableSizedObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionDAGLowering::visitLoad(LoadInst &I) {
|
void SelectionDAGLowering::visitLoad(LoadInst &I) {
|
||||||
@ -4898,7 +4897,7 @@ void SelectionDAGLowering::
|
|||||||
GetRegistersForValue(SDISelAsmOperandInfo &OpInfo,
|
GetRegistersForValue(SDISelAsmOperandInfo &OpInfo,
|
||||||
std::set<unsigned> &OutputRegs,
|
std::set<unsigned> &OutputRegs,
|
||||||
std::set<unsigned> &InputRegs) {
|
std::set<unsigned> &InputRegs) {
|
||||||
LLVMContext &Context = CurMBB->getParent()->getFunction()->getContext();
|
LLVMContext &Context = FuncInfo.Fn->getContext();
|
||||||
|
|
||||||
// Compute whether this value requires an input register, an output register,
|
// Compute whether this value requires an input register, an output register,
|
||||||
// or both.
|
// or both.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user