38 #define DEBUG_TYPE "wasm-lower" 56 Subtarget->
hasAddr64() ? WebAssembly::SP64 : WebAssembly::SP32);
214 if (
MVT(
T) != MemT) {
254 WebAssemblyTargetLowering::shouldExpandAtomicRMWInIR(
AtomicRMWInst *AI)
const {
270 FastISel *WebAssemblyTargetLowering::createFastISel(
275 bool WebAssemblyTargetLowering::isOffsetFoldingLegal(
281 MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(
const DataLayout & ,
284 if (BitWidth > 1 && BitWidth < 8)
292 "32-bit shift counts ought to be enough for anyone");
297 "Unable to represent scalar shift amount type");
307 bool IsUnsigned,
bool Int64,
308 bool Float64,
unsigned LoweredOpcode) {
314 unsigned Abs = Float64 ? WebAssembly::ABS_F64 : WebAssembly::ABS_F32;
315 unsigned FConst = Float64 ? WebAssembly::CONST_F64 : WebAssembly::CONST_F32;
316 unsigned LT = Float64 ? WebAssembly::LT_F64 : WebAssembly::LT_F32;
317 unsigned GE = Float64 ? WebAssembly::GE_F64 : WebAssembly::GE_F32;
318 unsigned IConst = Int64 ? WebAssembly::CONST_I64 : WebAssembly::CONST_I32;
319 unsigned Eqz = WebAssembly::EQZ_I32;
320 unsigned And = WebAssembly::AND_I32;
321 int64_t Limit = Int64 ?
INT64_MIN : INT32_MIN;
322 int64_t Substitute = IsUnsigned ? 0 : Limit;
323 double CmpVal = IsUnsigned ? -(double)Limit * 2.0 : -(
double)Limit;
348 unsigned Tmp0, Tmp1, CmpReg, EqzReg, FalseReg, TrueReg;
362 BuildMI(BB, DL, TII.
get(Abs), Tmp0).addReg(InReg);
371 unsigned SecondCmpReg =
381 BuildMI(BB, DL, TII.
get(Eqz), EqzReg).addReg(CmpReg);
385 BuildMI(BB, DL, TII.
get(WebAssembly::BR_IF)).addMBB(TrueMBB).
addReg(EqzReg);
386 BuildMI(FalseMBB, DL, TII.
get(LoweredOpcode), FalseReg).addReg(InReg);
388 BuildMI(TrueMBB, DL, TII.
get(IConst), TrueReg).addImm(Substitute);
389 BuildMI(*DoneMBB, DoneMBB->
begin(), DL, TII.
get(TargetOpcode::PHI), OutReg)
406 case WebAssembly::FP_TO_SINT_I32_F32:
407 return LowerFPToInt(MI, DL, BB, TII,
false,
false,
false,
408 WebAssembly::I32_TRUNC_S_F32);
409 case WebAssembly::FP_TO_UINT_I32_F32:
410 return LowerFPToInt(MI, DL, BB, TII,
true,
false,
false,
411 WebAssembly::I32_TRUNC_U_F32);
412 case WebAssembly::FP_TO_SINT_I64_F32:
413 return LowerFPToInt(MI, DL, BB, TII,
false,
true,
false,
414 WebAssembly::I64_TRUNC_S_F32);
415 case WebAssembly::FP_TO_UINT_I64_F32:
417 WebAssembly::I64_TRUNC_U_F32);
418 case WebAssembly::FP_TO_SINT_I32_F64:
419 return LowerFPToInt(MI, DL, BB, TII,
false,
false,
true,
420 WebAssembly::I32_TRUNC_S_F64);
421 case WebAssembly::FP_TO_UINT_I32_F64:
423 WebAssembly::I32_TRUNC_U_F64);
424 case WebAssembly::FP_TO_SINT_I64_F64:
426 WebAssembly::I64_TRUNC_S_F64);
427 case WebAssembly::FP_TO_UINT_I64_F64:
429 WebAssembly::I64_TRUNC_U_F64);
435 WebAssemblyTargetLowering::getTargetNodeName(
unsigned Opcode)
const {
436 switch (static_cast<WebAssemblyISD::NodeType>(Opcode)) {
439 #define HANDLE_NODETYPE(NODE) \ 440 case WebAssemblyISD::NODE: \ 441 return "WebAssemblyISD::" #NODE; 442 #include "WebAssemblyISD.def" 443 #undef HANDLE_NODETYPE 448 std::pair<unsigned, const TargetRegisterClass *>
449 WebAssemblyTargetLowering::getRegForInlineAsmConstraint(
453 if (Constraint.
size() == 1) {
454 switch (Constraint[0]) {
459 return std::make_pair(0U, &WebAssembly::V128RegClass);
463 return std::make_pair(0U, &WebAssembly::I32RegClass);
465 return std::make_pair(0U, &WebAssembly::I64RegClass);
476 bool WebAssemblyTargetLowering::isCheapToSpeculateCttz()
const {
481 bool WebAssemblyTargetLowering::isCheapToSpeculateCtlz()
const {
486 bool WebAssemblyTargetLowering::isLegalAddressingMode(
const DataLayout &DL,
488 Type *Ty,
unsigned AS,
504 bool WebAssemblyTargetLowering::allowsMisalignedMemoryAccesses(
505 EVT ,
unsigned ,
unsigned ,
bool *
Fast)
const {
517 bool WebAssemblyTargetLowering::isIntDivCheap(
EVT VT,
524 EVT WebAssemblyTargetLowering::getSetCCResultType(
const DataLayout &DL,
533 bool WebAssemblyTargetLowering::getTgtMemIntrinsic(IntrinsicInfo &
Info,
536 unsigned Intrinsic)
const {
601 WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI,
613 "WebAssembly doesn't support language-specific or target-specific " 614 "calling conventions yet");
615 if (CLI.IsPatchPoint)
616 fail(DL, DAG,
"WebAssembly doesn't support patch point yet");
622 (CLI.CS && CLI.CS.isMustTailCall()))
623 fail(DL, DAG,
"WebAssembly doesn't support tail call yet");
624 CLI.IsTailCall =
false;
628 fail(DL, DAG,
"WebAssembly doesn't support more than 1 returned value yet");
633 for (
unsigned i = 0; i < Outs.
size(); ++i) {
637 fail(DL, DAG,
"WebAssembly hasn't implemented nest arguments");
639 fail(DL, DAG,
"WebAssembly hasn't implemented inalloca arguments");
641 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs arguments");
643 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs last arguments");
662 bool IsVarArg = CLI.IsVarArg;
672 for (
unsigned I = NumFixedArgs; I < Outs.
size(); ++
I) {
679 Layout.getABITypeAlignment(Ty));
680 unsigned Offset = CCInfo.AllocateStack(Layout.getTypeAllocSize(Ty),
688 unsigned NumBytes = CCInfo.getAlignedCallFrameSize();
691 if (IsVarArg && NumBytes) {
695 Layout.getStackAlignment(),
701 assert(ArgLocs[ValNo].getValNo() == ValNo &&
702 "ArgLocs should remain in order and only hold varargs args");
703 unsigned Offset = ArgLocs[ValNo++].getLocMemOffset();
713 }
else if (IsVarArg) {
731 for (
const auto &
In : Ins) {
732 assert(!
In.Flags.isByVal() &&
"byval is not valid for return values");
733 assert(!
In.Flags.isNest() &&
"nest is not valid for return values");
734 if (
In.Flags.isInAlloca())
735 fail(DL, DAG,
"WebAssembly hasn't implemented inalloca return values");
736 if (
In.Flags.isInConsecutiveRegs())
737 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs return values");
738 if (
In.Flags.isInConsecutiveRegsLast())
740 "WebAssembly hasn't implemented cons regs last return values");
748 DAG.
getNode(Ins.empty() ? WebAssemblyISD::CALL0 : WebAssemblyISD::CALL1,
760 bool WebAssemblyTargetLowering::CanLowerReturn(
765 return Outs.
size() <= 1;
768 SDValue WebAssemblyTargetLowering::LowerReturn(
773 assert(Outs.
size() <= 1 &&
"WebAssembly can only return up to one value");
775 fail(DL, DAG,
"WebAssembly doesn't support non-C calling conventions");
783 assert(!Out.Flags.isByVal() &&
"byval is not valid for return values");
784 assert(!Out.Flags.isNest() &&
"nest is not valid for return values");
785 assert(Out.IsFixed &&
"non-fixed return value is not valid");
786 if (Out.Flags.isInAlloca())
787 fail(DL, DAG,
"WebAssembly hasn't implemented inalloca results");
788 if (Out.Flags.isInConsecutiveRegs())
789 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs results");
790 if (Out.Flags.isInConsecutiveRegsLast())
791 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs last results");
797 SDValue WebAssemblyTargetLowering::LowerFormalArguments(
802 fail(DL, DAG,
"WebAssembly doesn't support non-C calling conventions");
812 if (
In.Flags.isInAlloca())
813 fail(DL, DAG,
"WebAssembly hasn't implemented inalloca arguments");
814 if (
In.Flags.isNest())
815 fail(DL, DAG,
"WebAssembly hasn't implemented nest arguments");
816 if (
In.Flags.isInConsecutiveRegs())
817 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs arguments");
818 if (
In.Flags.isInConsecutiveRegsLast())
819 fail(DL, DAG,
"WebAssembly hasn't implemented cons regs last arguments");
828 MFI->addParam(
In.VT);
835 unsigned VarargVreg =
837 MFI->setVarargBufferVreg(VarargVreg);
839 Chain, DL, VarargVreg,
840 DAG.
getNode(WebAssemblyISD::ARGUMENT, DL, PtrVT,
842 MFI->addParam(PtrVT);
850 for (
MVT VT : Results)
854 assert(MFI->getParams().size() == Params.
size() &&
855 std::equal(MFI->getParams().begin(), MFI->getParams().end(),
873 return LowerFrameIndex(Op, DAG);
875 return LowerGlobalAddress(Op, DAG);
877 return LowerExternalSymbol(Op, DAG);
879 return LowerJumpTable(Op, DAG);
881 return LowerBR_JT(Op, DAG);
883 return LowerVASTART(Op, DAG);
886 fail(DL, DAG,
"WebAssembly hasn't implemented computed gotos");
889 fail(DL, DAG,
"WebAssembly hasn't implemented __builtin_return_address");
892 return LowerFRAMEADDR(Op, DAG);
894 return LowerCopyToReg(Op, DAG);
896 return LowerINTRINSIC_WO_CHAIN(Op, DAG);
899 return LowerAccessVectorElement(Op, DAG);
901 return LowerINTRINSIC_VOID(Op, DAG);
903 return LowerSIGN_EXTEND_INREG(Op, DAG);
905 return LowerVECTOR_SHUFFLE(Op, DAG);
909 return LowerShift(Op, DAG);
916 if (isa<FrameIndexSDNode>(Src.
getNode())) {
927 : WebAssembly::COPY_I64,
941 int FI = cast<FrameIndexSDNode>(
Op)->getIndex();
963 const auto *GA = cast<GlobalAddressSDNode>(
Op);
965 assert(GA->getTargetFlags() == 0 &&
966 "Unexpected target flags on generic GlobalAddressSDNode");
967 if (GA->getAddressSpace() != 0)
968 fail(DL, DAG,
"WebAssembly only expects the 0 address space");
975 WebAssemblyTargetLowering::LowerExternalSymbol(
SDValue Op,
978 const auto *ES = cast<ExternalSymbolSDNode>(
Op);
980 assert(ES->getTargetFlags() == 0 &&
981 "Unexpected target flags on generic ExternalSymbolSDNode");
1007 const auto *
JT = cast<JumpTableSDNode>(Op.
getOperand(1));
1009 assert(
JT->getTargetFlags() == 0 &&
"WebAssembly doesn't set target flags");
1013 Ops.push_back(Index);
1019 for (
auto MBB : MBBs)
1039 MFI->getVarargBufferVreg(), PtrVT);
1045 WebAssemblyTargetLowering::LowerINTRINSIC_WO_CHAIN(
SDValue Op,
1047 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
1068 WebAssemblyTargetLowering::LowerINTRINSIC_VOID(
SDValue Op,
1071 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue();
1089 return DAG.
getNode(WebAssemblyISD::THROW, DL,
1106 WebAssemblyTargetLowering::LowerSIGN_EXTEND_INREG(
SDValue Op,
1122 WebAssemblyTargetLowering::LowerVECTOR_SHUFFLE(
SDValue Op,
1137 for (
size_t I = 0, Lanes = Mask.
size(); I < Lanes; ++
I) {
1138 for (
size_t J = 0; J < LaneBytes; ++J) {
1140 uint64_t ByteIndex =
1141 Mask[
I] == -1 ? 0 : (uint64_t)Mask[I] * LaneBytes + J;
1150 WebAssemblyTargetLowering::LowerAccessVectorElement(
SDValue Op,
1154 if (isa<ConstantSDNode>(IdxNode) || IdxNode->
isUndef())
1214 Opcode = WebAssemblyISD::VEC_SHL;
1217 Opcode = WebAssemblyISD::VEC_SHR_S;
1220 Opcode = WebAssemblyISD::VEC_SHR_U;
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
void setFrameAddressIsTaken(bool T)
static MVT getIntegerVT(unsigned BitWidth)
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
This file defines the interfaces that WebAssembly uses to lower LLVM code into a selection DAG...
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
bool isInteger() const
Return true if this is an integer or a vector integer type.
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
static Type * getDoubleTy(LLVMContext &C)
const std::vector< MachineJumpTableEntry > & getJumpTables() const
C - The default llvm calling convention, compatible with C.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Diagnostic information for unsupported feature in backend.
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
BR_CC - Conditional branch.
This class represents lattice values for constants.
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0...
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool isVector() const
Return true if this is a vector value type.
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
Carry-setting nodes for multiple precision addition and subtraction.
static void fail(const SDLoc &DL, SelectionDAG &DAG, const char *msg)
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned getReg() const
getReg - Returns the register number.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
This class represents a function call, abstracting a target machine's calling convention.
void setHasFloatingPointExceptions(bool FPExceptions=true)
Tells the code generator that this target supports floating point exceptions and cares about preservi...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
SDValue getBasicBlock(MachineBasicBlock *MBB)
Function Alias Analysis Results
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
void setBooleanVectorContents(BooleanContent Ty)
Specify how the target extends the result of a vector boolean value from a vector of i1 to a wider ty...
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
unsigned const TargetRegisterInfo * TRI
MachineModuleInfo & getMMI() const
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it...
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
SDValue getMCSymbol(MCSymbol *Sym, EVT VT)
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
Value * getArgOperand(unsigned i) const
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
static SDValue UnrollVectorShift(SDValue Op, SelectionDAG &DAG)
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
amdgpu aa AMDGPU Address space based Alias Analysis Wrapper
void setMaxAtomicSizeInBitsSupported(unsigned SizeInBits)
Set the maximum atomic operation size supported by the backend.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const HexagonInstrInfo * TII
static Type * getFloatTy(LLVMContext &C)
Shift and rotation operations.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
BinOp getOperation() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
uint64_t getConstantOperandVal(unsigned i) const
void setCondCodeAction(ISD::CondCode CC, MVT VT, LegalizeAction Action)
Indicate that the specified condition code is or isn't supported on the target and indicate what to d...
bool isInConsecutiveRegs() const
bool hasUnimplementedSIMD128() const
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
OutputArg - This struct carries flags and a value for a single outgoing (actual) argument or outgoing...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
STACKSAVE - STACKSAVE has one operand, an input chain.
unsigned getSizeInBits() const
Fast - This calling convention attempts to make calls as fast as possible (e.g.
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
This file declares the WebAssembly-specific subclass of TargetMachine.
MachineFunction & getMachineFunction() const
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
SDValue getTargetFrameIndex(int FI, EVT VT)
const TargetMachine & getTarget() const
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
const MCContext & getContext() const
Simple integer binary arithmetic operators.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
static mvt_range integer_vector_valuetypes()
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
amdgpu Simplify well known AMD library false Value * Callee
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
MVT getVectorElementType() const
Analysis containing CSE Info
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
unsigned getByValSize() const
bool IsFixed
IsFixed - Is this a "fixed" value, ie not passed through a vararg "...".
TargetInstrInfo - Interface to description of machine instruction set.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
The memory access is volatile.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
Control flow instructions. These all have token chains.
static bool CallingConvSupported(CallingConv::ID CallConv)
unsigned const MachineRegisterInfo * MRI
MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
LLVM Basic Block Representation.
unsigned getOrigAlign() const
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
size_t size() const
size - Get the array size.
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
SDValue getSplatValue(BitVector *UndefElements=nullptr) const
Returns the splatted value or a null value if this is not a splat.
Carry-using nodes for multiple precision addition and subtraction.
This file provides WebAssembly-specific target descriptions.
unsigned char getTargetFlags() const
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
TRAP - Trapping instruction.
const APInt & getAPIntValue() const
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
static mvt_range vector_valuetypes()
self_iterator getIterator()
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static unsigned NumFixedArgs
uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This class contains a discriminated union of information about pointers in memory operands...
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
WebAssemblyTargetLowering(const TargetMachine &TM, const WebAssemblySubtarget &STI)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags=0)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
static MachineBasicBlock * LowerFPToInt(MachineInstr &MI, DebugLoc DL, MachineBasicBlock *BB, const TargetInstrInfo &TII, bool IsUnsigned, bool Int64, bool Float64, unsigned LoweredOpcode)
This file declares the WebAssembly-specific subclass of TargetSubtarget.
const TargetLowering & getTargetLoweringInfo() const
Iterator for intrusive lists based on ilist_node.
CCState - This class holds information needed while lowering arguments and return values...
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Provides information about what library functions are available for the current target.
const DebugLoc & getDebugLoc() const
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
static mvt_range integer_valuetypes()
unsigned getFrameRegister(const MachineFunction &MF) const override
FunctionType * getFunctionType() const
Returns the FunctionType for me.
void ComputeSignatureVTs(const FunctionType *Ty, const Function &F, const TargetMachine &TM, SmallVectorImpl< MVT > &Params, SmallVectorImpl< MVT > &Results)
Class for arbitrary precision integers.
unsigned getByValAlign() const
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
const WebAssemblyRegisterInfo * getRegisterInfo() const override
amdgpu Simplify well known AMD library false Value Value * Arg
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
BR_JT - Jumptable branch.
Representation of each machine instruction.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
bool isVector() const
Return true if this is a vector value type.
Bitwise operators - logical and, logical or, logical xor.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
LLVM_NODISCARD bool empty() const
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
bool isInConsecutiveRegsLast() const
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
virtual EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const
Return the ValueType of the result of SETCC operations.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
This file declares WebAssembly-specific per-machine-function information.
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static CCValAssign getMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
SDValue getValue(unsigned R) const
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
bool isUndef() const
Return true if the type of the node type undefined.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
const WebAssemblyInstrInfo * getInstrInfo() const override
unsigned getNumOperands() const
const SDValue & getOperand(unsigned i) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
LLVMContext * getContext() const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...