LLVM  10.0.0svn
AMDGPUMCInstLower.cpp
Go to the documentation of this file.
1 //===- AMDGPUMCInstLower.cpp - Lower AMDGPU MachineInstr to an MCInst -----===//
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 /// \file
10 /// Code to lower AMDGPU MachineInstrs to their corresponding MCInst.
11 //
12 //===----------------------------------------------------------------------===//
13 //
14 
15 #include "AMDGPUAsmPrinter.h"
16 #include "AMDGPUSubtarget.h"
17 #include "AMDGPUTargetMachine.h"
20 #include "R600AsmPrinter.h"
21 #include "SIInstrInfo.h"
24 #include "llvm/IR/Constants.h"
25 #include "llvm/IR/Function.h"
26 #include "llvm/IR/GlobalVariable.h"
27 #include "llvm/MC/MCCodeEmitter.h"
28 #include "llvm/MC/MCContext.h"
29 #include "llvm/MC/MCExpr.h"
30 #include "llvm/MC/MCInst.h"
32 #include "llvm/MC/MCStreamer.h"
34 #include "llvm/Support/Format.h"
35 #include <algorithm>
36 
37 using namespace llvm;
38 
39 namespace {
40 
41 class AMDGPUMCInstLower {
42  MCContext &Ctx;
43  const TargetSubtargetInfo &ST;
44  const AsmPrinter &AP;
45 
46  const MCExpr *getLongBranchBlockExpr(const MachineBasicBlock &SrcBB,
47  const MachineOperand &MO) const;
48 
49 public:
50  AMDGPUMCInstLower(MCContext &ctx, const TargetSubtargetInfo &ST,
51  const AsmPrinter &AP);
52 
53  bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const;
54 
55  /// Lower a MachineInstr to an MCInst
56  void lower(const MachineInstr *MI, MCInst &OutMI) const;
57 
58 };
59 
60 class R600MCInstLower : public AMDGPUMCInstLower {
61 public:
62  R600MCInstLower(MCContext &ctx, const R600Subtarget &ST,
63  const AsmPrinter &AP);
64 
65  /// Lower a MachineInstr to an MCInst
66  void lower(const MachineInstr *MI, MCInst &OutMI) const;
67 };
68 
69 
70 } // End anonymous namespace
71 
72 #include "AMDGPUGenMCPseudoLowering.inc"
73 
74 AMDGPUMCInstLower::AMDGPUMCInstLower(MCContext &ctx,
75  const TargetSubtargetInfo &st,
76  const AsmPrinter &ap):
77  Ctx(ctx), ST(st), AP(ap) { }
78 
79 static MCSymbolRefExpr::VariantKind getVariantKind(unsigned MOFlags) {
80  switch (MOFlags) {
81  default:
97  }
98 }
99 
100 const MCExpr *AMDGPUMCInstLower::getLongBranchBlockExpr(
101  const MachineBasicBlock &SrcBB,
102  const MachineOperand &MO) const {
103  const MCExpr *DestBBSym
104  = MCSymbolRefExpr::create(MO.getMBB()->getSymbol(), Ctx);
105  const MCExpr *SrcBBSym = MCSymbolRefExpr::create(SrcBB.getSymbol(), Ctx);
106 
107  // FIXME: The first half of this assert should be removed. This should
108  // probably be PC relative instead of using the source block symbol, and
109  // therefore the indirect branch expansion should use a bundle.
110  assert(
111  skipDebugInstructionsForward(SrcBB.begin(), SrcBB.end())->getOpcode() ==
112  AMDGPU::S_GETPC_B64 &&
113  ST.getInstrInfo()->get(AMDGPU::S_GETPC_B64).Size == 4);
114 
115  // s_getpc_b64 returns the address of next instruction.
116  const MCConstantExpr *One = MCConstantExpr::create(4, Ctx);
117  SrcBBSym = MCBinaryExpr::createAdd(SrcBBSym, One, Ctx);
118 
120  return MCBinaryExpr::createSub(DestBBSym, SrcBBSym, Ctx);
121 
123  return MCBinaryExpr::createSub(SrcBBSym, DestBBSym, Ctx);
124 }
125 
126 bool AMDGPUMCInstLower::lowerOperand(const MachineOperand &MO,
127  MCOperand &MCOp) const {
128  switch (MO.getType()) {
129  default:
130  llvm_unreachable("unknown operand type");
132  MCOp = MCOperand::createImm(MO.getImm());
133  return true;
136  return true;
138  if (MO.getTargetFlags() != 0) {
139  MCOp = MCOperand::createExpr(
140  getLongBranchBlockExpr(*MO.getParent()->getParent(), MO));
141  } else {
142  MCOp = MCOperand::createExpr(
144  }
145 
146  return true;
147  }
149  const GlobalValue *GV = MO.getGlobal();
151  AP.getNameWithPrefix(SymbolName, GV);
152  MCSymbol *Sym = Ctx.getOrCreateSymbol(SymbolName);
153  const MCExpr *Expr =
155  int64_t Offset = MO.getOffset();
156  if (Offset != 0) {
157  Expr = MCBinaryExpr::createAdd(Expr,
158  MCConstantExpr::create(Offset, Ctx), Ctx);
159  }
160  MCOp = MCOperand::createExpr(Expr);
161  return true;
162  }
164  MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(MO.getSymbolName()));
165  Sym->setExternal(true);
166  const MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
167  MCOp = MCOperand::createExpr(Expr);
168  return true;
169  }
171  // Regmasks are like implicit defs.
172  return false;
173  }
174 }
175 
176 void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
177  unsigned Opcode = MI->getOpcode();
178  const auto *TII = static_cast<const SIInstrInfo*>(ST.getInstrInfo());
179 
180  // FIXME: Should be able to handle this with emitPseudoExpansionLowering. We
181  // need to select it to the subtarget specific version, and there's no way to
182  // do that with a single pseudo source operation.
183  if (Opcode == AMDGPU::S_SETPC_B64_return)
184  Opcode = AMDGPU::S_SETPC_B64;
185  else if (Opcode == AMDGPU::SI_CALL) {
186  // SI_CALL is just S_SWAPPC_B64 with an additional operand to track the
187  // called function (which we need to remove here).
188  OutMI.setOpcode(TII->pseudoToMCOpcode(AMDGPU::S_SWAPPC_B64));
189  MCOperand Dest, Src;
190  lowerOperand(MI->getOperand(0), Dest);
191  lowerOperand(MI->getOperand(1), Src);
192  OutMI.addOperand(Dest);
193  OutMI.addOperand(Src);
194  return;
195  } else if (Opcode == AMDGPU::SI_TCRETURN) {
196  // TODO: How to use branch immediate and avoid register+add?
197  Opcode = AMDGPU::S_SETPC_B64;
198  }
199 
200  int MCOpcode = TII->pseudoToMCOpcode(Opcode);
201  if (MCOpcode == -1) {
203  C.emitError("AMDGPUMCInstLower::lower - Pseudo instruction doesn't have "
204  "a target-specific version: " + Twine(MI->getOpcode()));
205  }
206 
207  OutMI.setOpcode(MCOpcode);
208 
209  for (const MachineOperand &MO : MI->explicit_operands()) {
210  MCOperand MCOp;
211  lowerOperand(MO, MCOp);
212  OutMI.addOperand(MCOp);
213  }
214 
215  int FIIdx = AMDGPU::getNamedOperandIdx(MCOpcode, AMDGPU::OpName::fi);
216  if (FIIdx >= (int)OutMI.getNumOperands())
218 }
219 
221  MCOperand &MCOp) const {
222  const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
223  AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
224  return MCInstLowering.lowerOperand(MO, MCOp);
225 }
226 
228  const Constant *CV,
230  // TargetMachine does not support llvm-style cast. Use C++-style cast.
231  // This is safe since TM is always of type AMDGPUTargetMachine or its
232  // derived class.
233  auto &AT = static_cast<const AMDGPUTargetMachine&>(TM);
234  auto *CE = dyn_cast<ConstantExpr>(CV);
235 
236  // Lower null pointers in private and local address space.
237  // Clang generates addrspacecast for null pointers in private and local
238  // address space, which needs to be lowered.
239  if (CE && CE->getOpcode() == Instruction::AddrSpaceCast) {
240  auto Op = CE->getOperand(0);
241  auto SrcAddr = Op->getType()->getPointerAddressSpace();
242  if (Op->isNullValue() && AT.getNullPointerValue(SrcAddr) == 0) {
243  auto DstAddr = CE->getType()->getPointerAddressSpace();
244  return MCConstantExpr::create(AT.getNullPointerValue(DstAddr),
245  OutContext);
246  }
247  }
248  return nullptr;
249 }
250 
252  if (const MCExpr *E = lowerAddrSpaceCast(TM, CV, OutContext))
253  return E;
254  return AsmPrinter::lowerConstant(CV);
255 }
256 
259  return;
260 
261  const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
262  AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
263 
264  StringRef Err;
265  if (!STI.getInstrInfo()->verifyInstruction(*MI, Err)) {
267  C.emitError("Illegal instruction detected: " + Err);
268  MI->print(errs());
269  }
270 
271  if (MI->isBundle()) {
272  const MachineBasicBlock *MBB = MI->getParent();
274  while (I != MBB->instr_end() && I->isInsideBundle()) {
275  EmitInstruction(&*I);
276  ++I;
277  }
278  } else {
279  // We don't want SI_MASK_BRANCH/SI_RETURN_TO_EPILOG encoded. They are
280  // placeholder terminator instructions and should only be printed as
281  // comments.
282  if (MI->getOpcode() == AMDGPU::SI_MASK_BRANCH) {
283  if (isVerbose()) {
284  SmallVector<char, 16> BBStr;
285  raw_svector_ostream Str(BBStr);
286 
287  const MachineBasicBlock *MBB = MI->getOperand(0).getMBB();
288  const MCSymbolRefExpr *Expr
290  Expr->print(Str, MAI);
291  OutStreamer->emitRawComment(Twine(" mask branch ") + BBStr);
292  }
293 
294  return;
295  }
296 
297  if (MI->getOpcode() == AMDGPU::SI_RETURN_TO_EPILOG) {
298  if (isVerbose())
299  OutStreamer->emitRawComment(" return to shader part epilog");
300  return;
301  }
302 
303  if (MI->getOpcode() == AMDGPU::WAVE_BARRIER) {
304  if (isVerbose())
305  OutStreamer->emitRawComment(" wave barrier");
306  return;
307  }
308 
309  if (MI->getOpcode() == AMDGPU::SI_MASKED_UNREACHABLE) {
310  if (isVerbose())
311  OutStreamer->emitRawComment(" divergent unreachable");
312  return;
313  }
314 
315  MCInst TmpInst;
316  MCInstLowering.lower(MI, TmpInst);
317  EmitToStreamer(*OutStreamer, TmpInst);
318 
319 #ifdef EXPENSIVE_CHECKS
320  // Sanity-check getInstSizeInBytes on explicitly specified CPUs (it cannot
321  // work correctly for the generic CPU).
322  //
323  // The isPseudo check really shouldn't be here, but unfortunately there are
324  // some negative lit tests that depend on being able to continue through
325  // here even when pseudo instructions haven't been lowered.
326  if (!MI->isPseudo() && STI.isCPUStringValid(STI.getCPU())) {
328  SmallVector<char, 16> CodeBytes;
329  raw_svector_ostream CodeStream(CodeBytes);
330 
331  std::unique_ptr<MCCodeEmitter> InstEmitter(createSIMCCodeEmitter(
333  InstEmitter->encodeInstruction(TmpInst, CodeStream, Fixups, STI);
334 
335  assert(CodeBytes.size() == STI.getInstrInfo()->getInstSizeInBytes(*MI));
336  }
337 #endif
338 
339  if (DumpCodeInstEmitter) {
340  // Disassemble instruction/operands to text
341  DisasmLines.resize(DisasmLines.size() + 1);
342  std::string &DisasmLine = DisasmLines.back();
343  raw_string_ostream DisasmStream(DisasmLine);
344 
345  AMDGPUInstPrinter InstPrinter(*TM.getMCAsmInfo(), *STI.getInstrInfo(),
346  *STI.getRegisterInfo());
347  InstPrinter.printInst(&TmpInst, DisasmStream, StringRef(), STI);
348 
349  // Disassemble instruction/operands to hex representation.
351  SmallVector<char, 16> CodeBytes;
352  raw_svector_ostream CodeStream(CodeBytes);
353 
354  DumpCodeInstEmitter->encodeInstruction(
355  TmpInst, CodeStream, Fixups, MF->getSubtarget<MCSubtargetInfo>());
356  HexLines.resize(HexLines.size() + 1);
357  std::string &HexLine = HexLines.back();
358  raw_string_ostream HexStream(HexLine);
359 
360  for (size_t i = 0; i < CodeBytes.size(); i += 4) {
361  unsigned int CodeDWord = *(unsigned int *)&CodeBytes[i];
362  HexStream << format("%s%08X", (i > 0 ? " " : ""), CodeDWord);
363  }
364 
365  DisasmStream.flush();
366  DisasmLineMaxLen = std::max(DisasmLineMaxLen, DisasmLine.size());
367  }
368  }
369 }
370 
371 R600MCInstLower::R600MCInstLower(MCContext &Ctx, const R600Subtarget &ST,
372  const AsmPrinter &AP) :
373  AMDGPUMCInstLower(Ctx, ST, AP) { }
374 
375 void R600MCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
376  OutMI.setOpcode(MI->getOpcode());
377  for (const MachineOperand &MO : MI->explicit_operands()) {
378  MCOperand MCOp;
379  lowerOperand(MO, MCOp);
380  OutMI.addOperand(MCOp);
381  }
382 }
383 
385  const R600Subtarget &STI = MF->getSubtarget<R600Subtarget>();
386  R600MCInstLower MCInstLowering(OutContext, STI, *this);
387 
388  StringRef Err;
389  if (!STI.getInstrInfo()->verifyInstruction(*MI, Err)) {
391  C.emitError("Illegal instruction detected: " + Err);
392  MI->print(errs());
393  }
394 
395  if (MI->isBundle()) {
396  const MachineBasicBlock *MBB = MI->getParent();
398  while (I != MBB->instr_end() && I->isInsideBundle()) {
399  EmitInstruction(&*I);
400  ++I;
401  }
402  } else {
403  MCInst TmpInst;
404  MCInstLowering.lower(MI, TmpInst);
405  EmitToStreamer(*OutStreamer, TmpInst);
406  }
407 }
408 
410  if (const MCExpr *E = lowerAddrSpaceCast(TM, CV, OutContext))
411  return E;
412  return AsmPrinter::lowerConstant(CV);
413 }
unsigned getTargetFlags() const
uint64_t CallInst * C
void EmitInstruction(const MachineInstr *MI) override
Implemented in AMDGPUMCInstLower.cpp.
const MCExpr * lowerConstant(const Constant *CV) override
Lower the specified LLVM Constant to an MCExpr.
MCCodeEmitter * createSIMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
AMDGPU specific subclass of TargetSubtarget.
instr_iterator instr_end()
MachineBasicBlock * getMBB() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:93
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:329
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const MCExpr * lowerConstant(const Constant *CV) override
Lower the specified LLVM Constant to an MCExpr.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
iterator_range< mop_iterator > explicit_operands()
Definition: MachineInstr.h:482
MCContext & OutContext
This is the context for the output file that we are streaming.
Definition: AsmPrinter.h:88
static MCOperand createExpr(const MCExpr *Val)
Definition: MCInst.h:136
bool emitPseudoExpansionLowering(MCStreamer &OutStreamer, const MachineInstr *MI)
tblgen&#39;erated driver function for lowering simple MI->MC pseudo instructions.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
const SIInstrInfo * getInstrInfo() const override
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:530
MachineBasicBlock reference.
MachineFunction * MF
The current machine function.
Definition: AsmPrinter.h:96
Mask of preserved registers.
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const override
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
void setExternal(bool Value) const
Definition: MCSymbol.h:406
static MCOperand createReg(unsigned Reg)
Definition: MCInst.h:115
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
const HexagonInstrInfo * TII
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
Definition: VPlanSLP.cpp:196
virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
Name of external global symbol.
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:169
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition: MachineInstr.h:410
const char * getSymbolName() const
Context object for machine code objects.
Definition: MCContext.h:65
void emitError(unsigned LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:888
void EmitInstruction(const MachineInstr *MI) override
Implemented in AMDGPUMCInstLower.cpp.
bool isBundle() const
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:552
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:467
bool isVerbose() const
Return true if assembly output should contain comments.
Definition: AsmPrinter.h:203
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false)
Definition: MCExpr.cpp:169
Address of a global value.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Definition: MCExpr.cpp:42
const MCAsmInfo * MAI
Target Asm Printer information.
Definition: AsmPrinter.h:84
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:64
bool isPseudo(QueryType Type=IgnoreBundle) const
Return true if this is a pseudo instruction that doesn&#39;t correspond to a real machine instruction...
Definition: MachineInstr.h:642
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
Definition: Constant.h:41
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const GlobalValue * getGlobal() const
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
TargetMachine & TM
Target machine description.
Definition: AsmPrinter.h:81
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:78
const R600InstrInfo * getInstrInfo() const override
self_iterator getIterator()
Definition: ilist_node.h:81
unsigned getNumOperands() const
Definition: MCInst.h:181
void print(raw_ostream &OS, bool IsStandalone=true, bool SkipOpers=false, bool SkipDebugLoc=false, bool AddNewLine=true, const TargetInstrInfo *TII=nullptr) const
Print this MI to OS.
The AMDGPU TargetMachine interface definition for hw codgen targets.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Definition: Function.cpp:205
size_t size() const
Definition: SmallVector.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static MCSymbolRefExpr::VariantKind getVariantKind(unsigned MOFlags)
Iterator for intrusive lists based on ilist_node.
std::vector< std::string > HexLines
void setOpcode(unsigned Op)
Definition: MCInst.h:170
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:390
virtual const MCExpr * lowerConstant(const Constant *CV)
Lower the specified LLVM Constant to an MCExpr.
R600 Assembly printer class.
MachineOperand class - Representation of each machine instruction operand.
static const MCExpr * lowerAddrSpaceCast(const TargetMachine &TM, const Constant *CV, MCContext &OutContext)
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:837
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
Definition: AsmPrinter.cpp:235
int64_t getImm() const
const Function & getFunction() const
Return the LLVM function that this machine code represents.
std::vector< std::string > DisasmLines
IterT skipDebugInstructionsForward(IterT It, IterT End)
Increment It until it points to a non-debug instruction or to End and return the resulting iterator...
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:255
TargetSubtargetInfo - Generic base class for all target subtargets.
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
Definition: MachineInstr.h:63
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Interface definition for SIInstrInfo.
int64_t getOffset() const
Return the offset from the symbol in this operand.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
#define I(x, y, z)
Definition: MD5.cpp:58
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
AMDGPU Assembly printer class.
Generic base class for all target subtargets.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:332
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:503
const MCRegisterInfo * getRegisterInfo() const
Definition: MCContext.h:320
unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI)
If Reg is a pseudo reg, return the correct hardware register given STI otherwise return Reg...
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:65
IRTranslator LLVM IR MI
void addOperand(const MCOperand &Op)
Definition: MCInst.h:183
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
Register getReg() const
getReg - Returns the register number.
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const
Wrapper for MCInstLowering.lowerOperand() for the tblgen&#39;erated pseudo lowering.
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:415
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:34
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static MCOperand createImm(int64_t Val)
Definition: MCInst.h:122
const SIRegisterInfo * getRegisterInfo() const override