Jia Liu | 9f61011 | 2012-02-17 08:55:11 +0000 | [diff] [blame] | 1 | //===-- MipsTargetMachine.cpp - Define TargetMachine for Mips -------------===// |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 7 | // |
Akira Hatanaka | e248912 | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 9 | // |
| 10 | // Implements the info about Mips target spec. |
| 11 | // |
Akira Hatanaka | e248912 | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 12 | //===----------------------------------------------------------------------===// |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 13 | |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 14 | #include "MipsTargetMachine.h" |
Craig Topper | b25fda9 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 15 | #include "Mips.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 16 | #include "Mips16FrameLowering.h" |
| 17 | #include "Mips16HardFloat.h" |
| 18 | #include "Mips16ISelDAGToDAG.h" |
| 19 | #include "Mips16ISelLowering.h" |
| 20 | #include "Mips16InstrInfo.h" |
Akira Hatanaka | fab8929 | 2012-08-02 18:21:47 +0000 | [diff] [blame] | 21 | #include "MipsFrameLowering.h" |
| 22 | #include "MipsInstrInfo.h" |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 23 | #include "MipsModuleISelDAGToDAG.h" |
Reed Kotler | fe94cc3 | 2013-04-10 16:58:04 +0000 | [diff] [blame] | 24 | #include "MipsOs16.h" |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 25 | #include "MipsSEFrameLowering.h" |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 26 | #include "MipsSEISelDAGToDAG.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 27 | #include "MipsSEISelLowering.h" |
| 28 | #include "MipsSEInstrInfo.h" |
Aditya Nandakumar | a271932 | 2014-11-13 09:26:31 +0000 | [diff] [blame] | 29 | #include "MipsTargetObjectFile.h" |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 30 | #include "llvm/Analysis/TargetTransformInfo.h" |
Andrew Trick | ccb6736 | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 31 | #include "llvm/CodeGen/Passes.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 32 | #include "llvm/PassManager.h" |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 33 | #include "llvm/Support/Debug.h" |
Evan Cheng | 2bb4035 | 2011-08-24 18:08:43 +0000 | [diff] [blame] | 34 | #include "llvm/Support/TargetRegistry.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 35 | #include "llvm/Support/raw_ostream.h" |
Richard Sandiford | 37cd6cf | 2013-08-23 10:27:02 +0000 | [diff] [blame] | 36 | #include "llvm/Transforms/Scalar.h" |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 37 | using namespace llvm; |
| 38 | |
Chandler Carruth | e96dd89 | 2014-04-21 22:55:11 +0000 | [diff] [blame] | 39 | #define DEBUG_TYPE "mips" |
| 40 | |
Daniel Dunbar | 5680b4f | 2009-07-25 06:49:55 +0000 | [diff] [blame] | 41 | extern "C" void LLVMInitializeMipsTarget() { |
| 42 | // Register the target. |
Akira Hatanaka | 3d673cc | 2011-09-21 03:00:58 +0000 | [diff] [blame] | 43 | RegisterTargetMachine<MipsebTargetMachine> X(TheMipsTarget); |
Eli Friedman | 57c11da | 2009-08-03 02:22:28 +0000 | [diff] [blame] | 44 | RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget); |
Akira Hatanaka | 3065180 | 2012-07-31 21:39:17 +0000 | [diff] [blame] | 45 | RegisterTargetMachine<MipsebTargetMachine> A(TheMips64Target); |
| 46 | RegisterTargetMachine<MipselTargetMachine> B(TheMips64elTarget); |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 47 | } |
| 48 | |
Eric Christopher | 8b77065 | 2015-01-26 19:03:15 +0000 | [diff] [blame] | 49 | static std::string computeDataLayout(bool isLittle, MipsABIInfo &ABI) { |
| 50 | std::string Ret = ""; |
| 51 | |
| 52 | // There are both little and big endian mips. |
| 53 | if (isLittle) |
| 54 | Ret += "e"; |
| 55 | else |
| 56 | Ret += "E"; |
| 57 | |
| 58 | Ret += "-m:m"; |
| 59 | |
| 60 | // Pointers are 32 bit on some ABIs. |
| 61 | if (!ABI.IsN64()) |
| 62 | Ret += "-p:32:32"; |
| 63 | |
| 64 | // 8 and 16 bit integers only need no have natural alignment, but try to |
| 65 | // align them to 32 bits. 64 bit integers have natural alignment. |
| 66 | Ret += "-i8:8:32-i16:16:32-i64:64"; |
| 67 | |
| 68 | // 32 bit registers are always available and the stack is at least 64 bit |
| 69 | // aligned. On N64 64 bit registers are also available and the stack is |
| 70 | // 128 bit aligned. |
| 71 | if (ABI.IsN64() || ABI.IsN32()) |
| 72 | Ret += "-n32:64-S128"; |
| 73 | else |
| 74 | Ret += "-n32-S64"; |
| 75 | |
| 76 | return Ret; |
| 77 | } |
| 78 | |
Bruno Cardoso Lopes | 4331883 | 2007-08-28 05:13:42 +0000 | [diff] [blame] | 79 | // On function prologue, the stack is created by decrementing |
| 80 | // its pointer. Once decremented, all references are done with positive |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 81 | // offset from the stack/frame pointer, using StackGrowsUp enables |
Bruno Cardoso Lopes | 4659aad | 2008-08-06 06:14:43 +0000 | [diff] [blame] | 82 | // an easier handling. |
Bruno Cardoso Lopes | c9c3f49 | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 83 | // Using CodeModel::Large enables different CALL behavior. |
Eric Christopher | 4407dde | 2014-07-02 00:54:07 +0000 | [diff] [blame] | 84 | MipsTargetMachine::MipsTargetMachine(const Target &T, StringRef TT, |
| 85 | StringRef CPU, StringRef FS, |
| 86 | const TargetOptions &Options, |
| 87 | Reloc::Model RM, CodeModel::Model CM, |
| 88 | CodeGenOpt::Level OL, bool isLittle) |
| 89 | : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL), |
Eric Christopher | a576281 | 2015-01-26 17:33:46 +0000 | [diff] [blame] | 90 | isLittle(isLittle), TLOF(make_unique<MipsTargetObjectFile>()), |
| 91 | ABI(MipsABIInfo::computeTargetABI(Triple(TT), CPU, Options.MCOptions)), |
Eric Christopher | 8b77065 | 2015-01-26 19:03:15 +0000 | [diff] [blame] | 92 | DL(computeDataLayout(isLittle, ABI)), Subtarget(nullptr), |
| 93 | DefaultSubtarget(TT, CPU, FS, isLittle, *this), |
Eric Christopher | 4e7d1e7 | 2014-07-18 23:41:32 +0000 | [diff] [blame] | 94 | NoMips16Subtarget(TT, CPU, FS.empty() ? "-mips16" : FS.str() + ",-mips16", |
Eric Christopher | 9072428 | 2015-01-08 18:18:57 +0000 | [diff] [blame] | 95 | isLittle, *this), |
Eric Christopher | 4e7d1e7 | 2014-07-18 23:41:32 +0000 | [diff] [blame] | 96 | Mips16Subtarget(TT, CPU, FS.empty() ? "+mips16" : FS.str() + ",+mips16", |
Eric Christopher | 9072428 | 2015-01-08 18:18:57 +0000 | [diff] [blame] | 97 | isLittle, *this) { |
Eric Christopher | 4e7d1e7 | 2014-07-18 23:41:32 +0000 | [diff] [blame] | 98 | Subtarget = &DefaultSubtarget; |
Rafael Espindola | 227144c | 2013-05-13 01:16:13 +0000 | [diff] [blame] | 99 | initAsmInfo(); |
Bruno Cardoso Lopes | 35d86e6 | 2007-10-09 03:01:19 +0000 | [diff] [blame] | 100 | } |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 101 | |
Reid Kleckner | 357600e | 2014-11-20 23:37:18 +0000 | [diff] [blame] | 102 | MipsTargetMachine::~MipsTargetMachine() {} |
| 103 | |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 104 | void MipsebTargetMachine::anchor() { } |
| 105 | |
Akira Hatanaka | 3d673cc | 2011-09-21 03:00:58 +0000 | [diff] [blame] | 106 | MipsebTargetMachine:: |
| 107 | MipsebTargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 50f02cb | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 108 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | ecb2908 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 109 | Reloc::Model RM, CodeModel::Model CM, |
Nick Lewycky | 50f02cb | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 110 | CodeGenOpt::Level OL) |
| 111 | : MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {} |
Akira Hatanaka | 3d673cc | 2011-09-21 03:00:58 +0000 | [diff] [blame] | 112 | |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 113 | void MipselTargetMachine::anchor() { } |
| 114 | |
Bruno Cardoso Lopes | 326a037 | 2008-06-04 01:45:25 +0000 | [diff] [blame] | 115 | MipselTargetMachine:: |
Evan Cheng | 2129f59 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 116 | MipselTargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 50f02cb | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 117 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | ecb2908 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 118 | Reloc::Model RM, CodeModel::Model CM, |
Nick Lewycky | 50f02cb | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 119 | CodeGenOpt::Level OL) |
| 120 | : MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {} |
Bruno Cardoso Lopes | 326a037 | 2008-06-04 01:45:25 +0000 | [diff] [blame] | 121 | |
Eric Christopher | a9353d1 | 2014-09-26 01:44:08 +0000 | [diff] [blame] | 122 | const MipsSubtarget * |
David Majnemer | de36075 | 2014-09-26 02:57:05 +0000 | [diff] [blame] | 123 | MipsTargetMachine::getSubtargetImpl(const Function &F) const { |
Eric Christopher | a9353d1 | 2014-09-26 01:44:08 +0000 | [diff] [blame] | 124 | AttributeSet FnAttrs = F.getAttributes(); |
| 125 | Attribute CPUAttr = |
| 126 | FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-cpu"); |
| 127 | Attribute FSAttr = |
| 128 | FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-features"); |
| 129 | |
| 130 | std::string CPU = !CPUAttr.hasAttribute(Attribute::None) |
| 131 | ? CPUAttr.getValueAsString().str() |
| 132 | : TargetCPU; |
| 133 | std::string FS = !FSAttr.hasAttribute(Attribute::None) |
| 134 | ? FSAttr.getValueAsString().str() |
| 135 | : TargetFS; |
| 136 | bool hasMips16Attr = |
| 137 | !FnAttrs.getAttribute(AttributeSet::FunctionIndex, "mips16") |
| 138 | .hasAttribute(Attribute::None); |
| 139 | bool hasNoMips16Attr = |
| 140 | !FnAttrs.getAttribute(AttributeSet::FunctionIndex, "nomips16") |
| 141 | .hasAttribute(Attribute::None); |
| 142 | |
Eric Christopher | 6a0551e | 2014-09-29 21:57:54 +0000 | [diff] [blame] | 143 | // FIXME: This is related to the code below to reset the target options, |
| 144 | // we need to know whether or not the soft float flag is set on the |
| 145 | // function before we can generate a subtarget. We also need to use |
| 146 | // it as a key for the subtarget since that can be the only difference |
| 147 | // between two functions. |
| 148 | Attribute SFAttr = |
| 149 | FnAttrs.getAttribute(AttributeSet::FunctionIndex, "use-soft-float"); |
| 150 | bool softFloat = !SFAttr.hasAttribute(Attribute::None) |
Eric Christopher | a2db922 | 2014-09-29 23:31:13 +0000 | [diff] [blame] | 151 | ? SFAttr.getValueAsString() == "true" |
Eric Christopher | 6a0551e | 2014-09-29 21:57:54 +0000 | [diff] [blame] | 152 | : Options.UseSoftFloat; |
| 153 | |
Eric Christopher | a9353d1 | 2014-09-26 01:44:08 +0000 | [diff] [blame] | 154 | if (hasMips16Attr) |
| 155 | FS += FS.empty() ? "+mips16" : ",+mips16"; |
| 156 | else if (hasNoMips16Attr) |
| 157 | FS += FS.empty() ? "-mips16" : ",-mips16"; |
| 158 | |
Eric Christopher | 6a0551e | 2014-09-29 21:57:54 +0000 | [diff] [blame] | 159 | auto &I = SubtargetMap[CPU + FS + (softFloat ? "use-soft-float=true" |
| 160 | : "use-soft-float=false")]; |
Eric Christopher | a9353d1 | 2014-09-26 01:44:08 +0000 | [diff] [blame] | 161 | if (!I) { |
| 162 | // This needs to be done before we create a new subtarget since any |
| 163 | // creation will depend on the TM and the code generation flags on the |
| 164 | // function that reside in TargetOptions. |
| 165 | resetTargetOptions(F); |
Eric Christopher | 9072428 | 2015-01-08 18:18:57 +0000 | [diff] [blame] | 166 | I = llvm::make_unique<MipsSubtarget>(TargetTriple, CPU, FS, isLittle, *this); |
Eric Christopher | a9353d1 | 2014-09-26 01:44:08 +0000 | [diff] [blame] | 167 | } |
| 168 | return I.get(); |
| 169 | } |
| 170 | |
Eric Christopher | 4e7d1e7 | 2014-07-18 23:41:32 +0000 | [diff] [blame] | 171 | void MipsTargetMachine::resetSubtarget(MachineFunction *MF) { |
| 172 | DEBUG(dbgs() << "resetSubtarget\n"); |
Eric Christopher | a9353d1 | 2014-09-26 01:44:08 +0000 | [diff] [blame] | 173 | |
David Majnemer | de36075 | 2014-09-26 02:57:05 +0000 | [diff] [blame] | 174 | Subtarget = const_cast<MipsSubtarget *>(getSubtargetImpl(*MF->getFunction())); |
Eric Christopher | fc6de42 | 2014-08-05 02:39:49 +0000 | [diff] [blame] | 175 | MF->setSubtarget(Subtarget); |
Eric Christopher | 4e7d1e7 | 2014-07-18 23:41:32 +0000 | [diff] [blame] | 176 | return; |
| 177 | } |
| 178 | |
Andrew Trick | ccb6736 | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 179 | namespace { |
| 180 | /// Mips Code Generator Pass Configuration Options. |
| 181 | class MipsPassConfig : public TargetPassConfig { |
| 182 | public: |
Andrew Trick | f8ea108 | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 183 | MipsPassConfig(MipsTargetMachine *TM, PassManagerBase &PM) |
Akira Hatanaka | 3c0d6af | 2013-10-07 19:13:53 +0000 | [diff] [blame] | 184 | : TargetPassConfig(TM, PM) { |
| 185 | // The current implementation of long branch pass requires a scratch |
| 186 | // register ($at) to be available before branch instructions. Tail merging |
| 187 | // can break this requirement, so disable it when long branch pass is |
| 188 | // enabled. |
| 189 | EnableTailMerge = !getMipsSubtarget().enableLongBranchPass(); |
| 190 | } |
Andrew Trick | ccb6736 | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 191 | |
| 192 | MipsTargetMachine &getMipsTargetMachine() const { |
| 193 | return getTM<MipsTargetMachine>(); |
| 194 | } |
| 195 | |
| 196 | const MipsSubtarget &getMipsSubtarget() const { |
| 197 | return *getMipsTargetMachine().getSubtargetImpl(); |
| 198 | } |
| 199 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 200 | void addIRPasses() override; |
| 201 | bool addInstSelector() override; |
| 202 | void addMachineSSAOptimization() override; |
Matthias Braun | 7e37a5f | 2014-12-11 21:26:47 +0000 | [diff] [blame] | 203 | void addPreEmitPass() override; |
Reed Kotler | 96b7402 | 2014-03-10 16:31:25 +0000 | [diff] [blame] | 204 | |
Matthias Braun | 7e37a5f | 2014-12-11 21:26:47 +0000 | [diff] [blame] | 205 | void addPreRegAlloc() override; |
Reed Kotler | 96b7402 | 2014-03-10 16:31:25 +0000 | [diff] [blame] | 206 | |
Andrew Trick | ccb6736 | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 207 | }; |
| 208 | } // namespace |
| 209 | |
Andrew Trick | f8ea108 | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 210 | TargetPassConfig *MipsTargetMachine::createPassConfig(PassManagerBase &PM) { |
| 211 | return new MipsPassConfig(this, PM); |
Andrew Trick | ccb6736 | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Reed Kotler | fe94cc3 | 2013-04-10 16:58:04 +0000 | [diff] [blame] | 214 | void MipsPassConfig::addIRPasses() { |
| 215 | TargetPassConfig::addIRPasses(); |
Robin Morisset | e2de06b | 2014-10-16 20:34:57 +0000 | [diff] [blame] | 216 | addPass(createAtomicExpandPass(&getMipsTargetMachine())); |
Reed Kotler | fe94cc3 | 2013-04-10 16:58:04 +0000 | [diff] [blame] | 217 | if (getMipsSubtarget().os16()) |
| 218 | addPass(createMipsOs16(getMipsTargetMachine())); |
Reed Kotler | 783c794 | 2013-05-10 22:25:39 +0000 | [diff] [blame] | 219 | if (getMipsSubtarget().inMips16HardFloat()) |
| 220 | addPass(createMips16HardFloat(getMipsTargetMachine())); |
Reed Kotler | fe94cc3 | 2013-04-10 16:58:04 +0000 | [diff] [blame] | 221 | } |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 222 | // Install an instruction selector pass using |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 223 | // the ISelDag to gen Mips code. |
Bill Wendling | b12f16e | 2012-05-01 08:27:43 +0000 | [diff] [blame] | 224 | bool MipsPassConfig::addInstSelector() { |
Eric Christopher | a08db01b | 2014-07-18 20:29:02 +0000 | [diff] [blame] | 225 | addPass(createMipsModuleISelDag(getMipsTargetMachine())); |
| 226 | addPass(createMips16ISelDag(getMipsTargetMachine())); |
| 227 | addPass(createMipsSEISelDag(getMipsTargetMachine())); |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 228 | return false; |
| 229 | } |
| 230 | |
Akira Hatanaka | 168d4e5 | 2013-11-27 23:38:42 +0000 | [diff] [blame] | 231 | void MipsPassConfig::addMachineSSAOptimization() { |
| 232 | addPass(createMipsOptimizePICCallPass(getMipsTargetMachine())); |
| 233 | TargetPassConfig::addMachineSSAOptimization(); |
| 234 | } |
| 235 | |
Matthias Braun | 7e37a5f | 2014-12-11 21:26:47 +0000 | [diff] [blame] | 236 | void MipsPassConfig::addPreRegAlloc() { |
| 237 | if (getOptLevel() == CodeGenOpt::None) |
Reed Kotler | 96b7402 | 2014-03-10 16:31:25 +0000 | [diff] [blame] | 238 | addPass(createMipsOptimizePICCallPass(getMipsTargetMachine())); |
Reed Kotler | 96b7402 | 2014-03-10 16:31:25 +0000 | [diff] [blame] | 239 | } |
| 240 | |
Chandler Carruth | 8b04c0d | 2015-02-01 13:20:00 +0000 | [diff] [blame] | 241 | TargetIRAnalysis MipsTargetMachine::getTargetIRAnalysis() { |
| 242 | return TargetIRAnalysis([this](Function &F) { |
| 243 | if (Subtarget->allowMixed16_32()) { |
| 244 | DEBUG(errs() << "No Target Transform Info Pass Added\n"); |
| 245 | // FIXME: This is no longer necessary as the TTI returned is per-function. |
| 246 | return TargetTransformInfo(getDataLayout()); |
| 247 | } |
Chandler Carruth | 93dcdc4 | 2015-01-31 11:17:59 +0000 | [diff] [blame] | 248 | |
Chandler Carruth | 8b04c0d | 2015-02-01 13:20:00 +0000 | [diff] [blame] | 249 | DEBUG(errs() << "Target Transform Info Pass Added\n"); |
| 250 | return TargetTransformInfo(BasicTTIImpl(this)); |
| 251 | }); |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 252 | } |
| 253 | |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 254 | // Implemented by targets that want to run passes immediately before |
| 255 | // machine code is emitted. return true if -print-machineinstrs should |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 256 | // print out the code after the passes. |
Matthias Braun | 7e37a5f | 2014-12-11 21:26:47 +0000 | [diff] [blame] | 257 | void MipsPassConfig::addPreEmitPass() { |
Akira Hatanaka | eb36522 | 2012-06-14 01:19:35 +0000 | [diff] [blame] | 258 | MipsTargetMachine &TM = getMipsTargetMachine(); |
Matthias Braun | b2f2388 | 2014-12-11 23:18:03 +0000 | [diff] [blame] | 259 | addPass(createMipsDelaySlotFillerPass(TM)); |
| 260 | addPass(createMipsLongBranchPass(TM)); |
Eric Christopher | a08db01b | 2014-07-18 20:29:02 +0000 | [diff] [blame] | 261 | addPass(createMipsConstantIslandPass(TM)); |
Bruno Cardoso Lopes | 35e43c4 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 262 | } |