Avoid using subtarget features when initializing the pass pipeline

on PPC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209376 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-05-22 01:21:35 +00:00
parent 58d9172bb4
commit 6ccae2df5b
2 changed files with 17 additions and 12 deletions

View File

@ -1813,9 +1813,14 @@ protected:
public:
bool runOnMachineFunction(MachineFunction &MF) override {
TM = static_cast<const PPCTargetMachine *>(&MF.getTarget());
// If we don't have VSX then go ahead and return without doing
// anything.
if (!TM->getSubtargetImpl()->hasVSX())
return false;
LIS = &getAnalysis<LiveIntervals>();
TM = static_cast<const PPCTargetMachine *>(&MF.getTarget());
TII = TM->getInstrInfo();
bool Changed = false;
@ -1966,6 +1971,9 @@ protected:
public:
bool runOnMachineFunction(MachineFunction &MF) override {
TM = static_cast<const PPCTargetMachine *>(&MF.getTarget());
// If we don't have VSX on the subtarget, don't do anything.
if (!TM->getSubtargetImpl()->hasVSX())
return false;
TII = TM->getInstrInfo();
bool Changed = false;
@ -2040,6 +2048,9 @@ protected:
public:
bool runOnMachineFunction(MachineFunction &MF) override {
TM = static_cast<const PPCTargetMachine *>(&MF.getTarget());
// If we don't have VSX don't bother doing anything here.
if (!TM->getSubtargetImpl()->hasVSX())
return false;
TII = TM->getInstrInfo();
bool Changed = false;

View File

@ -161,25 +161,19 @@ bool PPCPassConfig::addInstSelector() {
addPass(createPPCCTRLoopsVerify());
#endif
if (getPPCSubtarget().hasVSX())
addPass(createPPCVSXCopyPass());
addPass(createPPCVSXCopyPass());
return false;
}
bool PPCPassConfig::addPreRegAlloc() {
if (getPPCSubtarget().hasVSX()) {
initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry());
insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID,
&PPCVSXFMAMutateID);
}
initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry());
insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID,
&PPCVSXFMAMutateID);
return false;
}
bool PPCPassConfig::addPreSched2() {
if (getPPCSubtarget().hasVSX())
addPass(createPPCVSXCopyCleanupPass());
addPass(createPPCVSXCopyCleanupPass());
if (getOptLevel() != CodeGenOpt::None)
addPass(&IfConverterID);