llvm.org GIT mirror llvm / 0d24bfb
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 Dan Gohman 10 years ago
1 changed file(s) with 15 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
12381238 // Figure out which block is immediately after the current one.
12391239 MachineBasicBlock *NextBlock = 0;
12401240 MachineFunction::iterator BBI = CurMBB;
1241 if (++BBI != CurMBB->getParent()->end())
1241 if (++BBI != FuncInfo.MF->end())
12421242 NextBlock = BBI;
12431243
12441244 if (I.isUnconditional()) {
12991299 // Okay, we decided not to do this, remove any inserted MBB's and clear
13001300 // SwitchCases.
13011301 for (unsigned i = 1, e = SwitchCases.size(); i != e; ++i)
1302 CurMBB->getParent()->erase(SwitchCases[i].ThisBB);
1302 FuncInfo.MF->erase(SwitchCases[i].ThisBB);
13031303
13041304 SwitchCases.clear();
13051305 }
13611361 // This is used to avoid emitting unnecessary branches to the next block.
13621362 MachineBasicBlock *NextBlock = 0;
13631363 MachineFunction::iterator BBI = CurMBB;
1364 if (++BBI != CurMBB->getParent()->end())
1364 if (++BBI != FuncInfo.MF->end())
13651365 NextBlock = BBI;
13661366
13671367 // If the lhs block is the next block, invert the condition so that we can
14461446 // This is used to avoid emitting unnecessary branches to the next block.
14471447 MachineBasicBlock *NextBlock = 0;
14481448 MachineFunction::iterator BBI = CurMBB;
1449 if (++BBI != CurMBB->getParent()->end())
1449 if (++BBI != FuncInfo.MF->end())
14501450 NextBlock = BBI;
14511451
14521452 SDValue BrCond = DAG.getNode(ISD::BRCOND, getCurDebugLoc(),
14911491 // This is used to avoid emitting unnecessary branches to the next block.
14921492 MachineBasicBlock *NextBlock = 0;
14931493 MachineFunction::iterator BBI = CurMBB;
1494 if (++BBI != CurMBB->getParent()->end())
1494 if (++BBI != FuncInfo.MF->end())
14951495 NextBlock = BBI;
14961496
14971497 MachineBasicBlock* MBB = B.Cases[0].ThisBB;
15421542 // This is used to avoid emitting unnecessary branches to the next block.
15431543 MachineBasicBlock *NextBlock = 0;
15441544 MachineFunction::iterator BBI = CurMBB;
1545 if (++BBI != CurMBB->getParent()->end())
1545 if (++BBI != FuncInfo.MF->end())
15461546 NextBlock = BBI;
15471547
15481548 if (NextMBB == NextBlock)
15951595
15961596 // Get the MachineFunction which holds the current MBB. This is used when
15971597 // inserting any additional MBBs necessary to represent the switch.
1598 MachineFunction *CurMF = CurMBB->getParent();
1598 MachineFunction *CurMF = FuncInfo.MF;
15991599
16001600 // Figure out which block is immediately after the current one.
16011601 MachineBasicBlock *NextBlock = 0;
16021602 MachineFunction::iterator BBI = CR.CaseBB;
16031603
1604 if (++BBI != CurMBB->getParent()->end())
1604 if (++BBI != FuncInfo.MF->end())
16051605 NextBlock = BBI;
16061606
16071607 // TODO: If any two of the cases has the same destination, and if one value
17091709
17101710 // Get the MachineFunction which holds the current MBB. This is used when
17111711 // inserting any additional MBBs necessary to represent the switch.
1712 MachineFunction *CurMF = CurMBB->getParent();
1712 MachineFunction *CurMF = FuncInfo.MF;
17131713
17141714 // Figure out which block is immediately after the current one.
17151715 MachineBasicBlock *NextBlock = 0;
17161716 MachineFunction::iterator BBI = CR.CaseBB;
17171717
1718 if (++BBI != CurMBB->getParent()->end())
1718 if (++BBI != FuncInfo.MF->end())
17191719 NextBlock = BBI;
17201720
17211721 const BasicBlock *LLVMBB = CR.CaseBB->getBasicBlock();
17821782 MachineBasicBlock* Default) {
17831783 // Get the MachineFunction which holds the current MBB. This is used when
17841784 // inserting any additional MBBs necessary to represent the switch.
1785 MachineFunction *CurMF = CurMBB->getParent();
1785 MachineFunction *CurMF = FuncInfo.MF;
17861786
17871787 // Figure out which block is immediately after the current one.
17881788 MachineBasicBlock *NextBlock = 0;
17891789 MachineFunction::iterator BBI = CR.CaseBB;
17901790
1791 if (++BBI != CurMBB->getParent()->end())
1791 if (++BBI != FuncInfo.MF->end())
17921792 NextBlock = BBI;
17931793
17941794 Case& FrontCase = *CR.Range.first;
19171917
19181918 // Get the MachineFunction which holds the current MBB. This is used when
19191919 // inserting any additional MBBs necessary to represent the switch.
1920 MachineFunction *CurMF = CurMBB->getParent();
1920 MachineFunction *CurMF = FuncInfo.MF;
19211921
19221922 // If target does not have legal shift left, do not emit bit tests at all.
19231923 if (!TLI.isOperationLegal(ISD::SHL, TLI.getPointerTy()))
20812081 void SelectionDAGLowering::visitSwitch(SwitchInst &SI) {
20822082 // Figure out which block is immediately after the current one.
20832083 MachineBasicBlock *NextBlock = 0;
2084 MachineFunction::iterator BBI = CurMBB;
20852084
20862085 MachineBasicBlock *Default = FuncInfo.MBBMap[SI.getDefaultDest()];
20872086
27762775
27772776 // Inform the Frame Information that we have just allocated a variable-sized
27782777 // object.
2779 CurMBB->getParent()->getFrameInfo()->CreateVariableSizedObject();
2778 FuncInfo.MF->getFrameInfo()->CreateVariableSizedObject();
27802779 }
27812780
27822781 void SelectionDAGLowering::visitLoad(LoadInst &I) {
48974896 GetRegistersForValue(SDISelAsmOperandInfo &OpInfo,
48984897 std::set &OutputRegs,
48994898 std::set &InputRegs) {
4900 LLVMContext &Context = CurMBB->getParent()->getFunction()->getContext();
4899 LLVMContext &Context = FuncInfo.Fn->getContext();
49014900
49024901 // Compute whether this value requires an input register, an output register,
49034902 // or both.