From 9e97587e022ac38258cd59339b4bae66894f9bfb Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Thu, 14 Jun 2012 01:19:35 +0000 Subject: [PATCH] Add long branch expansion pass for MIPS. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158433 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/Mips.h | 1 + lib/Target/Mips/MipsTargetMachine.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Target/Mips/Mips.h b/lib/Target/Mips/Mips.h index 5ce23471448..2963f7e7fa4 100644 --- a/lib/Target/Mips/Mips.h +++ b/lib/Target/Mips/Mips.h @@ -24,6 +24,7 @@ namespace llvm { FunctionPass *createMipsISelDag(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); + FunctionPass *createMipsLongBranchPass(MipsTargetMachine &TM); FunctionPass *createMipsJITCodeEmitterPass(MipsTargetMachine &TM, JITCodeEmitter &JCE); diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index 7ba610e3b1c..b03baa81f2a 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -124,7 +124,13 @@ bool MipsPassConfig::addInstSelector() { // machine code is emitted. return true if -print-machineinstrs should // print out the code after the passes. bool MipsPassConfig::addPreEmitPass() { - PM->add(createMipsDelaySlotFillerPass(getMipsTargetMachine())); + MipsTargetMachine &TM = getMipsTargetMachine(); + PM->add(createMipsDelaySlotFillerPass(TM)); + + // NOTE: long branch has not been implemented for mips16. + if (TM.getSubtarget().hasStandardEncoding()) + PM->add(createMipsLongBranchPass(TM)); + return true; }