LLVM  16.0.0git
WebAssemblyMCInstLower.cpp
Go to the documentation of this file.
1 // WebAssemblyMCInstLower.cpp - Convert WebAssembly 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 /// This file contains code to lower WebAssembly MachineInstrs to their
11 /// corresponding MCInst records.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #include "WebAssemblyMCInstLower.h"
19 #include "WebAssemblyAsmPrinter.h"
24 #include "llvm/IR/Constants.h"
25 #include "llvm/MC/MCAsmInfo.h"
26 #include "llvm/MC/MCContext.h"
27 #include "llvm/MC/MCExpr.h"
28 #include "llvm/MC/MCInst.h"
29 #include "llvm/MC/MCSymbolWasm.h"
32 
33 using namespace llvm;
34 
35 // This disables the removal of registers when lowering into MC, as required
36 // by some current tests.
38  WasmKeepRegisters("wasm-keep-registers", cl::Hidden,
39  cl::desc("WebAssembly: output stack registers in"
40  " instruction output for test purposes only."),
41  cl::init(false));
42 
43 static void removeRegisterOperands(const MachineInstr *MI, MCInst &OutMI);
44 
45 MCSymbol *
46 WebAssemblyMCInstLower::GetGlobalAddressSymbol(const MachineOperand &MO) const {
47  const GlobalValue *Global = MO.getGlobal();
48  if (!isa<Function>(Global)) {
49  auto *WasmSym = cast<MCSymbolWasm>(Printer.getSymbol(Global));
50  // If the symbol doesn't have an explicit WasmSymbolType yet and the
51  // GlobalValue is actually a WebAssembly global, then ensure the symbol is a
52  // WASM_SYMBOL_TYPE_GLOBAL.
53  if (WebAssembly::isWasmVarAddressSpace(Global->getAddressSpace()) &&
54  !WasmSym->getType()) {
55  const MachineFunction &MF = *MO.getParent()->getParent()->getParent();
56  const TargetMachine &TM = MF.getTarget();
57  const Function &CurrentFunc = MF.getFunction();
58  Type *GlobalVT = Global->getValueType();
60  computeLegalValueVTs(CurrentFunc, TM, GlobalVT, VTs);
61 
62  WebAssembly::wasmSymbolSetType(WasmSym, GlobalVT, VTs);
63  }
64  return WasmSym;
65  }
66 
67  const auto *FuncTy = cast<FunctionType>(Global->getValueType());
68  const MachineFunction &MF = *MO.getParent()->getParent()->getParent();
69  const TargetMachine &TM = MF.getTarget();
70  const Function &CurrentFunc = MF.getFunction();
71 
72  SmallVector<MVT, 1> ResultMVTs;
73  SmallVector<MVT, 4> ParamMVTs;
74  const auto *const F = dyn_cast<Function>(Global);
75  computeSignatureVTs(FuncTy, F, CurrentFunc, TM, ParamMVTs, ResultMVTs);
76  auto Signature = signatureFromMVTs(ResultMVTs, ParamMVTs);
77 
78  bool InvokeDetected = false;
79  auto *WasmSym = Printer.getMCSymbolForFunction(
81  Signature.get(), InvokeDetected);
82  WasmSym->setSignature(Signature.get());
83  Printer.addSignature(std::move(Signature));
84  WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
85  return WasmSym;
86 }
87 
88 MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol(
89  const MachineOperand &MO) const {
90  return Printer.getOrCreateWasmSymbol(MO.getSymbolName());
91 }
92 
93 MCOperand WebAssemblyMCInstLower::lowerSymbolOperand(const MachineOperand &MO,
94  MCSymbol *Sym) const {
96  unsigned TargetFlags = MO.getTargetFlags();
97 
98  switch (TargetFlags) {
100  break;
103  break;
106  break;
109  break;
112  break;
115  break;
116  default:
117  llvm_unreachable("Unknown target flag on GV operand");
118  }
119 
120  const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Kind, Ctx);
121 
122  if (MO.getOffset() != 0) {
123  const auto *WasmSym = cast<MCSymbolWasm>(Sym);
124  if (TargetFlags == WebAssemblyII::MO_GOT)
125  report_fatal_error("GOT symbol references do not support offsets");
126  if (WasmSym->isFunction())
127  report_fatal_error("Function addresses with offsets not supported");
128  if (WasmSym->isGlobal())
129  report_fatal_error("Global indexes with offsets not supported");
130  if (WasmSym->isTag())
131  report_fatal_error("Tag indexes with offsets not supported");
132  if (WasmSym->isTable())
133  report_fatal_error("Table indexes with offsets not supported");
134 
136  Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
137  }
138 
139  return MCOperand::createExpr(Expr);
140 }
141 
142 MCOperand WebAssemblyMCInstLower::lowerTypeIndexOperand(
144  SmallVector<wasm::ValType, 4> &&Params) const {
145  auto Signature = std::make_unique<wasm::WasmSignature>(std::move(Returns),
146  std::move(Params));
147  MCSymbol *Sym = Printer.createTempSymbol("typeindex");
148  auto *WasmSym = cast<MCSymbolWasm>(Sym);
149  WasmSym->setSignature(Signature.get());
150  Printer.addSignature(std::move(Signature));
151  WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
152  const MCExpr *Expr =
154  return MCOperand::createExpr(Expr);
155 }
156 
157 static void getFunctionReturns(const MachineInstr *MI,
159  const Function &F = MI->getMF()->getFunction();
160  const TargetMachine &TM = MI->getMF()->getTarget();
161  Type *RetTy = F.getReturnType();
162  SmallVector<MVT, 4> CallerRetTys;
163  computeLegalValueVTs(F, TM, RetTy, CallerRetTys);
164  valTypesFromMVTs(CallerRetTys, Returns);
165 }
166 
168  MCInst &OutMI) const {
169  OutMI.setOpcode(MI->getOpcode());
170 
171  const MCInstrDesc &Desc = MI->getDesc();
172  unsigned NumVariadicDefs = MI->getNumExplicitDefs() - Desc.getNumDefs();
173  for (unsigned I = 0, E = MI->getNumOperands(); I != E; ++I) {
174  const MachineOperand &MO = MI->getOperand(I);
175 
176  MCOperand MCOp;
177  switch (MO.getType()) {
178  default:
179  MI->print(errs());
180  llvm_unreachable("unknown operand type");
182  MI->print(errs());
183  llvm_unreachable("MachineBasicBlock operand should have been rewritten");
185  // Ignore all implicit register operands.
186  if (MO.isImplicit())
187  continue;
188  const WebAssemblyFunctionInfo &MFI =
189  *MI->getParent()->getParent()->getInfo<WebAssemblyFunctionInfo>();
190  unsigned WAReg = MFI.getWAReg(MO.getReg());
191  MCOp = MCOperand::createReg(WAReg);
192  break;
193  }
195  unsigned DescIndex = I - NumVariadicDefs;
196  if (DescIndex < Desc.NumOperands) {
197  const MCOperandInfo &Info = Desc.OpInfo[DescIndex];
198  if (Info.OperandType == WebAssembly::OPERAND_TYPEINDEX) {
201 
202  const MachineRegisterInfo &MRI =
203  MI->getParent()->getParent()->getRegInfo();
204  for (const MachineOperand &MO : MI->defs())
205  Returns.push_back(
207  for (const MachineOperand &MO : MI->explicit_uses())
208  if (MO.isReg())
209  Params.push_back(
211 
212  // call_indirect instructions have a callee operand at the end which
213  // doesn't count as a param.
214  if (WebAssembly::isCallIndirect(MI->getOpcode()))
215  Params.pop_back();
216 
217  // return_call_indirect instructions have the return type of the
218  // caller
219  if (MI->getOpcode() == WebAssembly::RET_CALL_INDIRECT)
220  getFunctionReturns(MI, Returns);
221 
222  MCOp = lowerTypeIndexOperand(std::move(Returns), std::move(Params));
223  break;
224  } else if (Info.OperandType == WebAssembly::OPERAND_SIGNATURE) {
225  auto BT = static_cast<WebAssembly::BlockType>(MO.getImm());
229  getFunctionReturns(MI, Returns);
230  MCOp = lowerTypeIndexOperand(std::move(Returns),
232  break;
233  }
234  }
235  }
236  MCOp = MCOperand::createImm(MO.getImm());
237  break;
238  }
240  const ConstantFP *Imm = MO.getFPImm();
241  const uint64_t BitPattern =
242  Imm->getValueAPF().bitcastToAPInt().getZExtValue();
243  if (Imm->getType()->isFloatTy())
244  MCOp = MCOperand::createSFPImm(static_cast<uint32_t>(BitPattern));
245  else if (Imm->getType()->isDoubleTy())
246  MCOp = MCOperand::createDFPImm(BitPattern);
247  else
248  llvm_unreachable("unknown floating point immediate type");
249  break;
250  }
252  MCOp = lowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
253  break;
255  MCOp = lowerSymbolOperand(MO, GetExternalSymbolSymbol(MO));
256  break;
258  assert(MO.getTargetFlags() == 0 &&
259  "WebAssembly does not use target flags on MCSymbol");
260  MCOp = lowerSymbolOperand(MO, MO.getMCSymbol());
261  break;
262  }
263 
264  OutMI.addOperand(MCOp);
265  }
266 
267  if (!WasmKeepRegisters)
268  removeRegisterOperands(MI, OutMI);
269  else if (Desc.variadicOpsAreDefs())
270  OutMI.insert(OutMI.begin(), MCOperand::createImm(MI->getNumExplicitDefs()));
271 }
272 
273 static void removeRegisterOperands(const MachineInstr *MI, MCInst &OutMI) {
274  // Remove all uses of stackified registers to bring the instruction format
275  // into its final stack form used thruout MC, and transition opcodes to
276  // their _S variant.
277  // We do this separate from the above code that still may need these
278  // registers for e.g. call_indirect signatures.
279  // See comments in lib/Target/WebAssembly/WebAssemblyInstrFormats.td for
280  // details.
281  // TODO: the code above creates new registers which are then removed here.
282  // That code could be slightly simplified by not doing that, though maybe
283  // it is simpler conceptually to keep the code above in "register mode"
284  // until this transition point.
285  // FIXME: we are not processing inline assembly, which contains register
286  // operands, because it is used by later target generic code.
287  if (MI->isDebugInstr() || MI->isLabel() || MI->isInlineAsm())
288  return;
289 
290  // Transform to _S instruction.
291  auto RegOpcode = OutMI.getOpcode();
292  auto StackOpcode = WebAssembly::getStackOpcode(RegOpcode);
293  assert(StackOpcode != -1 && "Failed to stackify instruction");
294  OutMI.setOpcode(StackOpcode);
295 
296  // Remove register operands.
297  for (auto I = OutMI.getNumOperands(); I; --I) {
298  auto &MO = OutMI.getOperand(I - 1);
299  if (MO.isReg()) {
300  OutMI.erase(&MO);
301  }
302  }
303 }
llvm::MCInstrDesc::getNumDefs
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
Definition: MCInstrDesc.h:245
AsmPrinter.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
llvm::MachineOperand::MO_Immediate
@ MO_Immediate
Immediate operand.
Definition: MachineOperand.h:52
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MCSymbolRefExpr::VK_GOT
@ VK_GOT
Definition: MCExpr.h:198
llvm::MCOperand::createExpr
static MCOperand createExpr(const MCExpr *Val)
Definition: MCInst.h:162
WebAssemblyISelLowering.h
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:50
llvm::MachineOperand::getGlobal
const GlobalValue * getGlobal() const
Definition: MachineOperand.h:572
llvm::AsmPrinter::createTempSymbol
MCSymbol * createTempSymbol(const Twine &Name) const
Definition: AsmPrinter.cpp:3516
llvm::MCOperand::createImm
static MCOperand createImm(int64_t Val)
Definition: MCInst.h:141
llvm::Function
Definition: Function.h:60
llvm::MCInst::insert
iterator insert(iterator I, const MCOperand &Op)
Definition: MCInst.h:224
llvm::MCConstantExpr::create
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition: MCExpr.cpp:194
llvm::signatureFromMVTs
std::unique_ptr< wasm::WasmSignature > signatureFromMVTs(const SmallVectorImpl< MVT > &Results, const SmallVectorImpl< MVT > &Params)
Definition: WebAssemblyMachineFunctionInfo.cpp:116
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1181
WebAssemblyMCInstLower.h
ErrorHandling.h
llvm::WebAssemblyII::MO_NO_FLAG
@ MO_NO_FLAG
Definition: WebAssemblyMCTargetDesc.h:87
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:140
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::WebAssembly::BlockType::Invalid
@ Invalid
llvm::WebAssembly::OPERAND_SIGNATURE
@ OPERAND_SIGNATURE
signature immediate for block/loop.
Definition: WebAssemblyMCTargetDesc.h:71
llvm::WebAssembly::wasmSymbolSetType
void wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT, const SmallVector< MVT, 1 > &VTs)
Sets a Wasm Symbol Type.
Definition: WebAssemblyTypeUtilities.cpp:177
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:891
llvm::MCSymbolWasm::setSignature
void setSignature(wasm::WasmSignature *Sig)
Definition: MCSymbolWasm.h:129
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::WebAssemblyAsmPrinter::getOrCreateWasmSymbol
MCSymbol * getOrCreateWasmSymbol(StringRef Name)
Definition: WebAssemblyAsmPrinter.cpp:210
llvm::MachineOperand::getOffset
int64_t getOffset() const
Return the offset from the symbol in this operand.
Definition: MachineOperand.h:609
llvm::MCInst::getNumOperands
unsigned getNumOperands() const
Definition: MCInst.h:208
llvm::WebAssembly::regClassToValType
wasm::ValType regClassToValType(unsigned RC)
Definition: WebAssemblyTypeUtilities.cpp:151
removeRegisterOperands
static void removeRegisterOperands(const MachineInstr *MI, MCInst &OutMI)
Definition: WebAssemblyMCInstLower.cpp:273
llvm::MachineOperand::getMCSymbol
MCSymbol * getMCSymbol() const
Definition: MachineOperand.h:582
llvm::MachineOperand::MO_Register
@ MO_Register
Register operand.
Definition: MachineOperand.h:51
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::MCInst::setOpcode
void setOpcode(unsigned Op)
Definition: MCInst.h:197
llvm::MCSymbolRefExpr::VK_WASM_MBREL
@ VK_WASM_MBREL
Definition: MCExpr.h:330
llvm::MCOperandInfo
This holds information about one operand of a machine instruction, indicating the register class for ...
Definition: MCInstrDesc.h:84
llvm::WebAssemblyII::MO_TLS_BASE_REL
@ MO_TLS_BASE_REL
Definition: WebAssemblyMCTargetDesc.h:106
llvm::MachineOperand::isImplicit
bool isImplicit() const
Definition: MachineOperand.h:379
llvm::WebAssemblyMCInstLower::lower
void lower(const MachineInstr *MI, MCInst &OutMI) const
Definition: WebAssemblyMCInstLower.cpp:167
llvm::MCSymbolRefExpr::VK_WASM_TBREL
@ VK_WASM_TBREL
Definition: MCExpr.h:331
Constants.h
llvm::MachineOperand::MO_GlobalAddress
@ MO_GlobalAddress
Address of a global value.
Definition: MachineOperand.h:61
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MachineOperand::getImm
int64_t getImm() const
Definition: MachineOperand.h:546
llvm::WebAssemblyII::MO_GOT_TLS
@ MO_GOT_TLS
Definition: WebAssemblyMCTargetDesc.h:96
MCSymbolWasm.h
getFunctionReturns
static void getFunctionReturns(const MachineInstr *MI, SmallVectorImpl< wasm::ValType > &Returns)
Definition: WebAssemblyMCInstLower.cpp:157
llvm::WebAssemblyAsmPrinter::addSignature
void addSignature(std::unique_ptr< wasm::WasmSignature > &&Sig)
Definition: WebAssemblyAsmPrinter.h:47
MCContext.h
llvm::WebAssembly::WasmEnableEmSjLj
cl::opt< bool > WasmEnableEmSjLj
llvm::BitTracker
Definition: BitTracker.h:35
MCInst.h
llvm::MCInstrDesc
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:197
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:48
WebAssemblyTypeUtilities.h
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:145
llvm::ConstantFP
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:257
llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION
@ WASM_SYMBOL_TYPE_FUNCTION
Definition: Wasm.h:383
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::MachineOperand::getParent
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
Definition: MachineOperand.h:237
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::MCInst::erase
void erase(iterator I)
Definition: MCInst.h:216
WebAssemblyUtilities.h
llvm::MCInst::addOperand
void addOperand(const MCOperand Op)
Definition: MCInst.h:210
llvm::Pass::print
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
Definition: Pass.cpp:129
llvm::MachineRegisterInfo::getRegClass
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
Definition: MachineRegisterInfo.h:647
llvm::cl::opt< bool >
llvm::MCInstrDesc::NumOperands
unsigned short NumOperands
Definition: MCInstrDesc.h:200
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::MCSymbolRefExpr::VK_WASM_GOT_TLS
@ VK_WASM_GOT_TLS
Definition: MCExpr.h:332
llvm::MCSymbolRefExpr::VariantKind
VariantKind
Definition: MCExpr.h:194
llvm::MachineOperand::getTargetFlags
unsigned getTargetFlags() const
Definition: MachineOperand.h:220
llvm::MachineOperand::isReg
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Definition: MachineOperand.h:320
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
uint64_t
llvm::MCSymbolRefExpr::VK_WASM_TLSREL
@ VK_WASM_TLSREL
Definition: MCExpr.h:329
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::MCInst::begin
iterator begin()
Definition: MCInst.h:219
llvm::valTypesFromMVTs
void valTypesFromMVTs(const ArrayRef< MVT > &In, SmallVectorImpl< wasm::ValType > &Out)
Definition: WebAssemblyMachineFunctionInfo.cpp:109
WasmKeepRegisters
cl::opt< bool > WasmKeepRegisters("wasm-keep-registers", cl::Hidden, cl::desc("WebAssembly: output stack registers in" " instruction output for test purposes only."), cl::init(false))
I
#define I(x, y, z)
Definition: MD5.cpp:58
WebAssemblyTargetInfo.h
llvm::MachineOperand::MO_MCSymbol
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
Definition: MachineOperand.h:66
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:440
llvm::MachineOperand::getType
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
Definition: MachineOperand.h:218
llvm::WebAssemblyFunctionInfo::getWAReg
unsigned getWAReg(unsigned VReg) const
Definition: WebAssemblyMachineFunctionInfo.h:155
llvm::WebAssembly::BlockType::Multivalue
@ Multivalue
llvm::MachineOperand::getFPImm
const ConstantFP * getFPImm() const
Definition: MachineOperand.h:556
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::AsmPrinter::getSymbol
MCSymbol * getSymbol(const GlobalValue *GV) const
Definition: AsmPrinter.cpp:655
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::WebAssembly::isCallIndirect
bool isCallIndirect(unsigned Opc)
Definition: WebAssemblyMCTargetDesc.h:363
llvm::MachineBasicBlock::getParent
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Definition: MachineBasicBlock.h:261
llvm::MCInstrDesc::OpInfo
const MCOperandInfo * OpInfo
Definition: MCInstrDesc.h:208
llvm::MachineOperand::MO_FPImmediate
@ MO_FPImmediate
Floating-point immediate operand.
Definition: MachineOperand.h:54
llvm::WebAssemblyFunctionInfo
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
Definition: WebAssemblyMachineFunctionInfo.h:33
llvm::MachineOperand::getReg
Register getReg() const
getReg - Returns the register number.
Definition: MachineOperand.h:359
WebAssemblyMachineFunctionInfo.h
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::WebAssemblyII::MO_MEMORY_BASE_REL
@ MO_MEMORY_BASE_REL
Definition: WebAssemblyMCTargetDesc.h:101
llvm::MCBinaryExpr::createAdd
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:525
llvm::computeLegalValueVTs
void computeLegalValueVTs(const WebAssemblyTargetLowering &TLI, LLVMContext &Ctx, const DataLayout &DL, Type *Ty, SmallVectorImpl< MVT > &ValueVTs)
Definition: WebAssemblyMachineFunctionInfo.cpp:43
WebAssemblyAsmPrinter.h
MCAsmInfo.h
llvm::WebAssemblyII::MO_GOT
@ MO_GOT
Definition: WebAssemblyMCTargetDesc.h:93
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::MCOperand::createReg
static MCOperand createReg(unsigned Reg)
Definition: MCInst.h:134
uint32_t
llvm::MachineOperand::MO_MachineBasicBlock
@ MO_MachineBasicBlock
MachineBasicBlock reference.
Definition: MachineOperand.h:55
llvm::MCInstrDesc::variadicOpsAreDefs
bool variadicOpsAreDefs() const
Return true if variadic operands of this instruction are definitions.
Definition: MCInstrDesc.h:415
llvm::MachineInstr::getParent
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:313
llvm::MCOperand::createSFPImm
static MCOperand createSFPImm(uint32_t Val)
Definition: MCInst.h:148
llvm::WebAssembly::OPERAND_TYPEINDEX
@ OPERAND_TYPEINDEX
type signature immediate for call_indirect.
Definition: WebAssemblyMCTargetDesc.h:73
llvm::MCOperand::createDFPImm
static MCOperand createDFPImm(uint64_t Val)
Definition: MCInst.h:155
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::computeSignatureVTs
void computeSignatureVTs(const FunctionType *Ty, const Function *TargetFunc, const Function &ContextFunc, const TargetMachine &TM, SmallVectorImpl< MVT > &Params, SmallVectorImpl< MVT > &Results)
Definition: WebAssemblyMachineFunctionInfo.cpp:65
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:622
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:652
llvm::MachineOperand::MO_ExternalSymbol
@ MO_ExternalSymbol
Name of external global symbol.
Definition: MachineOperand.h:60
llvm::MCSymbolRefExpr::VK_WASM_TYPEINDEX
@ VK_WASM_TYPEINDEX
Definition: MCExpr.h:328
llvm::MCInst::getOpcode
unsigned getOpcode() const
Definition: MCInst.h:198
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:386
llvm::WebAssemblyAsmPrinter::getMCSymbolForFunction
MCSymbolWasm * getMCSymbolForFunction(const Function *F, bool EnableEmEH, wasm::WasmSignature *Sig, bool &InvokeDetected)
Definition: WebAssemblyAsmPrinter.cpp:150
llvm::RISCVMatInt::Imm
@ Imm
Definition: RISCVMatInt.h:23
llvm::MachineOperand::getSymbolName
const char * getSymbolName() const
Definition: MachineOperand.h:617
llvm::WebAssembly::isWasmVarAddressSpace
bool isWasmVarAddressSpace(unsigned AS)
Definition: WebAssemblyTypeUtilities.h:66
llvm::MCInst::getOperand
const MCOperand & getOperand(unsigned i) const
Definition: MCInst.h:206
llvm::WebAssembly::BlockType
BlockType
Used as immediate MachineOperands for block signatures.
Definition: WebAssemblyTypeUtilities.h:31
llvm::pdb::PDB_DataKind::Global
@ Global
llvm::WebAssemblyII::MO_TABLE_BASE_REL
@ MO_TABLE_BASE_REL
Definition: WebAssemblyMCTargetDesc.h:111
llvm::SmallVectorImpl< wasm::ValType >
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::MCOperand
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:36
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition: MCExpr.h:195
llvm::cl::desc
Definition: CommandLine.h:413
raw_ostream.h
MachineFunction.h
MCExpr.h
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::WebAssembly::WasmEnableEmEH
cl::opt< bool > WasmEnableEmEH
llvm::WebAssembly::getStackOpcode
int getStackOpcode(unsigned short Opcode)