| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 1 | //===-- RISCVMCCodeEmitter.cpp - Convert RISCV code to machine code -------===// |
| 2 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file implements the RISCVMCCodeEmitter class. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 13 | #include "MCTargetDesc/RISCVFixupKinds.h" |
| 14 | #include "MCTargetDesc/RISCVMCExpr.h" |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 15 | #include "MCTargetDesc/RISCVMCTargetDesc.h" |
| Ana Pazos | 9d6c553 | 2018-10-04 21:50:54 +0000 | [diff] [blame] | 16 | #include "Utils/RISCVBaseInfo.h" |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/Statistic.h" |
| Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCAsmInfo.h" |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 19 | #include "llvm/MC/MCCodeEmitter.h" |
| 20 | #include "llvm/MC/MCContext.h" |
| 21 | #include "llvm/MC/MCExpr.h" |
| 22 | #include "llvm/MC/MCInst.h" |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 23 | #include "llvm/MC/MCInstBuilder.h" |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 24 | #include "llvm/MC/MCInstrInfo.h" |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 25 | #include "llvm/MC/MCRegisterInfo.h" |
| 26 | #include "llvm/MC/MCSymbol.h" |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 27 | #include "llvm/Support/Casting.h" |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 28 | #include "llvm/Support/EndianStream.h" |
| 29 | #include "llvm/Support/raw_ostream.h" |
| 30 | |
| 31 | using namespace llvm; |
| 32 | |
| 33 | #define DEBUG_TYPE "mccodeemitter" |
| 34 | |
| 35 | STATISTIC(MCNumEmitted, "Number of MC instructions emitted"); |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 36 | STATISTIC(MCNumFixups, "Number of MC fixups created"); |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 37 | |
| 38 | namespace { |
| 39 | class RISCVMCCodeEmitter : public MCCodeEmitter { |
| 40 | RISCVMCCodeEmitter(const RISCVMCCodeEmitter &) = delete; |
| 41 | void operator=(const RISCVMCCodeEmitter &) = delete; |
| 42 | MCContext &Ctx; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 43 | MCInstrInfo const &MCII; |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 44 | |
| 45 | public: |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 46 | RISCVMCCodeEmitter(MCContext &ctx, MCInstrInfo const &MCII) |
| 47 | : Ctx(ctx), MCII(MCII) {} |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 48 | |
| 49 | ~RISCVMCCodeEmitter() override {} |
| 50 | |
| 51 | void encodeInstruction(const MCInst &MI, raw_ostream &OS, |
| 52 | SmallVectorImpl<MCFixup> &Fixups, |
| 53 | const MCSubtargetInfo &STI) const override; |
| 54 | |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 55 | void expandFunctionCall(const MCInst &MI, raw_ostream &OS, |
| 56 | SmallVectorImpl<MCFixup> &Fixups, |
| 57 | const MCSubtargetInfo &STI) const; |
| 58 | |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 59 | /// TableGen'erated function for getting the binary encoding for an |
| 60 | /// instruction. |
| 61 | uint64_t getBinaryCodeForInstr(const MCInst &MI, |
| 62 | SmallVectorImpl<MCFixup> &Fixups, |
| 63 | const MCSubtargetInfo &STI) const; |
| 64 | |
| 65 | /// Return binary encoding of operand. If the machine operand requires |
| 66 | /// relocation, record the relocation and return zero. |
| 67 | unsigned getMachineOpValue(const MCInst &MI, const MCOperand &MO, |
| 68 | SmallVectorImpl<MCFixup> &Fixups, |
| 69 | const MCSubtargetInfo &STI) const; |
| Alex Bradbury | 6758ecb | 2017-09-17 14:27:35 +0000 | [diff] [blame] | 70 | |
| 71 | unsigned getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, |
| 72 | SmallVectorImpl<MCFixup> &Fixups, |
| 73 | const MCSubtargetInfo &STI) const; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 74 | |
| Alex Bradbury | 8ab4a96 | 2017-09-17 14:36:28 +0000 | [diff] [blame] | 75 | unsigned getImmOpValue(const MCInst &MI, unsigned OpNo, |
| 76 | SmallVectorImpl<MCFixup> &Fixups, |
| 77 | const MCSubtargetInfo &STI) const; |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 78 | }; |
| 79 | } // end anonymous namespace |
| 80 | |
| 81 | MCCodeEmitter *llvm::createRISCVMCCodeEmitter(const MCInstrInfo &MCII, |
| 82 | const MCRegisterInfo &MRI, |
| 83 | MCContext &Ctx) { |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 84 | return new RISCVMCCodeEmitter(Ctx, MCII); |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| Mandeep Singh Grang | ddcb956 | 2018-05-23 22:44:08 +0000 | [diff] [blame] | 87 | // Expand PseudoCALL and PseudoTAIL to AUIPC and JALR with relocation types. |
| 88 | // We expand PseudoCALL and PseudoTAIL while encoding, meaning AUIPC and JALR |
| 89 | // won't go through RISCV MC to MC compressed instruction transformation. This |
| 90 | // is acceptable because AUIPC has no 16-bit form and C_JALR have no immediate |
| 91 | // operand field. We let linker relaxation deal with it. When linker |
| 92 | // relaxation enabled, AUIPC and JALR have chance relax to JAL. If C extension |
| 93 | // is enabled, JAL has chance relax to C_JAL. |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 94 | void RISCVMCCodeEmitter::expandFunctionCall(const MCInst &MI, raw_ostream &OS, |
| 95 | SmallVectorImpl<MCFixup> &Fixups, |
| 96 | const MCSubtargetInfo &STI) const { |
| 97 | MCInst TmpInst; |
| 98 | MCOperand Func = MI.getOperand(0); |
| Mandeep Singh Grang | ef0ebf2 | 2018-05-17 17:31:27 +0000 | [diff] [blame] | 99 | unsigned Ra = (MI.getOpcode() == RISCV::PseudoTAIL) ? RISCV::X6 : RISCV::X1; |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 100 | uint32_t Binary; |
| 101 | |
| 102 | assert(Func.isExpr() && "Expected expression"); |
| 103 | |
| Alex Bradbury | 44668ae | 2019-04-01 14:53:17 +0000 | [diff] [blame] | 104 | const MCExpr *CallExpr = Func.getExpr(); |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 105 | |
| 106 | // Emit AUIPC Ra, Func with R_RISCV_CALL relocation type. |
| 107 | TmpInst = MCInstBuilder(RISCV::AUIPC) |
| 108 | .addReg(Ra) |
| 109 | .addOperand(MCOperand::createExpr(CallExpr)); |
| 110 | Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI); |
| Peter Collingbourne | e3f6529 | 2018-05-18 19:46:24 +0000 | [diff] [blame] | 111 | support::endian::write(OS, Binary, support::little); |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 112 | |
| Sameer AbuAsal | e01e711 | 2018-06-21 14:37:09 +0000 | [diff] [blame] | 113 | if (MI.getOpcode() == RISCV::PseudoTAIL) |
| 114 | // Emit JALR X0, X6, 0 |
| 115 | TmpInst = MCInstBuilder(RISCV::JALR).addReg(RISCV::X0).addReg(Ra).addImm(0); |
| 116 | else |
| 117 | // Emit JALR X1, X1, 0 |
| 118 | TmpInst = MCInstBuilder(RISCV::JALR).addReg(Ra).addReg(Ra).addImm(0); |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 119 | Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI); |
| Peter Collingbourne | e3f6529 | 2018-05-18 19:46:24 +0000 | [diff] [blame] | 120 | support::endian::write(OS, Binary, support::little); |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 123 | void RISCVMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS, |
| 124 | SmallVectorImpl<MCFixup> &Fixups, |
| 125 | const MCSubtargetInfo &STI) const { |
| Alex Bradbury | 9f6aec4 | 2017-12-07 12:50:32 +0000 | [diff] [blame] | 126 | const MCInstrDesc &Desc = MCII.get(MI.getOpcode()); |
| 127 | // Get byte count of instruction. |
| 128 | unsigned Size = Desc.getSize(); |
| 129 | |
| Mandeep Singh Grang | ef0ebf2 | 2018-05-17 17:31:27 +0000 | [diff] [blame] | 130 | if (MI.getOpcode() == RISCV::PseudoCALL || |
| 131 | MI.getOpcode() == RISCV::PseudoTAIL) { |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 132 | expandFunctionCall(MI, OS, Fixups, STI); |
| 133 | MCNumEmitted += 2; |
| 134 | return; |
| 135 | } |
| 136 | |
| Alex Bradbury | 9f6aec4 | 2017-12-07 12:50:32 +0000 | [diff] [blame] | 137 | switch (Size) { |
| 138 | default: |
| 139 | llvm_unreachable("Unhandled encodeInstruction length!"); |
| 140 | case 2: { |
| 141 | uint16_t Bits = getBinaryCodeForInstr(MI, Fixups, STI); |
| Peter Collingbourne | e3f6529 | 2018-05-18 19:46:24 +0000 | [diff] [blame] | 142 | support::endian::write<uint16_t>(OS, Bits, support::little); |
| Alex Bradbury | 9f6aec4 | 2017-12-07 12:50:32 +0000 | [diff] [blame] | 143 | break; |
| 144 | } |
| 145 | case 4: { |
| 146 | uint32_t Bits = getBinaryCodeForInstr(MI, Fixups, STI); |
| Peter Collingbourne | e3f6529 | 2018-05-18 19:46:24 +0000 | [diff] [blame] | 147 | support::endian::write(OS, Bits, support::little); |
| Alex Bradbury | 9f6aec4 | 2017-12-07 12:50:32 +0000 | [diff] [blame] | 148 | break; |
| 149 | } |
| 150 | } |
| 151 | |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 152 | ++MCNumEmitted; // Keep track of the # of mi's emitted. |
| 153 | } |
| 154 | |
| 155 | unsigned |
| 156 | RISCVMCCodeEmitter::getMachineOpValue(const MCInst &MI, const MCOperand &MO, |
| 157 | SmallVectorImpl<MCFixup> &Fixups, |
| 158 | const MCSubtargetInfo &STI) const { |
| 159 | |
| 160 | if (MO.isReg()) |
| 161 | return Ctx.getRegisterInfo()->getEncodingValue(MO.getReg()); |
| 162 | |
| 163 | if (MO.isImm()) |
| 164 | return static_cast<unsigned>(MO.getImm()); |
| 165 | |
| 166 | llvm_unreachable("Unhandled expression!"); |
| 167 | return 0; |
| 168 | } |
| 169 | |
| Alex Bradbury | 6758ecb | 2017-09-17 14:27:35 +0000 | [diff] [blame] | 170 | unsigned |
| 171 | RISCVMCCodeEmitter::getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, |
| 172 | SmallVectorImpl<MCFixup> &Fixups, |
| 173 | const MCSubtargetInfo &STI) const { |
| 174 | const MCOperand &MO = MI.getOperand(OpNo); |
| 175 | |
| 176 | if (MO.isImm()) { |
| 177 | unsigned Res = MO.getImm(); |
| 178 | assert((Res & 1) == 0 && "LSB is non-zero"); |
| 179 | return Res >> 1; |
| 180 | } |
| 181 | |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 182 | return getImmOpValue(MI, OpNo, Fixups, STI); |
| Alex Bradbury | 8ab4a96 | 2017-09-17 14:36:28 +0000 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | unsigned RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo, |
| 186 | SmallVectorImpl<MCFixup> &Fixups, |
| 187 | const MCSubtargetInfo &STI) const { |
| Shiva Chen | 43bfe84 | 2018-05-24 06:21:23 +0000 | [diff] [blame] | 188 | bool EnableRelax = STI.getFeatureBits()[RISCV::FeatureRelax]; |
| Alex Bradbury | 8ab4a96 | 2017-09-17 14:36:28 +0000 | [diff] [blame] | 189 | const MCOperand &MO = MI.getOperand(OpNo); |
| 190 | |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 191 | MCInstrDesc const &Desc = MCII.get(MI.getOpcode()); |
| 192 | unsigned MIFrm = Desc.TSFlags & RISCVII::InstFormatMask; |
| 193 | |
| Chih-Mao Chen | 5d94b25 | 2018-08-14 08:08:39 +0000 | [diff] [blame] | 194 | // If the destination is an immediate, there is nothing to do. |
| Alex Bradbury | 8ab4a96 | 2017-09-17 14:36:28 +0000 | [diff] [blame] | 195 | if (MO.isImm()) |
| 196 | return MO.getImm(); |
| 197 | |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 198 | assert(MO.isExpr() && |
| 199 | "getImmOpValue expects only expressions or immediates"); |
| 200 | const MCExpr *Expr = MO.getExpr(); |
| 201 | MCExpr::ExprKind Kind = Expr->getKind(); |
| 202 | RISCV::Fixups FixupKind = RISCV::fixup_riscv_invalid; |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 203 | bool RelaxCandidate = false; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 204 | if (Kind == MCExpr::Target) { |
| 205 | const RISCVMCExpr *RVExpr = cast<RISCVMCExpr>(Expr); |
| 206 | |
| 207 | switch (RVExpr->getKind()) { |
| 208 | case RISCVMCExpr::VK_RISCV_None: |
| 209 | case RISCVMCExpr::VK_RISCV_Invalid: |
| 210 | llvm_unreachable("Unhandled fixup kind!"); |
| 211 | case RISCVMCExpr::VK_RISCV_LO: |
| Alex Bradbury | 8d8d0a7 | 2018-02-22 13:24:25 +0000 | [diff] [blame] | 212 | if (MIFrm == RISCVII::InstFormatI) |
| 213 | FixupKind = RISCV::fixup_riscv_lo12_i; |
| 214 | else if (MIFrm == RISCVII::InstFormatS) |
| 215 | FixupKind = RISCV::fixup_riscv_lo12_s; |
| 216 | else |
| 217 | llvm_unreachable("VK_RISCV_LO used with unexpected instruction format"); |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 218 | RelaxCandidate = true; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 219 | break; |
| 220 | case RISCVMCExpr::VK_RISCV_HI: |
| 221 | FixupKind = RISCV::fixup_riscv_hi20; |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 222 | RelaxCandidate = true; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 223 | break; |
| Ahmed Charles | 646ab87 | 2018-02-06 00:55:23 +0000 | [diff] [blame] | 224 | case RISCVMCExpr::VK_RISCV_PCREL_LO: |
| Alex Bradbury | 8d8d0a7 | 2018-02-22 13:24:25 +0000 | [diff] [blame] | 225 | if (MIFrm == RISCVII::InstFormatI) |
| 226 | FixupKind = RISCV::fixup_riscv_pcrel_lo12_i; |
| 227 | else if (MIFrm == RISCVII::InstFormatS) |
| 228 | FixupKind = RISCV::fixup_riscv_pcrel_lo12_s; |
| 229 | else |
| 230 | llvm_unreachable( |
| 231 | "VK_RISCV_PCREL_LO used with unexpected instruction format"); |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 232 | RelaxCandidate = true; |
| Ahmed Charles | 646ab87 | 2018-02-06 00:55:23 +0000 | [diff] [blame] | 233 | break; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 234 | case RISCVMCExpr::VK_RISCV_PCREL_HI: |
| 235 | FixupKind = RISCV::fixup_riscv_pcrel_hi20; |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 236 | RelaxCandidate = true; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 237 | break; |
| Alex Bradbury | 8eb87e5 | 2019-02-15 09:43:46 +0000 | [diff] [blame] | 238 | case RISCVMCExpr::VK_RISCV_GOT_HI: |
| 239 | FixupKind = RISCV::fixup_riscv_got_hi20; |
| 240 | break; |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 241 | case RISCVMCExpr::VK_RISCV_CALL: |
| 242 | FixupKind = RISCV::fixup_riscv_call; |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 243 | RelaxCandidate = true; |
| Shiva Chen | 98f9389 | 2018-04-25 14:18:55 +0000 | [diff] [blame] | 244 | break; |
| Alex Bradbury | f8078f6 | 2019-04-02 12:47:20 +0000 | [diff] [blame^] | 245 | case RISCVMCExpr::VK_RISCV_CALL_PLT: |
| 246 | FixupKind = RISCV::fixup_riscv_call_plt; |
| 247 | RelaxCandidate = true; |
| 248 | break; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 249 | } |
| 250 | } else if (Kind == MCExpr::SymbolRef && |
| 251 | cast<MCSymbolRefExpr>(Expr)->getKind() == MCSymbolRefExpr::VK_None) { |
| 252 | if (Desc.getOpcode() == RISCV::JAL) { |
| 253 | FixupKind = RISCV::fixup_riscv_jal; |
| Alex Bradbury | ee7c7ec | 2017-10-19 14:29:03 +0000 | [diff] [blame] | 254 | } else if (MIFrm == RISCVII::InstFormatB) { |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 255 | FixupKind = RISCV::fixup_riscv_branch; |
| Alex Bradbury | f8f4b90 | 2017-12-07 13:19:57 +0000 | [diff] [blame] | 256 | } else if (MIFrm == RISCVII::InstFormatCJ) { |
| 257 | FixupKind = RISCV::fixup_riscv_rvc_jump; |
| 258 | } else if (MIFrm == RISCVII::InstFormatCB) { |
| 259 | FixupKind = RISCV::fixup_riscv_rvc_branch; |
| Alex Bradbury | 9d3f125 | 2017-09-28 08:26:24 +0000 | [diff] [blame] | 260 | } |
| 261 | } |
| 262 | |
| 263 | assert(FixupKind != RISCV::fixup_riscv_invalid && "Unhandled expression!"); |
| 264 | |
| 265 | Fixups.push_back( |
| 266 | MCFixup::create(0, Expr, MCFixupKind(FixupKind), MI.getLoc())); |
| 267 | ++MCNumFixups; |
| Alex Bradbury | 8ab4a96 | 2017-09-17 14:36:28 +0000 | [diff] [blame] | 268 | |
| Kito Cheng | 5e8798f | 2019-01-21 05:27:09 +0000 | [diff] [blame] | 269 | // Ensure an R_RISCV_RELAX relocation will be emitted if linker relaxation is |
| 270 | // enabled and the current fixup will result in a relocation that may be |
| 271 | // relaxed. |
| 272 | if (EnableRelax && RelaxCandidate) { |
| 273 | const MCConstantExpr *Dummy = MCConstantExpr::create(0, Ctx); |
| 274 | Fixups.push_back( |
| 275 | MCFixup::create(0, Dummy, MCFixupKind(RISCV::fixup_riscv_relax), |
| 276 | MI.getLoc())); |
| 277 | ++MCNumFixups; |
| Shiva Chen | 43bfe84 | 2018-05-24 06:21:23 +0000 | [diff] [blame] | 278 | } |
| 279 | |
| Alex Bradbury | 8ab4a96 | 2017-09-17 14:36:28 +0000 | [diff] [blame] | 280 | return 0; |
| Alex Bradbury | 6758ecb | 2017-09-17 14:27:35 +0000 | [diff] [blame] | 281 | } |
| 282 | |
| Alex Bradbury | 6b2cca7 | 2016-11-01 23:47:30 +0000 | [diff] [blame] | 283 | #include "RISCVGenMCCodeEmitter.inc" |