25 #define DEBUG_TYPE "x86-selectiondag-info"
27 bool X86SelectionDAGInfo::isBaseRegConflictPossible(
41 for (
unsigned R : ClobberSet)
52 struct RepMovsRepeats {
53 RepMovsRepeats(uint64_t
Size) : Size(Size) {}
55 uint64_t Count()
const {
return Size / UBytes(); }
56 uint64_t BytesLeft()
const {
return Size % UBytes(); }
57 uint64_t UBytes()
const {
return AVT.getSizeInBits() / 8; }
75 const MCPhysReg ClobberSet[] = {X86::RCX, X86::RAX, X86::RDI,
76 X86::ECX, X86::EAX, X86::EDI};
77 assert(!isBaseRegConflictPossible(DAG, ClobberSet));
87 if ((Align & 3) != 0 || !ConstantSize ||
88 ConstantSize->
getZExtValue() > Subtarget.getMaxInlineSizeThreshold()) {
92 if (
const char *bzeroEntry = ValC &&
93 ValC->
isNullValue() ? Subtarget.getBZeroEntry() :
nullptr) {
101 Args.push_back(Entry);
103 Args.push_back(Entry);
113 std::pair<SDValue,SDValue> CallResult = TLI.
LowerCallTo(CLI);
114 return CallResult.second;
126 unsigned BytesLeft = 0;
136 Val = (Val << 8) | Val;
141 Val = (Val << 8) | Val;
142 Val = (Val << 16) | Val;
143 if (Subtarget.is64Bit() && ((Align & 0x7) == 0)) {
146 Val = (Val << 32) | Val;
159 BytesLeft = SizeVal % UBytes;
168 Chain = DAG.
getCopyToReg(Chain, dl, X86::AL, Val, InFlag);
172 Chain = DAG.
getCopyToReg(Chain, dl, Subtarget.is64Bit() ? X86::RCX : X86::ECX,
175 Chain = DAG.
getCopyToReg(Chain, dl, Subtarget.is64Bit() ? X86::RDI : X86::EDI,
185 unsigned Offset = SizeVal - BytesLeft;
186 EVT AddrVT = Dst.getValueType();
214 if (!AlwaysInline && Repeats.Size > Subtarget.getMaxInlineSizeThreshold())
221 if (!AlwaysInline && (Align & 3) != 0)
230 const MCPhysReg ClobberSet[] = {X86::RCX, X86::RSI, X86::RDI,
231 X86::ECX, X86::ESI, X86::EDI};
232 if (isBaseRegConflictPossible(DAG, ClobberSet))
238 if (!Subtarget.hasERMSB() && !(Align & 1)) {
249 if (Repeats.BytesLeft() > 0 &&
258 Chain = DAG.
getCopyToReg(Chain, dl, Subtarget.is64Bit() ? X86::RCX : X86::ECX,
261 Chain = DAG.
getCopyToReg(Chain, dl, Subtarget.is64Bit() ? X86::RDI : X86::EDI,
264 Chain = DAG.
getCopyToReg(Chain, dl, Subtarget.is64Bit() ? X86::RSI : X86::ESI,
274 if (Repeats.BytesLeft()) {
276 unsigned Offset = Repeats.Size - Repeats.BytesLeft();
277 EVT DstVT = Dst.getValueType();
278 EVT SrcVT = Src.getValueType();
289 Align, isVolatile, AlwaysInline,
false,
void push_back(const T &Elt)
SDValue getValue(unsigned R) const
Repeat move, corresponds to X86::REP_MOVSx.
LLVMContext * getContext() const
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.
const TargetSubtargetInfo & getSubtarget() const
Function Alias Analysis Results
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
SDValue getExternalSymbol(const char *Sym, EVT VT)
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFunction & getMachineFunction() const
CallLoweringInfo & setChain(SDValue InChain)
MachinePointerInfo getWithOffset(int64_t O) const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
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.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
Simple integer binary arithmetic operators.
const DataLayout & getDataLayout() const
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
The instances of the Type class are immutable: once they are created, they are never changed...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Repeat fill, corresponds to X86::REP_STOSx.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static Type * getVoidTy(LLVMContext &C)
std::vector< ArgListEntry > ArgListTy
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
unsigned getBaseRegister() const
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...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
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...
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
C - The default llvm calling convention, compatible with C.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
EVT getValueType() const
Return the ValueType of the referenced return value.
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())
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...
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)
const TargetLowering & getTargetLoweringInfo() const
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
static bool isVolatile(Instruction *Inst)
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)
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
This file describes how to lower LLVM code to machine code.
uint64_t getZExtValue() const