mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Move pass configuration out of pass constructors: TailDuplicate::PreRegAlloc
llvm-svn: 150091
This commit is contained in:
parent
729c7eab42
commit
e696d2f01f
@ -272,7 +272,7 @@ namespace llvm {
|
||||
|
||||
/// TailDuplicate Pass - Duplicate blocks with unconditional branches
|
||||
/// into tails of their predecessors.
|
||||
FunctionPass *createTailDuplicatePass(bool PreRegAlloc = false);
|
||||
FunctionPass *createTailDuplicatePass();
|
||||
|
||||
/// IfConverter Pass - This pass performs machine code if conversion.
|
||||
FunctionPass *createIfConverterPass();
|
||||
|
@ -178,7 +178,7 @@ void TargetPassConfig::addMachinePasses() {
|
||||
|
||||
// Pre-ra tail duplication.
|
||||
if (getOptLevel() != CodeGenOpt::None && !DisableEarlyTailDup) {
|
||||
PM.add(createTailDuplicatePass(true));
|
||||
PM.add(createTailDuplicatePass());
|
||||
printAndVerify("After Pre-RegAlloc TailDuplicate");
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ void TargetPassConfig::addMachinePasses() {
|
||||
|
||||
// Tail duplication.
|
||||
if (getOptLevel() != CodeGenOpt::None && !DisableTailDuplicate) {
|
||||
PM.add(createTailDuplicatePass(false));
|
||||
PM.add(createTailDuplicatePass());
|
||||
printNoVerify("After TailDuplicate");
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ typedef std::vector<std::pair<MachineBasicBlock*,unsigned> > AvailableValsTy;
|
||||
namespace {
|
||||
/// TailDuplicatePass - Perform tail duplication.
|
||||
class TailDuplicatePass : public MachineFunctionPass {
|
||||
bool PreRegAlloc;
|
||||
const TargetInstrInfo *TII;
|
||||
MachineModuleInfo *MMI;
|
||||
MachineRegisterInfo *MRI;
|
||||
bool PreRegAlloc;
|
||||
|
||||
// SSAUpdateVRs - A list of virtual registers for which to update SSA form.
|
||||
SmallVector<unsigned, 16> SSAUpdateVRs;
|
||||
@ -70,8 +70,8 @@ namespace {
|
||||
|
||||
public:
|
||||
static char ID;
|
||||
explicit TailDuplicatePass(bool PreRA) :
|
||||
MachineFunctionPass(ID), PreRegAlloc(PreRA) {}
|
||||
explicit TailDuplicatePass() :
|
||||
MachineFunctionPass(ID), PreRegAlloc(false) {}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||
virtual const char *getPassName() const { return "Tail Duplication"; }
|
||||
@ -118,14 +118,15 @@ namespace {
|
||||
char TailDuplicatePass::ID = 0;
|
||||
}
|
||||
|
||||
FunctionPass *llvm::createTailDuplicatePass(bool PreRegAlloc) {
|
||||
return new TailDuplicatePass(PreRegAlloc);
|
||||
FunctionPass *llvm::createTailDuplicatePass() {
|
||||
return new TailDuplicatePass();
|
||||
}
|
||||
|
||||
bool TailDuplicatePass::runOnMachineFunction(MachineFunction &MF) {
|
||||
TII = MF.getTarget().getInstrInfo();
|
||||
MRI = &MF.getRegInfo();
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
PreRegAlloc = MRI->isSSA();
|
||||
|
||||
bool MadeChange = false;
|
||||
while (TailDuplicateBlocks(MF))
|
||||
@ -823,7 +824,7 @@ TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB,
|
||||
SmallVector<MachineOperand, 4> PriorCond;
|
||||
// This has to check PrevBB->succ_size() because EH edges are ignored by
|
||||
// AnalyzeBranch.
|
||||
if (PrevBB->succ_size() == 1 &&
|
||||
if (PrevBB->succ_size() == 1 &&
|
||||
!TII->AnalyzeBranch(*PrevBB, PriorTBB, PriorFBB, PriorCond, true) &&
|
||||
PriorCond.empty() && !PriorTBB && TailBB->pred_size() == 1 &&
|
||||
!TailBB->hasAddressTaken()) {
|
||||
|
@ -284,7 +284,7 @@ bool PTXPassConfig::addCodeGenPasses(MCContext *&OutContext) {
|
||||
|
||||
// Pre-ra tail duplication.
|
||||
if (getOptLevel() != CodeGenOpt::None) {
|
||||
PM.add(createTailDuplicatePass(true));
|
||||
PM.add(createTailDuplicatePass());
|
||||
printAndVerify("After Pre-RegAlloc TailDuplicate");
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ bool PTXPassConfig::addCodeGenPasses(MCContext *&OutContext) {
|
||||
|
||||
// Tail duplication.
|
||||
if (getOptLevel() != CodeGenOpt::None) {
|
||||
PM.add(createTailDuplicatePass(false));
|
||||
PM.add(createTailDuplicatePass());
|
||||
printNoVerify("After TailDuplicate");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user