LLVM: lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

16

17#define GET_SDNODE_DESC

18#include "SystemZGenSDNodeInfo.inc"

19

20using namespace llvm;

21

22#define DEBUG_TYPE "systemz-selectiondag-info"

23

26

30 return "SystemZISD::GET_CCMASK";

31 }

32

34}

35

37 return Op == SystemZISD::MEMSET_MVC ? 2 : 1;

38}

39

43 SDVTList VTs = Op == SystemZISD::CLC ? DAG.getVTList(MVT::i32, MVT::Other)

46 if (Op == SystemZISD::MEMSET_MVC)

47 Ops = { Chain, Dst, LenAdj, Byte };

48 else

49 Ops = { Chain, Dst, Src, LenAdj };

51}

52

53

54

55

56

61 assert(Size >= Adj && "Adjusted length overflow.");

64}

65

75

78 SDValue Size, Align Alignment, bool IsVolatile, bool AlwaysInline,

80 if (IsVolatile)

82

84 return emitMemMemImm(DAG, DL, SystemZISD::MVC, Chain, Dst, Src,

85 CSize->getZExtValue());

86

88}

89

90

91

92

97 for (unsigned I = 1; I < Size; ++I)

98 StoreVal |= ByteVal << (I * 8);

101 Dst, DstPtrInfo, Alignment);

102}

103

108 EVT PtrVT = Dst.getValueType();

109

110 if (IsVolatile)

112

115 uint64_t Bytes = CSize->getZExtValue();

116 if (Bytes == 0)

118 if (CByte) {

119

120

121

122

123 uint64_t ByteVal = CByte->getZExtValue();

124 if (ByteVal == 0 || ByteVal == 255

126 : Bytes <= 4) {

127 unsigned Size1 = Bytes == 16 ? 8 : llvm::bit_floor(Bytes);

128 unsigned Size2 = Bytes - Size1;

130 Alignment, DstPtrInfo);

131 if (Size2 == 0)

132 return Chain1;

138 std::min(Alignment, Align(Size1)), DstPtrInfo);

140 }

141 } else {

142

143 if (Bytes <= 2) {

145 DAG.getStore(Chain, DL, Byte, Dst, DstPtrInfo, Alignment);

146 if (Bytes == 1)

147 return Chain1;

153 }

154 }

155 assert(Bytes >= 2 && "Should have dealt with 0- and 1-byte cases already");

156

157

158 if (CByte && CByte->getZExtValue() == 0)

159 return emitMemMemImm(DAG, DL, SystemZISD::XC, Chain, Dst, Dst, Bytes);

160

163 }

164

165

166 if (CByte && CByte->getZExtValue() == 0)

167

169

172}

173

174

175

176

177

180 SDValue IPM = DAG.getNode(SystemZISD::IPM, DL, MVT::i32, CCReg);

185 return SRA;

186}

187

192

194 uint64_t Bytes = CSize->getZExtValue();

195 assert(Bytes > 0 && "Caller should have handled 0-size case");

196 CCReg = emitMemMemImm(DAG, DL, SystemZISD::CLC, Chain, Src2, Src1, Bytes);

197 } else

198 CCReg = emitMemMemReg(DAG, DL, SystemZISD::CLC, Chain, Src2, Src1, Size);

200 return std::make_pair(addIPMSequence(DL, CCReg, DAG), Chain);

201}

202

206

207 EVT PtrVT = Src.getValueType();

214 SDValue End = DAG.getNode(SystemZISD::SEARCH_STRING, DL, VTs, Chain,

215 Limit, Src, Char);

218

219

220

225 End = DAG.getNode(SystemZISD::SELECT_CCMASK, DL, PtrVT, Ops);

226 return std::make_pair(End, Chain);

227}

228

232 bool isStpcpy) const {

234 SDValue EndDest = DAG.getNode(SystemZISD::STPCPY, DL, VTs, Chain, Dest, Src,

236 return std::make_pair(isStpcpy ? EndDest : Dest, EndDest.getValue(1));

237}

238

244

245 SDValue Unused = DAG.getNode(SystemZISD::STRCMP, DL, VTs, Chain, Src2, Src1,

247 SDValue CCReg = Unused.getValue(1);

248 Chain = Unused.getValue(2);

249 return std::make_pair(addIPMSequence(DL, CCReg, DAG), Chain);

250}

251

252

253

254

255

256

261 EVT PtrVT = Src.getValueType();

263 SDValue End = DAG.getNode(SystemZISD::SEARCH_STRING, DL, VTs, Chain,

267 return std::make_pair(Len, Chain);

268}

269

273 EVT PtrVT = Src.getValueType();

275}

