diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-22 20:55:53 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-22 20:55:53 +0000 |
commit | 5b43aa0ddd44e7fa7d5d6adc377fa2c8d9682216 (patch) | |
tree | 04884bf891a9cbf5364ebd31ed1485d0622086f9 | |
parent | ea2744f4dc82611edb8d70e2dd0b3beef29e4c17 (diff) | |
download | bcm5719-llvm-5b43aa0ddd44e7fa7d5d6adc377fa2c8d9682216.tar.gz bcm5719-llvm-5b43aa0ddd44e7fa7d5d6adc377fa2c8d9682216.zip |
Sink SelectionDAGBuilder's HandlePHINodesInSuccessorBlocks down
into SelectionDAGBuilder itself.
llvm-svn: 102128
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 14 |
3 files changed, 7 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index a1842d7a1e5..9db76053160 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -615,6 +615,10 @@ void SelectionDAGBuilder::AssignOrderingToNode(const SDNode *Node) { } void SelectionDAGBuilder::visit(const Instruction &I) { + // Set up outgoing PHI node register values before emitting the terminator. + if (isa<TerminatorInst>(&I)) + HandlePHINodesInSuccessorBlocks(I.getParent()); + CurDebugLoc = I.getDebugLoc(); visit(I.getOpcode(), I); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index c71e60a315f..d9495fb01ea 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -369,8 +369,6 @@ public: void LowerCallTo(ImmutableCallSite CS, SDValue Callee, bool IsTailCall, MachineBasicBlock *LandingPad = NULL); - void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB); - private: // Terminator instructions. void visitRet(const ReturnInst &I); @@ -495,6 +493,8 @@ private: const char *implVisitBinaryAtomic(const CallInst& I, ISD::NodeType Op); const char *implVisitAluOverflow(const CallInst &I, ISD::NodeType Op); + + void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB); }; } // end namespace llvm diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 8353c18d602..875672e4e10 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -233,21 +233,9 @@ SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB, // Lower all of the non-terminator instructions. If a call is emitted // as a tail call, cease emitting nodes for this block. Terminators // are handled below. - for (BasicBlock::const_iterator I = Begin; - I != End && !SDB->HasTailCall && !isa<TerminatorInst>(I); - ++I) + for (BasicBlock::const_iterator I = Begin; I != End && !SDB->HasTailCall; ++I) SDB->visit(*I); - if (!SDB->HasTailCall) { - // Handle PHI nodes in successor blocks. - if (End == LLVMBB->end()) { - SDB->HandlePHINodesInSuccessorBlocks(LLVMBB); - - // Lower the terminator after the copies are emitted. - SDB->visit(*LLVMBB->getTerminator()); - } - } - // Make sure the root of the DAG is up-to-date. CurDAG->setRoot(SDB->getControlRoot()); |