15 #ifndef LLVM_LIB_TARGET_X86_X86ISELLOWERING_H 16 #define LLVM_LIB_TARGET_X86_X86ISELLOWERING_H 25 class X86TargetMachine;
654 bool hasSymbolicDisplacement =
true);
659 bool is64Bit,
bool IsVarArg,
bool GuaranteeTCO);
670 unsigned getJumpTableEncoding()
const override;
671 bool useSoftFloat()
const override;
690 unsigned JTI,
MCContext &Ctx)
const override;
696 unsigned getByValTypeAlignment(
Type *Ty,
710 EVT getOptimalMemOpType(uint64_t
Size,
unsigned DstAlign,
unsigned SrcAlign,
711 bool IsMemset,
bool ZeroMemset,
bool MemcpyStrSrc,
720 bool isSafeMemOpType(
MVT VT)
const override;
724 bool allowsMisalignedMemoryAccesses(
EVT VT,
unsigned AS,
unsigned Align,
725 bool *
Fast)
const override;
735 void LowerOperationWrapper(
SDNode *
N,
757 bool isDesirableToCombineBuildVectorToShuffleTruncate(
764 bool isTypeDesirableForOp(
unsigned Opc,
EVT VT)
const override;
770 bool IsDesirableToPromoteOp(
SDValue Op,
EVT &PVT)
const override;
777 const char *getTargetNodeName(
unsigned Opcode)
const override;
784 bool isCheapToSpeculateCttz()
const override;
786 bool isCheapToSpeculateCtlz()
const override;
788 bool isCtlzFast()
const override;
810 bool isMaskAndCmp0FoldingBeneficial(
const Instruction &AndI)
const override;
812 bool hasAndNotCompare(
SDValue Y)
const override;
814 bool hasAndNot(
SDValue Y)
const override;
816 bool preferShiftsToClearExtremeBits(
SDValue Y)
const override;
820 unsigned KeptBits)
const override {
825 auto VTIsOk = [](
EVT VT) ->
bool {
833 return VTIsOk(XVT) && VTIsOk(KeptBitsVT);
841 MVT hasFastEqualityCompare(
unsigned NumBits)
const override;
850 EVT VT)
const override;
852 bool targetShrinkDemandedConstant(
SDValue Op,
const APInt &Demanded,
857 void computeKnownBitsForTargetNode(
const SDValue Op,
859 const APInt &DemandedElts,
861 unsigned Depth = 0)
const override;
864 unsigned ComputeNumSignBitsForTargetNode(
SDValue Op,
865 const APInt &DemandedElts,
867 unsigned Depth)
const override;
872 int64_t &
Offset)
const override;
876 bool ExpandInlineAsm(
CallInst *CI)
const override;
884 const char *constraint)
const override;
886 const char *LowerXConstraint(
EVT ConstraintVT)
const override;
891 void LowerAsmOperandForConstraint(
SDValue Op,
892 std::string &Constraint,
893 std::vector<SDValue> &Ops,
898 if (ConstraintCode ==
"i")
900 else if (ConstraintCode ==
"o")
902 else if (ConstraintCode ==
"v")
904 else if (ConstraintCode ==
"X")
913 std::pair<unsigned, const TargetRegisterClass *>
920 Type *Ty,
unsigned AS,
927 bool isLegalICmpImmediate(int64_t Imm)
const override;
933 bool isLegalAddImmediate(int64_t Imm)
const override;
941 unsigned AS)
const override;
943 bool isVectorShiftByScalarCheap(
Type *Ty)
const override;
948 bool isTruncateFree(
Type *Ty1,
Type *Ty2)
const override;
949 bool isTruncateFree(
EVT VT1,
EVT VT2)
const override;
951 bool allowTruncateForTailCall(
Type *Ty1,
Type *Ty2)
const override;
961 bool isZExtFree(
Type *Ty1,
Type *Ty2)
const override;
962 bool isZExtFree(
EVT VT1,
EVT VT2)
const override;
963 bool isZExtFree(
SDValue Val,
EVT VT2)
const override;
967 bool isVectorLoadExtDesirable(
SDValue)
const override;
972 bool isFMAFasterThanFMulAndFAdd(
EVT VT)
const override;
977 bool isNarrowingProfitable(
EVT VT1,
EVT VT2)
const override;
985 unsigned Intrinsic)
const override;
990 bool isFPImmLegal(
const APFloat &Imm,
EVT VT)
const override;
1004 bool areJTsAllowed(
const Function *Fn)
const override;
1013 return !X86ScalarSSEf64 || VT ==
MVT::f80;
1019 EVT NewVT)
const override;
1024 return (VT ==
MVT::f64 && X86ScalarSSEf64) ||
1025 (VT ==
MVT::f32 && X86ScalarSSEf32);
1030 bool shouldConvertConstantLoadToIntImm(
const APInt &Imm,
1031 Type *Ty)
const override;
1033 bool convertSelectOfConstantsToMath(
EVT VT)
const override;
1037 bool isExtractSubvectorCheap(
EVT ResVT,
EVT SrcVT,
1038 unsigned Index)
const override;
1041 unsigned AddrSpace)
const override {
1047 bool isLoadBitCastBeneficial(
EVT LoadVT,
EVT BitcastVT)
const override;
1054 unsigned getRegisterByName(
const char* RegName,
EVT VT,
1060 getExceptionPointerRegister(
const Constant *PersonalityFn)
const override;
1065 getExceptionSelectorRegister(
const Constant *PersonalityFn)
const override;
1067 virtual bool needsFixedCatchObjects()
const override;
1078 bool useLoadStackGuardNode()
const override;
1079 bool useStackGuardXorFP()
const override;
1080 void insertSSPDeclarations(
Module &M)
const override;
1081 Value *getSDagStackGuard(
const Module &M)
const override;
1082 Value *getSSPStackGuardCheck(
const Module &M)
const override;
1084 const SDLoc &DL)
const override;
1095 bool isNoopAddrSpaceCast(
unsigned SrcAS,
unsigned DestAS)
const override;
1101 EVT VT)
const override;
1103 unsigned getNumRegistersForCallingConv(
LLVMContext &Context,
1105 EVT VT)
const override;
1109 bool supportSwiftError()
const override;
1119 bool lowerInterleavedLoad(
LoadInst *LI,
1122 unsigned Factor)
const override;
1127 unsigned Factor)
const override;
1134 std::pair<const TargetRegisterClass *, uint8_t>
1136 MVT VT)
const override;
1146 bool X86ScalarSSEf32;
1147 bool X86ScalarSSEf64;
1150 std::vector<APFloat> LegalFPImmediates;
1154 void addLegalFPImmediate(
const APFloat& Imm) {
1155 LegalFPImmediates.push_back(Imm);
1181 bool isCalleeStructRet,
1182 bool isCallerStructRet,
1189 SDValue Chain,
bool IsTailCall,
1190 bool Is64Bit,
int FPDiff,
1191 const SDLoc &dl)
const;
1193 unsigned GetAlignedArgumentStackSize(
unsigned StackSize,
1196 unsigned getAddressSpace(
void)
const;
1200 bool isReplace)
const;
1207 unsigned getGlobalWrapperKind(
const GlobalValue *GV =
nullptr,
1208 const unsigned char OpFlags = 0)
const;
1262 void insertCopiesSplitCSR(
1266 bool isUsedByReturnOnly(
SDNode *N,
SDValue &Chain)
const override;
1268 bool mayBeEmittedAsTailCall(
const CallInst *CI)
const override;
1281 shouldExpandAtomicLoadInIR(
LoadInst *SI)
const override;
1282 bool shouldExpandAtomicStoreInIR(
StoreInst *SI)
const override;
1284 shouldExpandAtomicRMWInIR(
AtomicRMWInst *AI)
const override;
1287 lowerIdempotentRMWIntoFencedLoad(
AtomicRMWInst *AI)
const override;
1289 bool needsCmpXchgNb(
Type *MemType)
const;
1301 EmitVAStartSaveXMMRegsWithCustomInserter(
MachineInstr &BInstr,
1368 int &RefinementSteps,
bool &UseOneConstNR,
1369 bool Reciprocal)
const override;
1373 int &RefinementSteps)
const override;
1376 unsigned combineRepeatedFPDivisors()
const override;
1390 :
MemSDNode(Opcode, Order, dl, VTs, MemVT, MMO) {}
1408 :
MemSDNode(Opcode, Order, dl, VTs, MemVT, MMO) {}
1478 :
MemSDNode(Opc, Order, dl, VTs, MemVT, MMO) {}
1517 template <
typename T =
int>
1520 assert(Mask.
empty() &&
"Expected an empty shuffle mask vector");
1523 for (
int i = 0; i < NumElts; ++i) {
1524 unsigned LaneStart = (i / NumEltsInLane) * NumEltsInLane;
1525 int Pos = (i % NumEltsInLane) / 2 + LaneStart;
1526 Pos += (Unary ? 0 : NumElts * (i % 2));
1527 Pos += (Lo ? 0 : NumEltsInLane / 2);
1536 template <
typename T>
1539 assert(0 < Scale &&
"Unexpected scaling factor");
1540 int NumElts = Mask.
size();
1541 ScaledMask.
assign(static_cast<size_t>(NumElts * Scale), -1);
1543 for (
int i = 0; i != NumElts; ++i) {
1548 for (
int s = 0; s != Scale; ++s)
1549 ScaledMask[(Scale * i) + s] = M;
1554 for (
int s = 0; s != Scale; ++s)
1555 ScaledMask[(Scale * i) + s] = (Scale * M) + s;
1560 #endif // LLVM_LIB_TARGET_X86_X86ISELLOWERING_H static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG)
const SDValue & getIndex() const
Double shift instructions.
bool shouldTransformSignedTruncationCheck(EVT XVT, unsigned KeptBits) const override
Should we tranform the IR-optimal check for whether given truncation down into KeptBits would be trun...
static MVT getIntegerVT(unsigned BitWidth)
static SDValue LowerCallResult(SDValue Chain, SDValue InFlag, const SmallVectorImpl< CCValAssign > &RVLocs, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals)
LowerCallResult - Lower the result values of a call into the appropriate copies out of appropriate ph...
void push_back(const T &Elt)
TruncUSStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
BUILTIN_OP_END - This must be the last enum value in this list.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
Vector comparison generating mask bits for fp and integer signed and unsigned data types...
Repeat move, corresponds to X86::REP_MOVSx.
void createUnpackShuffleMask(MVT VT, SmallVectorImpl< T > &Mask, bool Lo, bool Unary)
Generate unpacklo/unpackhi shuffle mask.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
static bool classof(const SDNode *N)
Return with a flag operand.
const SDValue & getBasePtr() const
Compute iterated dominance frontiers using a linear time algorithm.
const SDValue & getScale() const
Compute Double Block Packed Sum-Absolute-Differences.
A Module instance is used to store all the information related to an LLVM module. ...
bool mergeStoresAfterLegalization() const override
Allow store merging after legalization in addition to before legalization.
static bool classof(const SDNode *N)
Same as call except it adds the NoTrack prefix.
static void LowerMemOpCallTo(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain, SDValue Arg, SDValue PtrOff, int SPDiff, unsigned ArgOffset, bool isPPC64, bool isTailCall, bool isVector, SmallVectorImpl< SDValue > &MemOpChains, SmallVectorImpl< TailCallArgumentInfo > &TailCallArguments, const SDLoc &dl)
LowerMemOpCallTo - Store the argument to the stack or remember it in case of tail calls...
bool isMultiStoresCheaperThanBitsMerge(EVT LTy, EVT HTy) const override
Return true if it is cheaper to split the store of a merged int val from a pair of smaller values int...
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
This class represents a function call, abstracting a target machine's calling convention.
unsigned getVectorNumElements() const
Function Alias Analysis Results
This instruction constructs a fixed permutation of two input vectors.
const SDValue & getValue() const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
unsigned const TargetRegisterInfo * TRI
bool isInteger() const
Return true if this is an integer or a vector integer type.
static bool classof(const SDNode *N)
SSE4A Extraction and Insertion.
static bool classof(const SDNode *N)
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
Bitwise logical ANDNOT of floating point values.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
bool isCalleePop(CallingConv::ID CallingConv, bool is64Bit, bool IsVarArg, bool GuaranteeTCO)
Determines whether the callee is required to pop its own arguments.
This operation implements the lowering for readcyclecounter.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
X86MaskedGatherScatterSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
X86 compare and logical compare instructions.
MaskedTruncUSStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
Extract an 8-bit value from a vector and zero extend it to i32, corresponds to X86::PEXTRB.
A description of a memory reference used in the backend.
X86StoreSDNode(unsigned Opcode, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
Bitwise Logical AND NOT of Packed FP values.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
This instruction implements SINT_TO_FP with the integer source in memory and FP reg result...
static SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, const SparcSubtarget *Subtarget)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Integer horizontal add/sub.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
Copies a 64-bit value from the low word of an XMM vector to an MMX vector.
void assign(size_type NumElts, const T &Elt)
Context object for machine code objects.
static SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG)
Copies a 32-bit value from the low word of a MMX vector to a GPR.
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
X86 FP SETCC, similar to above, but with output as an i1 mask and with optional rounding mode...
Return from interrupt. Operand 0 is the number of bytes to pop.
This contains information for each constraint that we are lowering.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const SDValue & getMask() const
An instruction for storing to memory.
static bool classof(const SDNode *N)
X86 FP SETCC, implemented with CMP{cc}SS/CMP{cc}SD.
const SDValue & getBasePtr() const
virtual unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const
Floating point horizontal add/sub.
unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const override
amdgpu Simplify well known AMD library false Value * Callee
Bitwise logical XOR of floating point values.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
static bool classof(const SDNode *N)
const SDValue & getMask() const
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
The instances of the Type class are immutable: once they are created, they are never changed...
This instruction implements an extending load to FP stack slots.
This is an important class for using LLVM in a threaded context.
Insert any element of a 4 x float vector into any element of a destination 4 x floatvector.
unsigned getScalarSizeInBits() const
size_t size() const
size - Get the array size.
This is an important base class in LLVM.
Repeat fill, corresponds to X86::REP_STOSx.
static bool is64Bit(const char *name)
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
bool storeOfVectorConstantIsCheap(EVT MemVT, unsigned NumElem, unsigned AddrSpace) const override
Return true if it is expected to be cheaper to do a store of a non-zero vector constant with the give...
X86 conditional branches.
Insert the lower 16-bits of a 32-bit value to a vector, corresponds to X86::PINSRW.
Commutative FMIN and FMAX.
static SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
On Darwin, this node represents the result of the popl at function entry, used for PIC code...
bool convertSetCCLogicToBitwiseLogic(EVT VT) const override
Use bitwise logic to make pairs of compares more efficient.
static SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
const SDValue & getValue() const
static SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
std::vector< ArgListEntry > ArgListTy
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This structure contains all information that is necessary for lowering calls.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
These operations represent an abstract X86 call instruction, which includes a bunch of information...
Floating point max and min.
static SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG)
TruncSStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
bool isScalarFPTypeInSSEReg(EVT VT) const
Return true if the specified scalar FP type is computed in an SSE register, not on the X87 floating p...
Copies a GPR into the low 32-bit word of a MMX vector and zero out the high word. ...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
Provides information about what library functions are available for the current target.
X86 Read Time-Stamp Counter and Processor ID.
CCValAssign - Represent assignment of one arg/retval to a location.
unsigned getMemcmpEqZeroLoadsPerBlock() const override
Allow multiple load pairs per block for smaller and faster code.
X86MaskedScatterSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
This is an abstract virtual class for memory operations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Floating point reciprocal-sqrt and reciprocal approximation.
static const int FIRST_TARGET_MEMORY_OPCODE
FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations which do not reference a specific me...
const SDValue & getValue() const
Represents one node in the SelectionDAG.
X86 bit-test instructions.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
static bool classof(const SDNode *N)
MaskedTruncSStoreSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
Class for arbitrary precision integers.
static SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG)
static bool classof(const SDNode *N)
This instruction implements FP_TO_SINT with the integer destination in memory and a FP reg source...
const char * getClearCacheBuiltinName() const override
Intel processors have a unified instruction and data cache.
amdgpu Simplify well known AMD library false Value Value * Arg
bool ShouldShrinkFPConstant(EVT VT) const override
If true, then instruction selection should seek to shrink the FP constant of the specified type to a ...
Representation of each machine instruction.
static unsigned getScalingFactorCost(const TargetTransformInfo &TTI, const LSRUse &LU, const Formula &F, const Loop &L)
bool isVector() const
Return true if this is a vector value type.
Insert the lower 8-bits of a 32-bit value to a vector, corresponds to X86::PINSRB.
LLVM_NODISCARD bool empty() const
A wrapper node for TargetConstantPool, TargetJumpTable, TargetExternalSymbol, TargetGlobalAddress, TargetGlobalTLSAddress, MCSymbol and TargetBlockAddress.
Bitwise logical AND of floating point values.
static bool isSigned(Value *V)
Can the given value generate sign bits.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
static bool classof(const SDNode *N)
X86MaskedStoreSDNode(unsigned Opcode, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
LOCK-prefixed arithmetic read-modify-write instructions.
Extract a 16-bit value from a vector and zero extend it to i32, corresponds to X86::PEXTRW.
bool hasVectorBlend() const override
Return true if the target has a vector blend instruction.
Blend where the selector is an immediate.
X86MaskedGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemVT, MachineMemOperand *MMO)
This instruction implements a truncating store to FP stack slots.
Combined add and sub on an FP vector.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
This instruction grabs the address of the next argument from a va_list.
LLVM Value Representation.
Bitwise logical OR of floating point values.
Dynamic (non-constant condition) vector blend where only the sign bits of the condition elements are ...
X86 Read Performance Monitoring Counters.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
const SDValue & getBasePtr() const
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.
static SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
bool isZeroNode(SDValue Elt)
Returns true if Elt is a constant zero or floating point constant +0.0.
StringRef - Represent a constant reference to a string, i.e.
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M, bool hasSymbolicDisplacement=true)
Returns true of the given offset can be fit into displacement field of the instruction.
bool hasBitPreservingFPLogic(EVT VT) const override
Return true if it is safe to transform an integer-domain bitwise operation into the equivalent floati...
Compute Sum of Absolute Differences.
Scalar intrinsic floating point max and min.
MVT getScalarShiftAmountTy(const DataLayout &, EVT VT) const override
EVT is not used in-tree, but is used by out-of-tree target.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
void scaleShuffleMask(int Scale, ArrayRef< T > Mask, SmallVectorImpl< T > &ScaledMask)
Helper function to scale a shuffle or target shuffle mask, replacing each mask index with the scaled ...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
BRIND node with NoTrack prefix.
Shuffle 16 8-bit values within a vector.
This file describes how to lower LLVM code to machine code.
Special wrapper used under X86-64 PIC mode for RIP relative displacements.