From 394e6d2b9e5f7d0cd1bd4858c5e24d04f61f40f4 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 18 Jul 2014 20:29:02 +0000 Subject: [PATCH] Make non-module passes unconditionally added in the pass manager for mips, and early exit if we don't want to do anything because of the current subtarget. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213407 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/MipsLongBranch.cpp | 3 ++- lib/Target/Mips/MipsTargetMachine.cpp | 20 +++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/Target/Mips/MipsLongBranch.cpp b/lib/Target/Mips/MipsLongBranch.cpp index c6838a37be2..27110b6e870 100644 --- a/lib/Target/Mips/MipsLongBranch.cpp +++ b/lib/Target/Mips/MipsLongBranch.cpp @@ -449,7 +449,8 @@ bool MipsLongBranch::runOnMachineFunction(MachineFunction &F) { const MipsInstrInfo *TII = static_cast(TM.getInstrInfo()); - if (TM.getSubtarget().inMips16Mode()) + const MipsSubtarget &STI = TM.getSubtarget(); + if (STI.inMips16Mode() || !STI.enableLongBranchPass()) return false; if ((TM.getRelocationModel() == Reloc::PIC_) && TM.getSubtarget().isABI_O32() && diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index 425dbf1d89f..ed0152fdbe5 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -124,13 +124,9 @@ void MipsPassConfig::addIRPasses() { // Install an instruction selector pass using // the ISelDag to gen Mips code. bool MipsPassConfig::addInstSelector() { - if (getMipsSubtarget().allowMixed16_32()) { - addPass(createMipsModuleISelDag(getMipsTargetMachine())); - addPass(createMips16ISelDag(getMipsTargetMachine())); - addPass(createMipsSEISelDag(getMipsTargetMachine())); - } else { - addPass(createMipsISelDag(getMipsTargetMachine())); - } + addPass(createMipsModuleISelDag(getMipsTargetMachine())); + addPass(createMips16ISelDag(getMipsTargetMachine())); + addPass(createMipsSEISelDag(getMipsTargetMachine())); return false; } @@ -166,15 +162,9 @@ void MipsTargetMachine::addAnalysisPasses(PassManagerBase &PM) { // print out the code after the passes. bool MipsPassConfig::addPreEmitPass() { MipsTargetMachine &TM = getMipsTargetMachine(); - const MipsSubtarget &Subtarget = TM.getSubtarget(); addPass(createMipsDelaySlotFillerPass(TM)); - - if (Subtarget.enableLongBranchPass()) - addPass(createMipsLongBranchPass(TM)); - if (Subtarget.inMips16Mode() || - Subtarget.allowMixed16_32()) - addPass(createMipsConstantIslandPass(TM)); - + addPass(createMipsLongBranchPass(TM)); + addPass(createMipsConstantIslandPass(TM)); return true; } -- 2.34.1