Go to the documentation of this file.
18 #define DEBUG_TYPE "systemz-selectiondag-info"
31 Ops = { Chain, Dst, LenAdj, Byte };
33 Ops = { Chain, Dst, Src, LenAdj };
45 assert(Size >= Adj &&
"Adjusted length overflow.");
67 if (
auto *CSize = dyn_cast<ConstantSDNode>(Size))
69 CSize->getZExtValue());
81 for (
unsigned I = 1;
I < Size; ++
I)
82 StoreVal |= ByteVal << (
I * 8);
85 Dst, DstPtrInfo,
Align);
92 EVT PtrVT = Dst.getValueType();
97 auto *CByte = dyn_cast<ConstantSDNode>(Byte);
98 if (
auto *CSize = dyn_cast<ConstantSDNode>(Size)) {
99 uint64_t Bytes = CSize->getZExtValue();
107 uint64_t ByteVal = CByte->getZExtValue();
108 if (ByteVal == 0 || ByteVal == 255 ?
111 unsigned Size1 = Bytes == 16 ? 8 : 1 <<
findLastSet(Bytes);
112 unsigned Size2 = Bytes - Size1;
114 Alignment.value(), DstPtrInfo);
121 DAG,
DL, Chain, Dst, ByteVal, Size2,
122 std::min((
unsigned)Alignment.value(), Size1), DstPtrInfo);
129 DAG.
getStore(Chain,
DL, Byte, Dst, DstPtrInfo, Alignment);
139 assert(Bytes >= 2 &&
"Should have dealt with 0- and 1-byte cases already");
142 if (CByte && CByte->getZExtValue() == 0)
150 if (CByte && CByte->getZExtValue() == 0)
178 if (
auto *CSize = dyn_cast<ConstantSDNode>(Size)) {
179 uint64_t Bytes = CSize->getZExtValue();
180 assert(Bytes > 0 &&
"Caller should have handled 0-size case");
192 EVT PtrVT = Src.getValueType();
201 SDValue CCReg = End.getValue(1);
202 Chain = End.getValue(2);
211 return std::make_pair(End, Chain);
217 bool isStpcpy)
const {
221 return std::make_pair(isStpcpy ? EndDest : Dest, EndDest.
getValue(1));
232 SDValue CCReg = Unused.getValue(1);
233 Chain = Unused.getValue(2);
246 EVT PtrVT = Src.getValueType();
250 Chain = End.getValue(2);
252 return std::make_pair(Len, Chain);
258 EVT PtrVT = Src.getValueType();
265 EVT PtrVT = Src.getValueType();
std::pair< SDValue, SDValue > EmitTargetCodeForStrcmp(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, SDValue Src2, MachinePointerInfo Op1PtrInfo, MachinePointerInfo Op2PtrInfo) const override
Emit target-specific code that performs a strcmp, in cases where that is faster than a libcall.
static SDValue memsetStore(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, uint64_t ByteVal, uint64_t Size, unsigned Align, MachinePointerInfo DstPtrInfo)
This is an optimization pass for GlobalISel generic memory operations.
static SDValue emitMemMemImm(SelectionDAG &DAG, const SDLoc &DL, unsigned Op, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, SDValue Byte=SDValue())
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static std::pair< SDValue, SDValue > getBoundedStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, SDValue Limit)
std::pair< SDValue, SDValue > EmitTargetCodeForStrnlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, SDValue MaxLength, MachinePointerInfo SrcPtrInfo) const override
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Byte, SDValue Size, Align Alignment, bool IsVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo) const override
Emit target-specific code that performs a memset.
static SDValue createMemMemNode(SelectionDAG &DAG, const SDLoc &DL, unsigned Op, SDValue Chain, SDValue Dst, SDValue Src, SDValue LenAdj, SDValue Byte)
const unsigned CCMASK_SRST_FOUND
static SDValue addIPMSequence(const SDLoc &DL, SDValue CCReg, SelectionDAG &DAG)
EVT getValueType() const
Return the ValueType of the referenced return value.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
static unsigned getMemMemLenAdj(unsigned Op)
@ AND
Bitwise operators - logical and, logical or, logical xor.
This struct is a compact representation of a valid (non-zero power of two) alignment.
std::pair< SDValue, SDValue > EmitTargetCodeForStrcpy(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dest, SDValue Src, MachinePointerInfo DestPtrInfo, MachinePointerInfo SrcPtrInfo, bool isStpcpy) const override
Emit target-specific code that performs a strcpy or stpcpy, in cases where that is faster than a libc...
unsigned countPopulation(T Value)
Count the number of set bits in a value.
const unsigned CCMASK_SRST
std::pair< SDValue, SDValue > EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, MachinePointerInfo SrcPtrInfo) const override
This class contains a discriminated union of information about pointers in memory operands,...
std::pair< SDValue, SDValue > EmitTargetCodeForMemchr(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, SDValue Char, SDValue Length, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memchr, in cases where that is faster than a libcall.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
SDValue getValue(unsigned R) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
T findLastSet(T Val, ZeroBehavior ZB=ZB_Max)
Get the index of the last set bit starting from the least significant bit.
MachinePointerInfo getWithOffset(int64_t O) const
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
static SDValue emitMemMemReg(SelectionDAG &DAG, const SDLoc &DL, unsigned Op, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, SDValue Byte=SDValue())
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool IsVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memcpy.
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
std::pair< SDValue, SDValue > EmitTargetCodeForMemcmp(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, SDValue Src2, SDValue Size, MachinePointerInfo Op1PtrInfo, MachinePointerInfo Op2PtrInfo) const override
Emit target-specific code that performs a memcmp/bcmp, in cases where that is faster than a libcall.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
@ ADD
Simple integer binary arithmetic operators.
@ SHL
Shift and rotation operations.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
static MVT getIntegerVT(unsigned BitWidth)