Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 1 | //===-- llvm/CodeGen/GlobalISel/IRTranslator.cpp - IRTranslator --*- C++ -*-==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// \file |
| 10 | /// This file implements the IRTranslator class. |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "llvm/CodeGen/GlobalISel/IRTranslator.h" |
| 14 | |
Quentin Colombet | fd9d0a0 | 2016-02-11 19:59:41 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/SmallVector.h" |
Quentin Colombet | ba2a016 | 2016-02-16 19:26:02 +0000 | [diff] [blame] | 16 | #include "llvm/CodeGen/GlobalISel/CallLowering.h" |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/MachineFunction.h" |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/MachineFrameInfo.h" |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
| 20 | #include "llvm/IR/Constant.h" |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 21 | #include "llvm/IR/Function.h" |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 22 | #include "llvm/IR/Type.h" |
| 23 | #include "llvm/IR/Value.h" |
Quentin Colombet | 74d7d2f | 2016-02-11 18:53:28 +0000 | [diff] [blame] | 24 | #include "llvm/Target/TargetLowering.h" |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 25 | |
| 26 | #define DEBUG_TYPE "irtranslator" |
| 27 | |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 28 | using namespace llvm; |
| 29 | |
| 30 | char IRTranslator::ID = 0; |
Quentin Colombet | 39293d3 | 2016-03-08 01:38:55 +0000 | [diff] [blame] | 31 | INITIALIZE_PASS(IRTranslator, "irtranslator", "IRTranslator LLVM IR -> MI", |
Tim Northover | 884b47e | 2016-07-26 03:29:18 +0000 | [diff] [blame] | 32 | false, false) |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 33 | |
Quentin Colombet | a7fae16 | 2016-02-11 17:53:23 +0000 | [diff] [blame] | 34 | IRTranslator::IRTranslator() : MachineFunctionPass(ID), MRI(nullptr) { |
Quentin Colombet | 39293d3 | 2016-03-08 01:38:55 +0000 | [diff] [blame] | 35 | initializeIRTranslatorPass(*PassRegistry::getPassRegistry()); |
Quentin Colombet | a7fae16 | 2016-02-11 17:53:23 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Quentin Colombet | e225e25 | 2016-03-11 17:27:54 +0000 | [diff] [blame] | 38 | unsigned IRTranslator::getOrCreateVReg(const Value &Val) { |
| 39 | unsigned &ValReg = ValToVReg[&Val]; |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 40 | // Check if this is the first time we see Val. |
Quentin Colombet | ccd7725 | 2016-02-11 21:48:32 +0000 | [diff] [blame] | 41 | if (!ValReg) { |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 42 | // Fill ValRegsSequence with the sequence of registers |
| 43 | // we need to concat together to produce the value. |
Quentin Colombet | e225e25 | 2016-03-11 17:27:54 +0000 | [diff] [blame] | 44 | assert(Val.getType()->isSized() && |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 45 | "Don't know how to create an empty vreg"); |
Quentin Colombet | e225e25 | 2016-03-11 17:27:54 +0000 | [diff] [blame] | 46 | assert(!Val.getType()->isAggregateType() && "Not yet implemented"); |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 47 | unsigned Size = DL->getTypeSizeInBits(Val.getType()); |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 48 | unsigned VReg = MRI->createGenericVirtualRegister(Size); |
Quentin Colombet | ccd7725 | 2016-02-11 21:48:32 +0000 | [diff] [blame] | 49 | ValReg = VReg; |
Quentin Colombet | 4f0ec8d | 2016-02-11 17:52:28 +0000 | [diff] [blame] | 50 | assert(!isa<Constant>(Val) && "Not yet implemented"); |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 51 | } |
Quentin Colombet | ccd7725 | 2016-02-11 21:48:32 +0000 | [diff] [blame] | 52 | return ValReg; |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 53 | } |
| 54 | |
Tim Northover | ad2b717 | 2016-07-26 20:23:26 +0000 | [diff] [blame] | 55 | unsigned IRTranslator::getMemOpAlignment(const Instruction &I) { |
| 56 | unsigned Alignment = 0; |
| 57 | Type *ValTy = nullptr; |
| 58 | if (const StoreInst *SI = dyn_cast<StoreInst>(&I)) { |
| 59 | Alignment = SI->getAlignment(); |
| 60 | ValTy = SI->getValueOperand()->getType(); |
| 61 | } else if (const LoadInst *LI = dyn_cast<LoadInst>(&I)) { |
| 62 | Alignment = LI->getAlignment(); |
| 63 | ValTy = LI->getType(); |
| 64 | } else |
| 65 | llvm_unreachable("unhandled memory instruction"); |
| 66 | |
| 67 | return Alignment ? Alignment : DL->getABITypeAlignment(ValTy); |
| 68 | } |
| 69 | |
Quentin Colombet | 53237a9 | 2016-03-11 17:27:43 +0000 | [diff] [blame] | 70 | MachineBasicBlock &IRTranslator::getOrCreateBB(const BasicBlock &BB) { |
| 71 | MachineBasicBlock *&MBB = BBToMBB[&BB]; |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 72 | if (!MBB) { |
Quentin Colombet | a7fae16 | 2016-02-11 17:53:23 +0000 | [diff] [blame] | 73 | MachineFunction &MF = MIRBuilder.getMF(); |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 74 | MBB = MF.CreateMachineBasicBlock(); |
| 75 | MF.push_back(MBB); |
| 76 | } |
| 77 | return *MBB; |
| 78 | } |
| 79 | |
Quentin Colombet | 13c55e0 | 2016-06-10 20:50:18 +0000 | [diff] [blame] | 80 | bool IRTranslator::translateBinaryOp(unsigned Opcode, const Instruction &Inst) { |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 81 | // Get or create a virtual register for each value. |
| 82 | // Unless the value is a Constant => loadimm cst? |
| 83 | // or inline constant each time? |
| 84 | // Creation of a virtual register needs to have a size. |
Quentin Colombet | e225e25 | 2016-03-11 17:27:54 +0000 | [diff] [blame] | 85 | unsigned Op0 = getOrCreateVReg(*Inst.getOperand(0)); |
| 86 | unsigned Op1 = getOrCreateVReg(*Inst.getOperand(1)); |
| 87 | unsigned Res = getOrCreateVReg(Inst); |
Tim Northover | 62ae568 | 2016-07-20 19:09:30 +0000 | [diff] [blame] | 88 | MIRBuilder.buildInstr(Opcode, LLT{*Inst.getType()}, Res, Op0, Op1); |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 89 | return true; |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Quentin Colombet | 74d7d2f | 2016-02-11 18:53:28 +0000 | [diff] [blame] | 92 | bool IRTranslator::translateReturn(const Instruction &Inst) { |
| 93 | assert(isa<ReturnInst>(Inst) && "Return expected"); |
| 94 | const Value *Ret = cast<ReturnInst>(Inst).getReturnValue(); |
| 95 | // The target may mess up with the insertion point, but |
| 96 | // this is not important as a return is the last instruction |
| 97 | // of the block anyway. |
Tom Stellard | b72a65f | 2016-04-14 17:23:33 +0000 | [diff] [blame] | 98 | return CLI->lowerReturn(MIRBuilder, Ret, !Ret ? 0 : getOrCreateVReg(*Ret)); |
Quentin Colombet | 74d7d2f | 2016-02-11 18:53:28 +0000 | [diff] [blame] | 99 | } |
| 100 | |
Quentin Colombet | dd4b137 | 2016-03-11 17:28:03 +0000 | [diff] [blame] | 101 | bool IRTranslator::translateBr(const Instruction &Inst) { |
| 102 | assert(isa<BranchInst>(Inst) && "Branch expected"); |
| 103 | const BranchInst &BrInst = *cast<BranchInst>(&Inst); |
| 104 | if (BrInst.isUnconditional()) { |
| 105 | const BasicBlock &BrTgt = *cast<BasicBlock>(BrInst.getOperand(0)); |
| 106 | MachineBasicBlock &TgtBB = getOrCreateBB(BrTgt); |
Tim Northover | cc5f762 | 2016-07-26 16:45:26 +0000 | [diff] [blame] | 107 | MIRBuilder.buildBr(TgtBB); |
Quentin Colombet | dd4b137 | 2016-03-11 17:28:03 +0000 | [diff] [blame] | 108 | } else { |
| 109 | assert(0 && "Not yet implemented"); |
| 110 | } |
| 111 | // Link successors. |
| 112 | MachineBasicBlock &CurBB = MIRBuilder.getMBB(); |
| 113 | for (const BasicBlock *Succ : BrInst.successors()) |
| 114 | CurBB.addSuccessor(&getOrCreateBB(*Succ)); |
| 115 | return true; |
| 116 | } |
| 117 | |
Tim Northover | ad2b717 | 2016-07-26 20:23:26 +0000 | [diff] [blame] | 118 | bool IRTranslator::translateLoad(const LoadInst &LI) { |
| 119 | assert(LI.isSimple() && "only simple loads are supported at the moment"); |
| 120 | |
| 121 | MachineFunction &MF = MIRBuilder.getMF(); |
| 122 | unsigned Res = getOrCreateVReg(LI); |
| 123 | unsigned Addr = getOrCreateVReg(*LI.getPointerOperand()); |
| 124 | LLT VTy{*LI.getType()}, PTy{*LI.getPointerOperand()->getType()}; |
| 125 | |
| 126 | MIRBuilder.buildLoad( |
| 127 | VTy, PTy, Res, Addr, |
| 128 | *MF.getMachineMemOperand(MachinePointerInfo(LI.getPointerOperand()), |
| 129 | MachineMemOperand::MOLoad, |
| 130 | VTy.getSizeInBits() / 8, getMemOpAlignment(LI))); |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | bool IRTranslator::translateStore(const StoreInst &SI) { |
| 135 | assert(SI.isSimple() && "only simple loads are supported at the moment"); |
| 136 | |
| 137 | MachineFunction &MF = MIRBuilder.getMF(); |
| 138 | unsigned Val = getOrCreateVReg(*SI.getValueOperand()); |
| 139 | unsigned Addr = getOrCreateVReg(*SI.getPointerOperand()); |
| 140 | LLT VTy{*SI.getValueOperand()->getType()}, |
| 141 | PTy{*SI.getPointerOperand()->getType()}; |
| 142 | |
| 143 | MIRBuilder.buildStore( |
| 144 | VTy, PTy, Val, Addr, |
| 145 | *MF.getMachineMemOperand(MachinePointerInfo(SI.getPointerOperand()), |
| 146 | MachineMemOperand::MOStore, |
| 147 | VTy.getSizeInBits() / 8, getMemOpAlignment(SI))); |
| 148 | return true; |
| 149 | } |
| 150 | |
Tim Northover | 7c9eba9 | 2016-07-25 21:01:29 +0000 | [diff] [blame] | 151 | bool IRTranslator::translateBitCast(const CastInst &CI) { |
| 152 | if (LLT{*CI.getDestTy()} == LLT{*CI.getSrcTy()}) { |
Tim Northover | 756eca3 | 2016-07-26 16:45:30 +0000 | [diff] [blame] | 153 | MIRBuilder.buildCopy(getOrCreateVReg(CI), |
| 154 | getOrCreateVReg(*CI.getOperand(0))); |
Tim Northover | 7c9eba9 | 2016-07-25 21:01:29 +0000 | [diff] [blame] | 155 | return true; |
| 156 | } |
| 157 | return translateCast(TargetOpcode::G_BITCAST, CI); |
| 158 | } |
| 159 | |
| 160 | bool IRTranslator::translateCast(unsigned Opcode, const CastInst &CI) { |
| 161 | unsigned Op = getOrCreateVReg(*CI.getOperand(0)); |
| 162 | unsigned Res = getOrCreateVReg(CI); |
| 163 | MIRBuilder.buildInstr(Opcode, {LLT{*CI.getDestTy()}, LLT{*CI.getSrcTy()}}, |
| 164 | Res, Op); |
| 165 | return true; |
| 166 | } |
| 167 | |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 168 | bool IRTranslator::translateStaticAlloca(const AllocaInst &AI) { |
| 169 | assert(AI.isStaticAlloca() && "only handle static allocas now"); |
| 170 | MachineFunction &MF = MIRBuilder.getMF(); |
| 171 | unsigned ElementSize = DL->getTypeStoreSize(AI.getAllocatedType()); |
| 172 | unsigned Size = |
| 173 | ElementSize * cast<ConstantInt>(AI.getArraySize())->getZExtValue(); |
| 174 | |
Tim Northover | 8d2f52e | 2016-07-27 17:47:54 +0000 | [diff] [blame] | 175 | // Always allocate at least one byte. |
| 176 | Size = std::max(Size, 1u); |
| 177 | |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 178 | unsigned Alignment = AI.getAlignment(); |
| 179 | if (!Alignment) |
| 180 | Alignment = DL->getABITypeAlignment(AI.getAllocatedType()); |
| 181 | |
| 182 | unsigned Res = getOrCreateVReg(AI); |
Matthias Braun | 9332039 | 2016-07-28 20:13:42 +0000 | [diff] [blame^] | 183 | int FI = MF.getFrameInfo().CreateStackObject(Size, Alignment, false, &AI); |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 184 | MIRBuilder.buildFrameIndex(LLT::pointer(0), Res, FI); |
| 185 | return true; |
| 186 | } |
| 187 | |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 188 | bool IRTranslator::translate(const Instruction &Inst) { |
Quentin Colombet | a7fae16 | 2016-02-11 17:53:23 +0000 | [diff] [blame] | 189 | MIRBuilder.setDebugLoc(Inst.getDebugLoc()); |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 190 | switch(Inst.getOpcode()) { |
Quentin Colombet | 19df8a1 | 2016-07-21 17:26:41 +0000 | [diff] [blame] | 191 | // Arithmetic operations. |
Quentin Colombet | 74d7d2f | 2016-02-11 18:53:28 +0000 | [diff] [blame] | 192 | case Instruction::Add: |
Quentin Colombet | 13c55e0 | 2016-06-10 20:50:18 +0000 | [diff] [blame] | 193 | return translateBinaryOp(TargetOpcode::G_ADD, Inst); |
Quentin Colombet | 2b59eab | 2016-07-21 17:26:50 +0000 | [diff] [blame] | 194 | case Instruction::Sub: |
| 195 | return translateBinaryOp(TargetOpcode::G_SUB, Inst); |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 196 | |
Quentin Colombet | 19df8a1 | 2016-07-21 17:26:41 +0000 | [diff] [blame] | 197 | // Bitwise operations. |
Quentin Colombet | 7bcc921 | 2016-07-21 15:50:42 +0000 | [diff] [blame] | 198 | case Instruction::And: |
| 199 | return translateBinaryOp(TargetOpcode::G_AND, Inst); |
Quentin Colombet | f2a1909 | 2016-06-10 20:50:35 +0000 | [diff] [blame] | 200 | case Instruction::Or: |
| 201 | return translateBinaryOp(TargetOpcode::G_OR, Inst); |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 202 | |
Quentin Colombet | 19df8a1 | 2016-07-21 17:26:41 +0000 | [diff] [blame] | 203 | // Branch operations. |
Quentin Colombet | dd4b137 | 2016-03-11 17:28:03 +0000 | [diff] [blame] | 204 | case Instruction::Br: |
| 205 | return translateBr(Inst); |
Quentin Colombet | 74d7d2f | 2016-02-11 18:53:28 +0000 | [diff] [blame] | 206 | case Instruction::Ret: |
| 207 | return translateReturn(Inst); |
| 208 | |
Tim Northover | 7c9eba9 | 2016-07-25 21:01:29 +0000 | [diff] [blame] | 209 | // Casts |
| 210 | case Instruction::BitCast: |
| 211 | return translateBitCast(cast<CastInst>(Inst)); |
| 212 | case Instruction::IntToPtr: |
| 213 | return translateCast(TargetOpcode::G_INTTOPTR, cast<CastInst>(Inst)); |
| 214 | case Instruction::PtrToInt: |
| 215 | return translateCast(TargetOpcode::G_PTRTOINT, cast<CastInst>(Inst)); |
| 216 | |
Tim Northover | ad2b717 | 2016-07-26 20:23:26 +0000 | [diff] [blame] | 217 | // Memory ops. |
| 218 | case Instruction::Load: |
| 219 | return translateLoad(cast<LoadInst>(Inst)); |
| 220 | case Instruction::Store: |
| 221 | return translateStore(cast<StoreInst>(Inst)); |
| 222 | |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 223 | case Instruction::Alloca: |
| 224 | return translateStaticAlloca(cast<AllocaInst>(Inst)); |
| 225 | |
Quentin Colombet | 74d7d2f | 2016-02-11 18:53:28 +0000 | [diff] [blame] | 226 | default: |
| 227 | llvm_unreachable("Opcode not supported"); |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 228 | } |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | |
| 232 | void IRTranslator::finalize() { |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 233 | // Release the memory used by the different maps we |
| 234 | // needed during the translation. |
Quentin Colombet | ccd7725 | 2016-02-11 21:48:32 +0000 | [diff] [blame] | 235 | ValToVReg.clear(); |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 236 | Constants.clear(); |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 237 | } |
| 238 | |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 239 | bool IRTranslator::runOnMachineFunction(MachineFunction &MF) { |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 240 | const Function &F = *MF.getFunction(); |
Quentin Colombet | fd9d0a0 | 2016-02-11 19:59:41 +0000 | [diff] [blame] | 241 | if (F.empty()) |
| 242 | return false; |
Quentin Colombet | ba2a016 | 2016-02-16 19:26:02 +0000 | [diff] [blame] | 243 | CLI = MF.getSubtarget().getCallLowering(); |
Quentin Colombet | 000b580 | 2016-03-11 17:27:51 +0000 | [diff] [blame] | 244 | MIRBuilder.setMF(MF); |
Quentin Colombet | 17c494b | 2016-02-11 17:51:31 +0000 | [diff] [blame] | 245 | MRI = &MF.getRegInfo(); |
Tim Northover | bd50546 | 2016-07-22 16:59:52 +0000 | [diff] [blame] | 246 | DL = &F.getParent()->getDataLayout(); |
| 247 | |
Quentin Colombet | fd9d0a0 | 2016-02-11 19:59:41 +0000 | [diff] [blame] | 248 | // Setup the arguments. |
Quentin Colombet | 53237a9 | 2016-03-11 17:27:43 +0000 | [diff] [blame] | 249 | MachineBasicBlock &MBB = getOrCreateBB(F.front()); |
Quentin Colombet | 91ebd71 | 2016-03-11 17:27:47 +0000 | [diff] [blame] | 250 | MIRBuilder.setMBB(MBB); |
Quentin Colombet | fd9d0a0 | 2016-02-11 19:59:41 +0000 | [diff] [blame] | 251 | SmallVector<unsigned, 8> VRegArgs; |
| 252 | for (const Argument &Arg: F.args()) |
Quentin Colombet | e225e25 | 2016-03-11 17:27:54 +0000 | [diff] [blame] | 253 | VRegArgs.push_back(getOrCreateVReg(Arg)); |
Quentin Colombet | ba2a016 | 2016-02-16 19:26:02 +0000 | [diff] [blame] | 254 | bool Succeeded = |
Tom Stellard | b72a65f | 2016-04-14 17:23:33 +0000 | [diff] [blame] | 255 | CLI->lowerFormalArguments(MIRBuilder, F.getArgumentList(), VRegArgs); |
Quentin Colombet | fd9d0a0 | 2016-02-11 19:59:41 +0000 | [diff] [blame] | 256 | if (!Succeeded) |
| 257 | report_fatal_error("Unable to lower arguments"); |
| 258 | |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 259 | for (const BasicBlock &BB: F) { |
Quentin Colombet | 53237a9 | 2016-03-11 17:27:43 +0000 | [diff] [blame] | 260 | MachineBasicBlock &MBB = getOrCreateBB(BB); |
Quentin Colombet | 91ebd71 | 2016-03-11 17:27:47 +0000 | [diff] [blame] | 261 | // Set the insertion point of all the following translations to |
| 262 | // the end of this basic block. |
| 263 | MIRBuilder.setMBB(MBB); |
Quentin Colombet | 2ecff3b | 2016-02-10 22:59:27 +0000 | [diff] [blame] | 264 | for (const Instruction &Inst: BB) { |
| 265 | bool Succeeded = translate(Inst); |
| 266 | if (!Succeeded) { |
| 267 | DEBUG(dbgs() << "Cannot translate: " << Inst << '\n'); |
| 268 | report_fatal_error("Unable to translate instruction"); |
| 269 | } |
| 270 | } |
| 271 | } |
Tim Northover | 72eebfa | 2016-07-12 22:23:42 +0000 | [diff] [blame] | 272 | |
| 273 | // Now that the MachineFrameInfo has been configured, no further changes to |
| 274 | // the reserved registers are possible. |
| 275 | MRI->freezeReservedRegs(MF); |
| 276 | |
Quentin Colombet | 105cf2b | 2016-01-20 20:58:56 +0000 | [diff] [blame] | 277 | return false; |
| 278 | } |