34 WebAssemblyMCInstLower::GetGlobalAddressSymbol(
const MachineOperand &MO)
const {
38 if (
const auto *FuncTy = dyn_cast<FunctionType>(Global->
getValueType())) {
54 if (ResultMVTs.
size() <= 1)
55 for (
MVT ResultMVT : ResultMVTs)
60 for (
Type *Ty : FuncTy->params()) {
63 for (
MVT ParamMVT : ParamMVTs)
67 if (FuncTy->isVarArg())
78 MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol(
89 if (strcmp(Name,
"__stack_pointer") == 0) {
130 if (RC == &WebAssembly::I32RegClass)
132 if (RC == &WebAssembly::I64RegClass)
134 if (RC == &WebAssembly::F32RegClass)
136 if (RC == &WebAssembly::F64RegClass)
216 "WebAssembly does not use target flags on GlobalAddresses");
217 MCOp = LowerSymbolOperand(GetGlobalAddressSymbol(MO), MO.
getOffset(),
224 "WebAssembly uses only one target flag bit on ExternalSymbols");
225 MCOp = LowerSymbolOperand(GetExternalSymbolSymbol(MO), 0,
unsigned getTargetFlags() const
void push_back(const T &Elt)
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.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Compute iterated dominance frontiers using a linear time algorithm.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static MCOperand createExpr(const MCExpr *Val)
Describe properties that are true of each instruction in the target description file.
unsigned getReg() const
getReg - Returns the register number.
void setGlobalType(wasm::WasmGlobalType GT)
This file declares the class to lower WebAssembly MachineInstrs to their corresponding MCInst records...
float convertToFloat() const
void setParams(SmallVectorImpl< wasm::ValType > &&Pars)
MachineBasicBlock reference.
static MCOperand createReg(unsigned Reg)
const ConstantFP * getFPImm() const
unsigned getNumOperands() const
Access to explicit operands of the instruction.
void ComputeLegalValueVTs(const Function &F, const TargetMachine &TM, Type *Ty, SmallVectorImpl< MVT > &ValueVTs)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Base class for the full range of assembler expressions which are needed for parsing.
Name of external global symbol.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const char * getSymbolName() const
uint8_t OperandType
Information about the type of the operand.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Type * getType() const
All values are typed, get the type of this value.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
wasm::ValType toValType(const MVT &Ty)
Instances of this class represent a single low-level machine instruction.
unsigned short NumOperands
This file contains the declaration of the WebAssembly-specific utility functions. ...
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Address of a global value.
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This file provides signature information for runtime libcalls.
const WebAssemblySubtarget & getSubtarget() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const GlobalValue * getGlobal() const
ConstantFP - Floating Point Values [float, double].
double convertToDouble() const
void setReturns(SmallVectorImpl< wasm::ValType > &&Rets)
iterator_range< mop_iterator > defs()
Returns a range over all explicit operands that are register definitions.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
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.
type signature immediate for call_indirect.
static wasm::ValType getType(const TargetRegisterClass *RC)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setType(wasm::WasmSymbolType type)
iterator_range< mop_iterator > explicit_uses()
const APFloat & getValueAPF() const
void Lower(const MachineInstr *MI, MCInst &OutMI) const
void setOpcode(unsigned Op)
MCSymbol * getSymbol(const GlobalValue *GV) const
MachineOperand class - Representation of each machine instruction operand.
static MCOperand createFPImm(double Val)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool isFunctionTy() const
True if this is an instance of FunctionType.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
int64_t getOffset() const
Return the offset from the symbol in this operand.
This file declares WebAssembly-specific per-machine-function information.
Type * getValueType() const
unsigned getWAReg(unsigned VReg) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Floating-point immediate operand.
const MCOperandInfo * OpInfo
Primary interface to the complete machine description for the target machine.
void addOperand(const MCOperand &Op)
void GetSignature(const WebAssemblySubtarget &Subtarget, RTLIB::Libcall LC, SmallVectorImpl< wasm::ValType > &Rets, SmallVectorImpl< wasm::ValType > &Params)
bool isCallIndirect(const MachineInstr &MI)
This holds information about one operand of a machine instruction, indicating the register class for ...
const MachineOperand & getOperand(unsigned i) const
Instances of this class represent operands of the MCInst class.
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
MCSymbol * createTempSymbol(const Twine &Name) const
static MCOperand createImm(int64_t Val)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)