Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 1 | //===- StrongPhiElimination.cpp - Eliminate PHI nodes by inserting copies -===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #define DEBUG_TYPE "strongphielim" |
| 14 | #include "llvm/CodeGen/Passes.h" |
Owen Anderson | eb37ecc | 2008-03-10 07:22:36 +0000 | [diff] [blame] | 15 | #include "llvm/CodeGen/LiveIntervalAnalysis.h" |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 16 | #include "llvm/CodeGen/MachineDominators.h" |
| 17 | #include "llvm/CodeGen/MachineFunctionPass.h" |
Jakob Stoklund Olesen | 68be956 | 2010-12-03 19:21:53 +0000 | [diff] [blame] | 18 | #include "llvm/Support/ErrorHandling.h" |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 19 | using namespace llvm; |
| 20 | |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 21 | namespace { |
Cameron Zwarich | 9eaf49b | 2010-12-05 22:34:08 +0000 | [diff] [blame] | 22 | class StrongPHIElimination : public MachineFunctionPass { |
| 23 | public: |
| 24 | static char ID; // Pass identification, replacement for typeid |
| 25 | StrongPHIElimination() : MachineFunctionPass(ID) { |
| 26 | initializeStrongPHIEliminationPass(*PassRegistry::getPassRegistry()); |
| 27 | } |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 28 | |
Cameron Zwarich | 9eaf49b | 2010-12-05 22:34:08 +0000 | [diff] [blame] | 29 | virtual void getAnalysisUsage(AnalysisUsage&) const; |
| 30 | bool runOnMachineFunction(MachineFunction&); |
| 31 | }; |
Jakob Stoklund Olesen | 68be956 | 2010-12-03 19:21:53 +0000 | [diff] [blame] | 32 | } // namespace |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 33 | |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 34 | char StrongPHIElimination::ID = 0; |
Owen Anderson | 2ab36d3 | 2010-10-12 19:48:12 +0000 | [diff] [blame] | 35 | INITIALIZE_PASS_BEGIN(StrongPHIElimination, "strong-phi-node-elimination", |
| 36 | "Eliminate PHI nodes for register allocation, intelligently", false, false) |
| 37 | INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree) |
| 38 | INITIALIZE_PASS_DEPENDENCY(SlotIndexes) |
| 39 | INITIALIZE_PASS_DEPENDENCY(LiveIntervals) |
| 40 | INITIALIZE_PASS_END(StrongPHIElimination, "strong-phi-node-elimination", |
Owen Anderson | ce665bd | 2010-10-07 22:25:06 +0000 | [diff] [blame] | 41 | "Eliminate PHI nodes for register allocation, intelligently", false, false) |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 42 | |
Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 43 | char &llvm::StrongPHIEliminationID = StrongPHIElimination::ID; |
Owen Anderson | 0bda0e8 | 2007-10-31 03:37:57 +0000 | [diff] [blame] | 44 | |
Cameron Zwarich | 9eaf49b | 2010-12-05 22:34:08 +0000 | [diff] [blame] | 45 | void StrongPHIElimination::getAnalysisUsage(AnalysisUsage& AU) const { |
| 46 | AU.setPreservesCFG(); |
| 47 | AU.addRequired<MachineDominatorTree>(); |
| 48 | AU.addRequired<SlotIndexes>(); |
| 49 | AU.addPreserved<SlotIndexes>(); |
| 50 | AU.addRequired<LiveIntervals>(); |
| 51 | AU.addPreserved<LiveIntervals>(); |
| 52 | MachineFunctionPass::getAnalysisUsage(AU); |
| 53 | } |
| 54 | |
| 55 | bool StrongPHIElimination::runOnMachineFunction(MachineFunction& Fn) { |
| 56 | llvm_unreachable("Strong phi elimination is not implemented"); |
| 57 | } |