summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-08-07 00:43:25 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-08-07 00:43:25 +0000
commit39fd6e81b1b0de8b820155dc6a0dae226c109de6 (patch)
treea800ed52d4da1c82391a47f60a4d89fb290d4bae /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
parent9200e81a1828f7d3aa59a48c52317e1beeeac0b1 (diff)
downloadllvm-39fd6e81b1b0de8b820155dc6a0dae226c109de6.tar.gz
llvm-39fd6e81b1b0de8b820155dc6a0dae226c109de6.tar.bz2
llvm-39fd6e81b1b0de8b820155dc6a0dae226c109de6.tar.xz
Factor code that finalize PHI nodes, jump tables, etc. out of SelectBasicBlock. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54438 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 961c12d7a7..ac30ff63b7 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -5441,29 +5441,38 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
// each basic block.
NodeAllocatorType NodeAllocator;
- for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
- SelectBasicBlock(I, MF, FuncInfo, NodeAllocator);
+ std::vector<std::pair<MachineInstr*, unsigned> > PHINodesToUpdate;
+ for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
+ BasicBlock *LLVMBB = &*I;
+ PHINodesToUpdate.clear();
+ SelectBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator);
+ FinishBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator);
+ }
}
void
SelectionDAGISel::SelectBasicBlock(BasicBlock *LLVMBB, MachineFunction &MF,
FunctionLoweringInfo &FuncInfo,
+ std::vector<std::pair<MachineInstr*, unsigned> > &PHINodesToUpdate,
NodeAllocatorType &NodeAllocator) {
- std::vector<std::pair<MachineInstr*, unsigned> > PHINodesToUpdate;
- {
- SelectionDAG DAG(TLI, MF, FuncInfo,
- getAnalysisToUpdate<MachineModuleInfo>(),
- NodeAllocator);
- CurDAG = &DAG;
+ SelectionDAG DAG(TLI, MF, FuncInfo,
+ getAnalysisToUpdate<MachineModuleInfo>(),
+ NodeAllocator);
+ CurDAG = &DAG;
- // First step, lower LLVM code to some DAG. This DAG may use operations and
- // types that are not supported by the target.
- BuildSelectionDAG(DAG, LLVMBB, PHINodesToUpdate, FuncInfo);
+ // First step, lower LLVM code to some DAG. This DAG may use operations and
+ // types that are not supported by the target.
+ BuildSelectionDAG(DAG, LLVMBB, PHINodesToUpdate, FuncInfo);
- // Second step, emit the lowered DAG as machine code.
- CodeGenAndEmitDAG(DAG);
- }
+ // Second step, emit the lowered DAG as machine code.
+ CodeGenAndEmitDAG(DAG);
+}
+void
+SelectionDAGISel::FinishBasicBlock(BasicBlock *LLVMBB, MachineFunction &MF,
+ FunctionLoweringInfo &FuncInfo,
+ std::vector<std::pair<MachineInstr*, unsigned> > &PHINodesToUpdate,
+ NodeAllocatorType &NodeAllocator) {
DOUT << "Total amount of phi nodes to update: "
<< PHINodesToUpdate.size() << "\n";
DEBUG(for (unsigned i = 0, e = PHINodesToUpdate.size(); i != e; ++i)