LLVM  15.0.0git
RISCVMCCodeEmitter.cpp
Go to the documentation of this file.
1 //===-- RISCVMCCodeEmitter.cpp - Convert RISCV code to machine code -------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the RISCVMCCodeEmitter class.
10 //
11 //===----------------------------------------------------------------------===//
12 
17 #include "llvm/ADT/Statistic.h"
18 #include "llvm/MC/MCAsmInfo.h"
19 #include "llvm/MC/MCCodeEmitter.h"
20 #include "llvm/MC/MCContext.h"
21 #include "llvm/MC/MCExpr.h"
22 #include "llvm/MC/MCInst.h"
23 #include "llvm/MC/MCInstBuilder.h"
24 #include "llvm/MC/MCInstrInfo.h"
25 #include "llvm/MC/MCRegisterInfo.h"
27 #include "llvm/MC/MCSymbol.h"
28 #include "llvm/Support/Casting.h"
31 
32 using namespace llvm;
33 
34 #define DEBUG_TYPE "mccodeemitter"
35 
36 STATISTIC(MCNumEmitted, "Number of MC instructions emitted");
37 STATISTIC(MCNumFixups, "Number of MC fixups created");
38 
39 namespace {
40 class RISCVMCCodeEmitter : public MCCodeEmitter {
41  RISCVMCCodeEmitter(const RISCVMCCodeEmitter &) = delete;
42  void operator=(const RISCVMCCodeEmitter &) = delete;
43  MCContext &Ctx;
44  MCInstrInfo const &MCII;
45 
46 public:
47  RISCVMCCodeEmitter(MCContext &ctx, MCInstrInfo const &MCII)
48  : Ctx(ctx), MCII(MCII) {}
49 
50  ~RISCVMCCodeEmitter() override = default;
51 
52  void encodeInstruction(const MCInst &MI, raw_ostream &OS,
54  const MCSubtargetInfo &STI) const override;
55 
56  void expandFunctionCall(const MCInst &MI, raw_ostream &OS,
58  const MCSubtargetInfo &STI) const;
59 
60  void expandAddTPRel(const MCInst &MI, raw_ostream &OS,
62  const MCSubtargetInfo &STI) const;
63 
64  /// TableGen'erated function for getting the binary encoding for an
65  /// instruction.
66  uint64_t getBinaryCodeForInstr(const MCInst &MI,
68  const MCSubtargetInfo &STI) const;
69 
70  /// Return binary encoding of operand. If the machine operand requires
71  /// relocation, record the relocation and return zero.
72  unsigned getMachineOpValue(const MCInst &MI, const MCOperand &MO,
74  const MCSubtargetInfo &STI) const;
75 
76  unsigned getImmOpValueAsr1(const MCInst &MI, unsigned OpNo,
78  const MCSubtargetInfo &STI) const;
79 
80  unsigned getImmOpValue(const MCInst &MI, unsigned OpNo,
82  const MCSubtargetInfo &STI) const;
83 
84  unsigned getVMaskReg(const MCInst &MI, unsigned OpNo,
86  const MCSubtargetInfo &STI) const;
87 };
88 } // end anonymous namespace
89 
91  MCContext &Ctx) {
92  return new RISCVMCCodeEmitter(Ctx, MCII);
93 }
94 
95 // Expand PseudoCALL(Reg), PseudoTAIL and PseudoJump to AUIPC and JALR with
96 // relocation types. We expand those pseudo-instructions while encoding them,
97 // meaning AUIPC and JALR won't go through RISCV MC to MC compressed
98 // instruction transformation. This is acceptable because AUIPC has no 16-bit
99 // form and C_JALR has no immediate operand field. We let linker relaxation
100 // deal with it. When linker relaxation is enabled, AUIPC and JALR have a
101 // chance to relax to JAL.
102 // If the C extension is enabled, JAL has a chance relax to C_JAL.
103 void RISCVMCCodeEmitter::expandFunctionCall(const MCInst &MI, raw_ostream &OS,
105  const MCSubtargetInfo &STI) const {
106  MCInst TmpInst;
107  MCOperand Func;
108  MCRegister Ra;
109  if (MI.getOpcode() == RISCV::PseudoTAIL) {
110  Func = MI.getOperand(0);
111  Ra = RISCV::X6;
112  } else if (MI.getOpcode() == RISCV::PseudoCALLReg) {
113  Func = MI.getOperand(1);
114  Ra = MI.getOperand(0).getReg();
115  } else if (MI.getOpcode() == RISCV::PseudoCALL) {
116  Func = MI.getOperand(0);
117  Ra = RISCV::X1;
118  } else if (MI.getOpcode() == RISCV::PseudoJump) {
119  Func = MI.getOperand(1);
120  Ra = MI.getOperand(0).getReg();
121  }
123 
124  assert(Func.isExpr() && "Expected expression");
125 
126  const MCExpr *CallExpr = Func.getExpr();
127 
128  // Emit AUIPC Ra, Func with R_RISCV_CALL relocation type.
129  TmpInst = MCInstBuilder(RISCV::AUIPC).addReg(Ra).addExpr(CallExpr);
130  Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);
132 
133  if (MI.getOpcode() == RISCV::PseudoTAIL ||
134  MI.getOpcode() == RISCV::PseudoJump)
135  // Emit JALR X0, Ra, 0
136  TmpInst = MCInstBuilder(RISCV::JALR).addReg(RISCV::X0).addReg(Ra).addImm(0);
137  else
138  // Emit JALR Ra, Ra, 0
139  TmpInst = MCInstBuilder(RISCV::JALR).addReg(Ra).addReg(Ra).addImm(0);
140  Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);
142 }
143 
144 // Expand PseudoAddTPRel to a simple ADD with the correct relocation.
145 void RISCVMCCodeEmitter::expandAddTPRel(const MCInst &MI, raw_ostream &OS,
147  const MCSubtargetInfo &STI) const {
148  MCOperand DestReg = MI.getOperand(0);
149  MCOperand SrcReg = MI.getOperand(1);
150  MCOperand TPReg = MI.getOperand(2);
151  assert(TPReg.isReg() && TPReg.getReg() == RISCV::X4 &&
152  "Expected thread pointer as second input to TP-relative add");
153 
154  MCOperand SrcSymbol = MI.getOperand(3);
155  assert(SrcSymbol.isExpr() &&
156  "Expected expression as third input to TP-relative add");
157 
158  const RISCVMCExpr *Expr = dyn_cast<RISCVMCExpr>(SrcSymbol.getExpr());
159  assert(Expr && Expr->getKind() == RISCVMCExpr::VK_RISCV_TPREL_ADD &&
160  "Expected tprel_add relocation on TP-relative symbol");
161 
162  // Emit the correct tprel_add relocation for the symbol.
163  Fixups.push_back(MCFixup::create(
164  0, Expr, MCFixupKind(RISCV::fixup_riscv_tprel_add), MI.getLoc()));
165 
166  // Emit fixup_riscv_relax for tprel_add where the relax feature is enabled.
167  if (STI.getFeatureBits()[RISCV::FeatureRelax]) {
169  Fixups.push_back(MCFixup::create(
170  0, Dummy, MCFixupKind(RISCV::fixup_riscv_relax), MI.getLoc()));
171  }
172 
173  // Emit a normal ADD instruction with the given operands.
174  MCInst TmpInst = MCInstBuilder(RISCV::ADD)
175  .addOperand(DestReg)
176  .addOperand(SrcReg)
177  .addOperand(TPReg);
178  uint32_t Binary = getBinaryCodeForInstr(TmpInst, Fixups, STI);
180 }
181 
182 void RISCVMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
184  const MCSubtargetInfo &STI) const {
185  const MCInstrDesc &Desc = MCII.get(MI.getOpcode());
186  // Get byte count of instruction.
187  unsigned Size = Desc.getSize();
188 
189  // RISCVInstrInfo::getInstSizeInBytes expects that the total size of the
190  // expanded instructions for each pseudo is correct in the Size field of the
191  // tablegen definition for the pseudo.
192  if (MI.getOpcode() == RISCV::PseudoCALLReg ||
193  MI.getOpcode() == RISCV::PseudoCALL ||
194  MI.getOpcode() == RISCV::PseudoTAIL ||
195  MI.getOpcode() == RISCV::PseudoJump) {
196  expandFunctionCall(MI, OS, Fixups, STI);
197  MCNumEmitted += 2;
198  return;
199  }
200 
201  if (MI.getOpcode() == RISCV::PseudoAddTPRel) {
202  expandAddTPRel(MI, OS, Fixups, STI);
203  MCNumEmitted += 1;
204  return;
205  }
206 
207  switch (Size) {
208  default:
209  llvm_unreachable("Unhandled encodeInstruction length!");
210  case 2: {
211  uint16_t Bits = getBinaryCodeForInstr(MI, Fixups, STI);
212  support::endian::write<uint16_t>(OS, Bits, support::little);
213  break;
214  }
215  case 4: {
216  uint32_t Bits = getBinaryCodeForInstr(MI, Fixups, STI);
218  break;
219  }
220  }
221 
222  ++MCNumEmitted; // Keep track of the # of mi's emitted.
223 }
224 
225 unsigned
226 RISCVMCCodeEmitter::getMachineOpValue(const MCInst &MI, const MCOperand &MO,
228  const MCSubtargetInfo &STI) const {
229 
230  if (MO.isReg())
231  return Ctx.getRegisterInfo()->getEncodingValue(MO.getReg());
232 
233  if (MO.isImm())
234  return static_cast<unsigned>(MO.getImm());
235 
236  llvm_unreachable("Unhandled expression!");
237  return 0;
238 }
239 
240 unsigned
241 RISCVMCCodeEmitter::getImmOpValueAsr1(const MCInst &MI, unsigned OpNo,
243  const MCSubtargetInfo &STI) const {
244  const MCOperand &MO = MI.getOperand(OpNo);
245 
246  if (MO.isImm()) {
247  unsigned Res = MO.getImm();
248  assert((Res & 1) == 0 && "LSB is non-zero");
249  return Res >> 1;
250  }
251 
252  return getImmOpValue(MI, OpNo, Fixups, STI);
253 }
254 
255 unsigned RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo,
257  const MCSubtargetInfo &STI) const {
258  bool EnableRelax = STI.getFeatureBits()[RISCV::FeatureRelax];
259  const MCOperand &MO = MI.getOperand(OpNo);
260 
261  MCInstrDesc const &Desc = MCII.get(MI.getOpcode());
262  unsigned MIFrm = RISCVII::getFormat(Desc.TSFlags);
263 
264  // If the destination is an immediate, there is nothing to do.
265  if (MO.isImm())
266  return MO.getImm();
267 
268  assert(MO.isExpr() &&
269  "getImmOpValue expects only expressions or immediates");
270  const MCExpr *Expr = MO.getExpr();
271  MCExpr::ExprKind Kind = Expr->getKind();
273  bool RelaxCandidate = false;
274  if (Kind == MCExpr::Target) {
275  const RISCVMCExpr *RVExpr = cast<RISCVMCExpr>(Expr);
276 
277  switch (RVExpr->getKind()) {
281  llvm_unreachable("Unhandled fixup kind!");
283  // tprel_add is only used to indicate that a relocation should be emitted
284  // for an add instruction used in TP-relative addressing. It should not be
285  // expanded as if representing an actual instruction operand and so to
286  // encounter it here is an error.
288  "VK_RISCV_TPREL_ADD should not represent an instruction operand");
290  if (MIFrm == RISCVII::InstFormatI)
292  else if (MIFrm == RISCVII::InstFormatS)
294  else
295  llvm_unreachable("VK_RISCV_LO used with unexpected instruction format");
296  RelaxCandidate = true;
297  break;
300  RelaxCandidate = true;
301  break;
303  if (MIFrm == RISCVII::InstFormatI)
305  else if (MIFrm == RISCVII::InstFormatS)
307  else
309  "VK_RISCV_PCREL_LO used with unexpected instruction format");
310  RelaxCandidate = true;
311  break;
314  RelaxCandidate = true;
315  break;
318  break;
320  if (MIFrm == RISCVII::InstFormatI)
322  else if (MIFrm == RISCVII::InstFormatS)
324  else
326  "VK_RISCV_TPREL_LO used with unexpected instruction format");
327  RelaxCandidate = true;
328  break;
331  RelaxCandidate = true;
332  break;
335  break;
338  break;
341  RelaxCandidate = true;
342  break;
345  RelaxCandidate = true;
346  break;
347  }
348  } else if (Kind == MCExpr::SymbolRef &&
349  cast<MCSymbolRefExpr>(Expr)->getKind() == MCSymbolRefExpr::VK_None) {
350  if (MIFrm == RISCVII::InstFormatJ) {
352  } else if (MIFrm == RISCVII::InstFormatB) {
354  } else if (MIFrm == RISCVII::InstFormatCJ) {
356  } else if (MIFrm == RISCVII::InstFormatCB) {
358  }
359  }
360 
361  assert(FixupKind != RISCV::fixup_riscv_invalid && "Unhandled expression!");
362 
363  Fixups.push_back(
364  MCFixup::create(0, Expr, MCFixupKind(FixupKind), MI.getLoc()));
365  ++MCNumFixups;
366 
367  // Ensure an R_RISCV_RELAX relocation will be emitted if linker relaxation is
368  // enabled and the current fixup will result in a relocation that may be
369  // relaxed.
370  if (EnableRelax && RelaxCandidate) {
372  Fixups.push_back(
374  MI.getLoc()));
375  ++MCNumFixups;
376  }
377 
378  return 0;
379 }
380 
381 unsigned RISCVMCCodeEmitter::getVMaskReg(const MCInst &MI, unsigned OpNo,
383  const MCSubtargetInfo &STI) const {
384  MCOperand MO = MI.getOperand(OpNo);
385  assert(MO.isReg() && "Expected a register.");
386 
387  switch (MO.getReg()) {
388  default:
389  llvm_unreachable("Invalid mask register.");
390  case RISCV::V0:
391  return 0;
392  case RISCV::NoRegister:
393  return 1;
394  }
395 }
396 
397 #include "RISCVGenMCCodeEmitter.inc"
llvm::Check::Size
@ Size
Definition: FileCheck.h:77
llvm::RISCV::fixup_riscv_pcrel_lo12_i
@ fixup_riscv_pcrel_lo12_i
Definition: RISCVFixupKinds.h:28
llvm::RISCVMCExpr::VK_RISCV_Invalid
@ VK_RISCV_Invalid
Definition: RISCVMCExpr.h:40
llvm::RISCV::fixup_riscv_call_plt
@ fixup_riscv_call_plt
Definition: RISCVFixupKinds.h:64
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::FixupKind
static Lanai::Fixups FixupKind(const MCExpr *Expr)
Definition: LanaiMCCodeEmitter.cpp:90
llvm::MCOperand::isReg
bool isReg() const
Definition: MCInst.h:61
llvm::RISCVMCExpr::VK_RISCV_TLS_GD_HI
@ VK_RISCV_TLS_GD_HI
Definition: RISCVMCExpr.h:36
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:76
MCCodeEmitter.h
llvm::RISCVMCExpr::VK_RISCV_TPREL_ADD
@ VK_RISCV_TPREL_ADD
Definition: RISCVMCExpr.h:34
llvm::MCConstantExpr::create
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition: MCExpr.cpp:194
Statistic.h
llvm::RISCV::fixup_riscv_tls_gd_hi20
@ fixup_riscv_tls_gd_hi20
Definition: RISCVFixupKinds.h:50
llvm::MCFixup::create
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Definition: MCFixup.h:87
llvm::RISCV::fixup_riscv_lo12_s
@ fixup_riscv_lo12_s
Definition: RISCVFixupKinds.h:24
llvm::RISCV::fixup_riscv_call
@ fixup_riscv_call
Definition: RISCVFixupKinds.h:61
MCInstBuilder.h
llvm::tgtok::Bits
@ Bits
Definition: TGLexer.h:50
CallExpr
Definition: ItaniumDemangle.h:1902
RISCVMCExpr.h
llvm::RISCVMCExpr::VK_RISCV_TPREL_LO
@ VK_RISCV_TPREL_LO
Definition: RISCVMCExpr.h:32
llvm::RISCVMCExpr::VK_RISCV_HI
@ VK_RISCV_HI
Definition: RISCVMCExpr.h:28
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::createRISCVMCCodeEmitter
MCCodeEmitter * createRISCVMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Definition: RISCVMCCodeEmitter.cpp:90
llvm::RISCVMCExpr::VK_RISCV_TPREL_HI
@ VK_RISCV_TPREL_HI
Definition: RISCVMCExpr.h:33
llvm::RISCVII::InstFormatCJ
@ InstFormatCJ
Definition: RISCVBaseInfo.h:45
llvm::msgpack::Type::Binary
@ Binary
llvm::RISCV::fixup_riscv_pcrel_lo12_s
@ fixup_riscv_pcrel_lo12_s
Definition: RISCVFixupKinds.h:31
llvm::RISCVMCExpr::VK_RISCV_TLS_GOT_HI
@ VK_RISCV_TLS_GOT_HI
Definition: RISCVMCExpr.h:35
llvm::MCInstrDesc::TSFlags
uint64_t TSFlags
Definition: MCInstrDesc.h:205
llvm::MCInstrDesc::getSize
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...
Definition: MCInstrDesc.h:622
llvm::MCInstBuilder::addOperand
MCInstBuilder & addOperand(const MCOperand &Op)
Add an operand.
Definition: MCInstBuilder.h:67
llvm::RISCV::fixup_riscv_jal
@ fixup_riscv_jal
Definition: RISCVFixupKinds.h:52
llvm::RISCV::fixup_riscv_hi20
@ fixup_riscv_hi20
Definition: RISCVFixupKinds.h:20
llvm::RISCVMCExpr::VK_RISCV_LO
@ VK_RISCV_LO
Definition: RISCVMCExpr.h:27
llvm::RISCV::fixup_riscv_rvc_jump
@ fixup_riscv_rvc_jump
Definition: RISCVFixupKinds.h:56
llvm::support::little
@ little
Definition: Endian.h:27
llvm::RISCV::fixup_riscv_tls_got_hi20
@ fixup_riscv_tls_got_hi20
Definition: RISCVFixupKinds.h:47
llvm::MCExpr::Target
@ Target
Target specific expression.
Definition: MCExpr.h:42
MCContext.h
MCInstrInfo.h
llvm::MCOperand::getImm
int64_t getImm() const
Definition: MCInst.h:80
MCSymbol.h
llvm::RISCV::fixup_riscv_lo12_i
@ fixup_riscv_lo12_i
Definition: RISCVFixupKinds.h:22
MCInst.h
llvm::MCInstrDesc
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:197
llvm::AArch64::Fixups
Fixups
Definition: AArch64FixupKinds.h:17
MCSubtargetInfo.h
llvm::MCSubtargetInfo::getFeatureBits
const FeatureBitset & getFeatureBits() const
Definition: MCSubtargetInfo.h:112
llvm::RISCV::fixup_riscv_got_hi20
@ fixup_riscv_got_hi20
Definition: RISCVFixupKinds.h:34
RISCVMCTargetDesc.h
llvm::STATISTIC
STATISTIC(NumFunctions, "Total number of functions")
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::RISCV::fixup_riscv_relax
@ fixup_riscv_relax
Definition: RISCVFixupKinds.h:67
llvm::MCExpr::getKind
ExprKind getKind() const
Definition: MCExpr.h:81
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::support::endian::write
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
Definition: Endian.h:97
llvm::RISCVII::getFormat
static unsigned getFormat(uint64_t TSFlags)
Definition: RISCVBaseInfo.h:126
llvm::MCConstantExpr
Definition: MCExpr.h:144
llvm::RISCVMCExpr::VK_RISCV_None
@ VK_RISCV_None
Definition: RISCVMCExpr.h:26
llvm::RISCV::fixup_riscv_branch
@ fixup_riscv_branch
Definition: RISCVFixupKinds.h:54
llvm::MCOperand::isImm
bool isImm() const
Definition: MCInst.h:62
llvm::RISCVMCExpr::VK_RISCV_PCREL_HI
@ VK_RISCV_PCREL_HI
Definition: RISCVMCExpr.h:30
uint64_t
llvm::RISCV::fixup_riscv_tprel_lo12_s
@ fixup_riscv_tprel_lo12_s
Definition: RISCVFixupKinds.h:41
MCRegisterInfo.h
llvm::MCInstBuilder
Definition: MCInstBuilder.h:21
llvm::RISCVMCExpr::VK_RISCV_PCREL_LO
@ VK_RISCV_PCREL_LO
Definition: RISCVMCExpr.h:29
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::RISCV::fixup_riscv_tprel_lo12_i
@ fixup_riscv_tprel_lo12_i
Definition: RISCVFixupKinds.h:38
llvm::RISCVMCExpr::VK_RISCV_GOT_HI
@ VK_RISCV_GOT_HI
Definition: RISCVMCExpr.h:31
llvm::RISCVII::InstFormatB
@ InstFormatB
Definition: RISCVBaseInfo.h:34
llvm::NVPTXISD::Dummy
@ Dummy
Definition: NVPTXISelLowering.h:60
MCAsmInfo.h
llvm::MCInstBuilder::addImm
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Definition: MCInstBuilder.h:37
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::RISCV::fixup_riscv_pcrel_hi20
@ fixup_riscv_pcrel_hi20
Definition: RISCVFixupKinds.h:26
uint32_t
llvm::RISCVII::InstFormatJ
@ InstFormatJ
Definition: RISCVBaseInfo.h:36
llvm::MCInstBuilder::addExpr
MCInstBuilder & addExpr(const MCExpr *Val)
Add a new MCExpr operand.
Definition: MCInstBuilder.h:55
llvm::ifs::IFSSymbolType::Func
@ Func
llvm::RISCVII::InstFormatCB
@ InstFormatCB
Definition: RISCVBaseInfo.h:44
llvm::RISCVMCExpr::getKind
VariantKind getKind() const
Definition: RISCVMCExpr.h:56
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
llvm::RISCVMCExpr::VK_RISCV_32_PCREL
@ VK_RISCV_32_PCREL
Definition: RISCVMCExpr.h:39
EndianStream.h
uint16_t
llvm::MCCodeEmitter
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:21
llvm::RISCV::fixup_riscv_tprel_add
@ fixup_riscv_tprel_add
Definition: RISCVFixupKinds.h:44
Casting.h
llvm::MCOperand::getExpr
const MCExpr * getExpr() const
Definition: MCInst.h:114
llvm::RISCVII::InstFormatI
@ InstFormatI
Definition: RISCVBaseInfo.h:32
RISCVBaseInfo.h
llvm::MCOperand::isExpr
bool isExpr() const
Definition: MCInst.h:65
llvm::ISD::ADD
@ ADD
Simple integer binary arithmetic operators.
Definition: ISDOpcodes.h:239
llvm::MCFixupKind
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
llvm::RISCVMCExpr::VK_RISCV_CALL
@ VK_RISCV_CALL
Definition: RISCVMCExpr.h:37
llvm::RISCV::fixup_riscv_rvc_branch
@ fixup_riscv_rvc_branch
Definition: RISCVFixupKinds.h:58
llvm::MCExpr::SymbolRef
@ SymbolRef
References to labels and assigned expressions.
Definition: MCExpr.h:40
llvm::RISCV::fixup_riscv_invalid
@ fixup_riscv_invalid
Definition: RISCVFixupKinds.h:109
llvm::RISCVII::InstFormatS
@ InstFormatS
Definition: RISCVBaseInfo.h:33
llvm::MCInstBuilder::addReg
MCInstBuilder & addReg(unsigned Reg)
Add a new register operand.
Definition: MCInstBuilder.h:31
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::MCOperand
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:36
llvm::RISCV::Fixups
Fixups
Definition: RISCVFixupKinds.h:18
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition: MCExpr.h:195
llvm::MCExpr::ExprKind
ExprKind
Definition: MCExpr.h:37
llvm::RISCVMCExpr::VK_RISCV_CALL_PLT
@ VK_RISCV_CALL_PLT
Definition: RISCVMCExpr.h:38
raw_ostream.h
MCExpr.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76
llvm::RISCV::fixup_riscv_tprel_hi20
@ fixup_riscv_tprel_hi20
Definition: RISCVFixupKinds.h:36
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:24
llvm::MCOperand::getReg
unsigned getReg() const
Returns the register number.
Definition: MCInst.h:69
RISCVFixupKinds.h
llvm::RISCVMCExpr
Definition: RISCVMCExpr.h:23