276

280 EVT PtrVT = Src.getValueType();

284}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]

static SDValue emitMemMemReg(SelectionDAG &DAG, const SDLoc &DL, unsigned Op, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, SDValue Byte=SDValue())

Definition SystemZSelectionDAGInfo.cpp:66

static std::pair< SDValue, SDValue > getBoundedStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, SDValue Limit)

Definition SystemZSelectionDAGInfo.cpp:257

static unsigned getMemMemLenAdj(unsigned Op)

Definition SystemZSelectionDAGInfo.cpp:36

static SDValue addIPMSequence(const SDLoc &DL, SDValue CCReg, SelectionDAG &DAG)

Definition SystemZSelectionDAGInfo.cpp:178

static SDValue memsetStore(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, uint64_t ByteVal, uint64_t Size, Align Alignment, MachinePointerInfo DstPtrInfo)

Definition SystemZSelectionDAGInfo.cpp:93

static SDValue createMemMemNode(SelectionDAG &DAG, const SDLoc &DL, unsigned Op, SDValue Chain, SDValue Dst, SDValue Src, SDValue LenAdj, SDValue Byte)

Definition SystemZSelectionDAGInfo.cpp:40

static SDValue emitMemMemImm(SelectionDAG &DAG, const SDLoc &DL, unsigned Op, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, SDValue Byte=SDValue())

Definition SystemZSelectionDAGInfo.cpp:57

This class represents a function call, abstracting a target machine's calling convention.

static MVT getIntegerVT(unsigned BitWidth)

Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...

Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.

SDValue getValue(unsigned R) const

EVT getValueType() const

Return the ValueType of the referenced return value.

const char * getTargetNodeName(unsigned Opcode) const override

Returns the name of the given target-specific opcode, suitable for debug printing.

SelectionDAGGenTargetInfo(const SDNodeInfo &GenNodeInfo)

This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...

LLVM_ABI SDVTList getVTList(EVT VT)

Return an SDVTList that represents the list of values specified.

LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)

Create a ConstantSDNode wrapping a constant value.

LLVM_ABI 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.

LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)

LLVM_ABI 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...

LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)

Gets or creates the specified node.

SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)

LLVM_ABI 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...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

const char * getTargetNodeName(unsigned Opcode) const override

Returns the name of the given target-specific opcode, suitable for debug printing.

Definition SystemZSelectionDAGInfo.cpp:27

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.

Definition SystemZSelectionDAGInfo.cpp:104

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.

Definition SystemZSelectionDAGInfo.cpp:203

std::pair< SDValue, SDValue > EmitTargetCodeForMemcmp(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, SDValue Src2, SDValue Size, const CallInst *CI) const override

Emit target-specific code that performs a memcmp/bcmp, in cases where that is faster than a libcall.

Definition SystemZSelectionDAGInfo.cpp:188

SystemZSelectionDAGInfo()

Definition SystemZSelectionDAGInfo.cpp:24

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.

Definition SystemZSelectionDAGInfo.cpp:239

std::pair< SDValue, SDValue > EmitTargetCodeForStrnlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, SDValue MaxLength, MachinePointerInfo SrcPtrInfo) const override

Definition SystemZSelectionDAGInfo.cpp:277

std::pair< SDValue, SDValue > EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src, const CallInst *CI) const override

Definition SystemZSelectionDAGInfo.cpp:270

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...

Definition SystemZSelectionDAGInfo.cpp:229

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.

Definition SystemZSelectionDAGInfo.cpp:76

@ ADD

Simple integer binary arithmetic operators.

@ SHL

Shift and rotation operations.

@ AND

Bitwise operators - logical and, logical or, logical xor.

@ TokenFactor

TokenFactor - This node takes multiple tokens as input and produces a single token result.

const unsigned CCMASK_SRST

const unsigned CCMASK_SRST_FOUND

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

constexpr int popcount(T Value) noexcept

Count the number of set bits in a value.

DWARFExpression::Operation Op

T bit_floor(T Value)

Returns the largest integral power of two no greater than Value if Value is nonzero.

This struct is a compact representation of a valid (non-zero power of two) alignment.

This class contains a discriminated union of information about pointers in memory operands,...

MachinePointerInfo getWithOffset(int64_t O) const

This represents a list of ValueType's that has been intern'd by a SelectionDAG.