2007-10-31 03:37:57 +00:00
|
|
|
//===- StrongPhiElimination.cpp - Eliminate PHI nodes by inserting copies -===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-10-31 03:37:57 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "strongphielim"
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2008-03-10 07:22:36 +00:00
|
|
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
2007-10-31 03:37:57 +00:00
|
|
|
#include "llvm/CodeGen/MachineDominators.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
2010-12-03 19:21:53 +00:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2007-10-31 03:37:57 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
2010-12-05 22:34:08 +00:00
|
|
|
class StrongPHIElimination : public MachineFunctionPass {
|
|
|
|
public:
|
|
|
|
static char ID; // Pass identification, replacement for typeid
|
|
|
|
StrongPHIElimination() : MachineFunctionPass(ID) {
|
|
|
|
initializeStrongPHIEliminationPass(*PassRegistry::getPassRegistry());
|
|
|
|
}
|
2007-10-31 03:37:57 +00:00
|
|
|
|
2010-12-05 22:34:08 +00:00
|
|
|
virtual void getAnalysisUsage(AnalysisUsage&) const;
|
|
|
|
bool runOnMachineFunction(MachineFunction&);
|
|
|
|
};
|
2010-12-03 19:21:53 +00:00
|
|
|
} // namespace
|
2007-10-31 03:37:57 +00:00
|
|
|
|
2008-05-13 00:00:25 +00:00
|
|
|
char StrongPHIElimination::ID = 0;
|
2010-10-12 19:48:12 +00:00
|
|
|
INITIALIZE_PASS_BEGIN(StrongPHIElimination, "strong-phi-node-elimination",
|
|
|
|
"Eliminate PHI nodes for register allocation, intelligently", false, false)
|
|
|
|
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
|
|
|
|
INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
|
|
|
|
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
|
|
|
|
INITIALIZE_PASS_END(StrongPHIElimination, "strong-phi-node-elimination",
|
2010-10-07 22:25:06 +00:00
|
|
|
"Eliminate PHI nodes for register allocation, intelligently", false, false)
|
2008-05-13 00:00:25 +00:00
|
|
|
|
2010-08-06 18:33:48 +00:00
|
|
|
char &llvm::StrongPHIEliminationID = StrongPHIElimination::ID;
|
2007-10-31 03:37:57 +00:00
|
|
|
|
2010-12-05 22:34:08 +00:00
|
|
|
void StrongPHIElimination::getAnalysisUsage(AnalysisUsage& AU) const {
|
|
|
|
AU.setPreservesCFG();
|
|
|
|
AU.addRequired<MachineDominatorTree>();
|
|
|
|
AU.addRequired<SlotIndexes>();
|
|
|
|
AU.addPreserved<SlotIndexes>();
|
|
|
|
AU.addRequired<LiveIntervals>();
|
|
|
|
AU.addPreserved<LiveIntervals>();
|
|
|
|
MachineFunctionPass::getAnalysisUsage(AU);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool StrongPHIElimination::runOnMachineFunction(MachineFunction& Fn) {
|
|
|
|
llvm_unreachable("Strong phi elimination is not implemented");
|
|
|
|
}
|