[llvm-commits] [llvm] r101825 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Dan Gohman
gohman at apple.com
Mon Apr 19 15:51:14 PDT 2010
Author: djg
Date: Mon Apr 19 17:51:14 2010
New Revision: 101825
URL: http://llvm.org/viewvc/llvm-project?rev=101825&view=rev
Log:
Eliminate SelectionDAGISel's "current block" member. Just pass it as
an argument to things that need it.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=101825&r1=101824&r2=101825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Mon Apr 19 17:51:14 2010
@@ -46,7 +46,6 @@
MachineRegisterInfo *RegInfo;
SelectionDAG *CurDAG;
SelectionDAGBuilder *SDB;
- MachineBasicBlock *BB;
AliasAnalysis *AA;
GCFunctionInfo *GFI;
CodeGenOpt::Level OptLevel;
@@ -283,13 +282,14 @@
void PrepareEHLandingPad(MachineBasicBlock *BB);
void SelectAllBasicBlocks(const Function &Fn);
- void FinishBasicBlock();
+ void FinishBasicBlock(MachineBasicBlock *BB);
- void SelectBasicBlock(const BasicBlock *LLVMBB,
+ void SelectBasicBlock(MachineBasicBlock *BB,
+ const BasicBlock *LLVMBB,
BasicBlock::const_iterator Begin,
BasicBlock::const_iterator End,
bool &HadTailCall);
- void CodeGenAndEmitDAG();
+ void CodeGenAndEmitDAG(MachineBasicBlock *BB);
void LowerArguments(const BasicBlock *BB);
void ShrinkDemandedOps();
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=101825&r1=101824&r2=101825&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 19 17:51:14 2010
@@ -249,7 +249,8 @@
FastIS->setCurDebugLoc(DebugLoc());
}
-void SelectionDAGISel::SelectBasicBlock(const BasicBlock *LLVMBB,
+void SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB,
+ const BasicBlock *LLVMBB,
BasicBlock::const_iterator Begin,
BasicBlock::const_iterator End,
bool &HadTailCall) {
@@ -286,7 +287,7 @@
CurDAG->setRoot(SDB->getControlRoot());
// Final step, emit the lowered DAG as machine code.
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
HadTailCall = SDB->HasTailCall;
SDB->clear();
}
@@ -473,7 +474,7 @@
} while (!Worklist.empty());
}
-void SelectionDAGISel::CodeGenAndEmitDAG() {
+void SelectionDAGISel::CodeGenAndEmitDAG(MachineBasicBlock *BB) {
std::string GroupName;
if (TimePassesIsEnabled)
GroupName = "Instruction Selection and Scheduling";
@@ -754,7 +755,7 @@
// Iterate over all basic blocks in the function.
for (Function::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
const BasicBlock *LLVMBB = &*I;
- BB = FuncInfo->MBBMap[LLVMBB];
+ MachineBasicBlock *BB = FuncInfo->MBBMap[LLVMBB];
BasicBlock::const_iterator const Begin = LLVMBB->begin();
BasicBlock::const_iterator const End = LLVMBB->end();
@@ -790,7 +791,7 @@
// beginning FastISel on the entry block.
if (LLVMBB == &Fn.getEntryBlock()) {
CurDAG->setRoot(SDB->getControlRoot());
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
SDB->clear();
}
FastIS->startNewBlock(BB);
@@ -838,7 +839,7 @@
}
bool HadTailCall = false;
- SelectBasicBlock(LLVMBB, BI, llvm::next(BI), HadTailCall);
+ SelectBasicBlock(BB, LLVMBB, BI, llvm::next(BI), HadTailCall);
// If the call was emitted as a tail call, we're done with the block.
if (HadTailCall) {
@@ -874,17 +875,17 @@
// block.
if (BI != End) {
bool HadTailCall;
- SelectBasicBlock(LLVMBB, BI, End, HadTailCall);
+ SelectBasicBlock(BB, LLVMBB, BI, End, HadTailCall);
}
- FinishBasicBlock();
+ FinishBasicBlock(BB);
}
delete FastIS;
}
void
-SelectionDAGISel::FinishBasicBlock() {
+SelectionDAGISel::FinishBasicBlock(MachineBasicBlock *BB) {
DEBUG(dbgs() << "Target-post-processed machine code:\n");
DEBUG(BB->dump());
@@ -923,7 +924,7 @@
// Emit the code
SDB->visitBitTestHeader(SDB->BitTestCases[i], BB);
CurDAG->setRoot(SDB->getRoot());
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
SDB->clear();
}
@@ -944,7 +945,7 @@
CurDAG->setRoot(SDB->getRoot());
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
SDB->clear();
}
@@ -991,7 +992,7 @@
SDB->visitJumpTableHeader(SDB->JTCases[i].second, SDB->JTCases[i].first,
BB);
CurDAG->setRoot(SDB->getRoot());
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
SDB->clear();
}
@@ -1000,7 +1001,7 @@
// Emit the code
SDB->visitJumpTable(SDB->JTCases[i].second);
CurDAG->setRoot(SDB->getRoot());
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
SDB->clear();
// Update PHI Nodes
@@ -1048,7 +1049,7 @@
// Emit the code
SDB->visitSwitchCase(SDB->SwitchCases[i], BB);
CurDAG->setRoot(SDB->getRoot());
- CodeGenAndEmitDAG();
+ CodeGenAndEmitDAG(BB);
// Handle any PHI nodes in successors of this chunk, as if we were coming
// from the original BB before switch expansion. Note that PHI nodes can
More information about the llvm-commits
mailing list