35 WebAssemblyMCInstLower::GetGlobalAddressSymbol(
const MachineOperand &MO)
const {
38 if (isa<MCSymbolELF>(Sym))
43 if (
const auto *FuncTy = dyn_cast<FunctionType>(Global->
getValueType())) {
59 if (ResultMVTs.
size() <= 1)
60 for (
MVT ResultMVT : ResultMVTs)
65 for (
Type *Ty : FuncTy->params()) {
68 for (
MVT ParamMVT : ParamMVTs)
72 if (FuncTy->isVarArg())
83 MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol(
87 if (isa<MCSymbolELF>(Sym))
95 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)
172 if (!isa<MCSymbolELF>(Sym)) {
219 "WebAssembly does not use target flags on GlobalAddresses");
220 MCOp = LowerSymbolOperand(GetGlobalAddressSymbol(MO), MO.
getOffset(),
227 "WebAssembly uses only one target flag bit on ExternalSymbols");
228 MCOp = LowerSymbolOperand(GetExternalSymbolSymbol(MO), 0,
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
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 GlobalValue * getGlobal() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol * getSymbol(const GlobalValue *GV) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
const ConstantFP * getFPImm() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
float convertToFloat() const
static MCOperand createExpr(const MCExpr *Val)
Describe properties that are true of each instruction in the target description file.
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
Type * getValueType() const
This file declares the class to lower WebAssembly MachineInstrs to their corresponding MCInst records...
void setParams(SmallVectorImpl< wasm::ValType > &&Pars)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
MachineBasicBlock reference.
const char * getSymbolName() const
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
void print(raw_ostream &OS, bool SkipOpers=false, bool SkipDebugLoc=false, const TargetInstrInfo *TII=nullptr) const
Debugging supportPrint this MI to OS.
const WebAssemblySubtarget & getSubtarget() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static MCOperand createReg(unsigned Reg)
void ComputeLegalValueVTs(const Function &F, const TargetMachine &TM, Type *Ty, SmallVectorImpl< MVT > &ValueVTs)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Base class for the full range of assembler expressions which are needed for parsing.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
Name of external global symbol.
unsigned getNumOperands() const
Access to explicit operands of the instruction.
uint8_t OperandType
Information about the type of the operand.
unsigned getWAReg(unsigned Reg) const
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 getOpcode() const
Returns the opcode of this MachineInstr.
unsigned short NumOperands
const MachineBasicBlock * getParent() const
This file contains the declaration of the WebAssembly-specific utility functions. ...
Address of a global value.
unsigned getTargetFlags() const
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
This file provides signature information for runtime libcalls.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MachineOperand & getOperand(unsigned i) const
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
ConstantFP - Floating Point Values [float, double].
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...
int64_t getOffset() const
Return the offset from the symbol in this operand.
type signature immediate for call_indirect.
static wasm::ValType getType(const TargetRegisterClass *RC)
iterator_range< mop_iterator > explicit_uses()
void setIsFunction(bool isFunc)
void setOpcode(unsigned Op)
bool isFunctionTy() const
True if this is an instance of FunctionType.
MachineOperand class - Representation of each machine instruction operand.
Type * getType() const
All values are typed, get the type of this value.
MCSymbol * createTempSymbol(const Twine &Name) const
static MCOperand createFPImm(double Val)
void Lower(const MachineInstr *MI, MCInst &OutMI) const
double convertToDouble() const
llvm_unreachable("Unknown RegBank!")
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.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
This file declares WebAssembly-specific per-machine-function information.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const APFloat & getValueAPF() const
unsigned getReg() const
getReg - Returns the register number.
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 ...
Instances of this class represent operands of the MCInst class.
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
static MCOperand createImm(int64_t Val)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)