24 #define DEBUG_TYPE "x86-selectiondag-info" 26 bool X86SelectionDAGInfo::isBaseRegConflictPossible(
40 for (
unsigned R : ClobberSet)
56 const MCPhysReg ClobberSet[] = {X86::RCX, X86::RAX, X86::RDI,
58 assert(!isBaseRegConflictPossible(DAG, ClobberSet));
68 if ((Align & 3) != 0 || !ConstantSize ||
69 ConstantSize->
getZExtValue() > Subtarget.getMaxInlineSizeThreshold()) {
73 if (
const char *bzeroName = (ValC && ValC->
isNullValue())
83 Args.push_back(Entry);
85 Args.push_back(Entry);
95 std::pair<SDValue,SDValue> CallResult = TLI.
LowerCallTo(CLI);
96 return CallResult.second;
108 unsigned BytesLeft = 0;
118 Val = (Val << 8) | Val;
123 Val = (Val << 8) | Val;
124 Val = (Val << 16) | Val;
125 if (Subtarget.is64Bit() && ((Align & 0x7) == 0)) {
128 Val = (Val << 32) | Val;
141 BytesLeft = SizeVal % UBytes;
154 bool Use64BitRegs = Subtarget.isTarget64BitLP64();
158 Chain = DAG.
getCopyToReg(Chain, dl, Use64BitRegs ? X86::RDI : X86::EDI,
168 unsigned Offset = SizeVal - BytesLeft;
190 const unsigned CX = Use64BitRegs ? X86::RCX :
X86::ECX;
191 const unsigned DI = Use64BitRegs ? X86::RDI :
X86::EDI;
192 const unsigned SI = Use64BitRegs ? X86::RSI :
X86::ESI;
211 return emitRepmovs(Subtarget, DAG, dl, Chain, Dst, Src,
218 assert((Align != 0) &&
"Align is normalized");
249 return emitRepmovsB(Subtarget, DAG, dl, Chain, Dst, Src, Size);
254 if (!AlwaysInline && (Align & 3) != 0)
259 const uint64_t BlockCount = Size / BlockBytes;
260 const uint64_t BytesLeft = Size % BlockBytes;
269 assert(BytesLeft &&
"We have leftover at this point");
274 return emitRepmovsB(Subtarget, DAG, dl, Chain, Dst, Src, Size);
279 unsigned Offset = Size - BytesLeft;
302 const MCPhysReg ClobberSet[] = {X86::RCX, X86::RSI, X86::RDI,
304 if (isBaseRegConflictPossible(DAG, ClobberSet))
311 if (
ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size))
313 ConstantSize->getZExtValue(),
315 AlwaysInline, DstPtrInfo, SrcPtrInfo);
static SDValue emitConstantSizeRepmov(SelectionDAG &DAG, const X86Subtarget &Subtarget, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, EVT SizeVT, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Returns a REP MOVS instruction, possibly with a few load/stores to implement a constant size memory c...
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
Repeat move, corresponds to X86::REP_MOVSx.
This class represents lattice values for constants.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void push_back(const T &Elt)
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memcpy.
Function Alias Analysis Results
C - The default llvm calling convention, compatible with C.
unsigned const TargetRegisterInfo * TRI
static SDValue emitRepmovs(const X86Subtarget &Subtarget, SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, MVT AVT)
Emit a single REP MOVS{B,W,D,Q} instruction.
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
static MVT getOptimalRepmovsType(const X86Subtarget &Subtarget, uint64_t Align)
Returns the best type to use with repmovs depending on alignment.
SDValue getExternalSymbol(const char *Sym, EVT VT)
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
bool isTarget64BitLP64() const
Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
CallLoweringInfo & setChain(SDValue InChain)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
MachineFunction & getMachineFunction() const
Simple integer binary arithmetic operators.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
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.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Repeat fill, corresponds to X86::REP_STOSx.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
static Type * getVoidTy(LLVMContext &C)
virtual 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...
std::vector< ArgListEntry > ArgListTy
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
This struct is a compact representation of a valid (non-zero power of two) alignment.
unsigned getMaxInlineSizeThreshold() const
Returns the maximum memset / memcpy size that still makes it profitable to inline the call...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
const TargetLowering & getTargetLoweringInfo() const
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...
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)
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MachinePointerInfo getWithOffset(int64_t O) const
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
BlockType
Used as immediate MachineOperands for block signatures.
const TargetSubtargetInfo & getSubtarget() const
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
SDValue getValue(unsigned R) const
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())
SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const override
Emit target-specific code that performs a memset.
SDValue getValueType(EVT)
static SDValue emitRepmovsB(const X86Subtarget &Subtarget, SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size)
Emit a single REP MOVSB instruction for a particular constant size.
static bool isVolatile(Instruction *Inst)
uint64_t getZExtValue() const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo)
LLVMContext * getContext() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
Wrapper class representing virtual and physical registers.
This file describes how to lower LLVM code to machine code.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
Register getBaseRegister() const