diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h index 140ddde045b..1d9940408a6 100644 --- a/lib/Target/Mips/MipsSubtarget.h +++ b/lib/Target/Mips/MipsSubtarget.h @@ -194,6 +194,10 @@ public: bool mipsSEUsesSoftFloat() const; + bool enableLongBranchPass() const { + return hasStandardEncoding() || allowMixed16_32(); + } + /// Features related to the presence of specific instructions. bool hasSEInReg() const { return HasSEInReg; } bool hasCondMov() const { return HasCondMov; } diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index f25afe33ff9..06f78e0ab36 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -197,8 +197,7 @@ bool MipsPassConfig::addPreEmitPass() { const MipsSubtarget &Subtarget = TM.getSubtarget(); addPass(createMipsDelaySlotFillerPass(TM)); - if (Subtarget.hasStandardEncoding() || - Subtarget.allowMixed16_32()) + if (Subtarget.enableLongBranchPass()) addPass(createMipsLongBranchPass(TM)); if (Subtarget.inMips16Mode() || Subtarget.allowMixed16_32())