LLVM 24.0.0git
SIISelLowering.h
Go to the documentation of this file.
1//===-- SIISelLowering.h - SI DAG Lowering Interface ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file
10/// SI DAG Lowering interface definition
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_AMDGPU_SIISELLOWERING_H
15#define LLVM_LIB_TARGET_AMDGPU_SIISELLOWERING_H
16
18#include "AMDGPUISelLowering.h"
19#include "SIDefines.h"
22#include <bitset>
23
24namespace llvm {
25
26class GCNSubtarget;
28class SIRegisterInfo;
29
30namespace AMDGPU {
33}
34
36private:
37 const GCNSubtarget *Subtarget;
38
39 /// Result types made Custom for ISD::INTRINSIC_W_CHAIN only so that
40 /// unsupported s_buffer_load result types can be diagnosed. Any other
41 /// intrinsic returning one of these must keep using generic legalization.
42 std::bitset<MVT::VALUETYPE_SIZE> SBufferLoadDiagnosticVTs;
43
44public:
47 EVT VT) const override;
50 EVT VT) const override;
51
53 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
54 unsigned &NumIntermediates, MVT &RegisterVT) const override;
55
57
58 bool isUniformLoad(const LoadSDNode *Load) const;
59
60private:
61 SDValue lowerKernArgParameterPtr(SelectionDAG &DAG, const SDLoc &SL,
62 SDValue Chain, uint64_t Offset) const;
63 SDValue getImplicitArgPtr(SelectionDAG &DAG, const SDLoc &SL) const;
64 SDValue getLDSKernelId(SelectionDAG &DAG, const SDLoc &SL) const;
65 SDValue lowerKernargMemParameter(SelectionDAG &DAG, EVT VT, EVT MemVT,
66 const SDLoc &SL, SDValue Chain,
67 uint64_t Offset, Align Alignment,
68 bool Signed,
69 const ISD::InputArg *Arg = nullptr) const;
70 SDValue loadImplicitKernelArgument(SelectionDAG &DAG, MVT VT, const SDLoc &DL,
71 Align Alignment,
72 ImplicitParameter Param) const;
73
74 SDValue convertABITypeToValueType(SelectionDAG &DAG, SDValue Val,
75 CCValAssign &VA, const SDLoc &SL) const;
76
77 SDValue lowerStackParameter(SelectionDAG &DAG, CCValAssign &VA,
78 const SDLoc &SL, SDValue Chain,
79 const ISD::InputArg &Arg) const;
80 SDValue lowerWorkGroupId(
81 SelectionDAG &DAG, const SIMachineFunctionInfo &MFI, EVT VT,
84 AMDGPUFunctionArgInfo::PreloadedValue ClusterWorkGroupIdPV) const;
86 lowerClusterWorkGroupValue(SelectionDAG &DAG,
87 const SIMachineFunctionInfo &MFI, EVT VT,
89 SDValue getPreloadedValue(SelectionDAG &DAG,
90 const SIMachineFunctionInfo &MFI,
91 EVT VT,
93
94 SDValue LowerGlobalAddress(AMDGPUMachineFunctionInfo *MFI, SDValue Op,
95 SelectionDAG &DAG) const override;
96 SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const;
97
98 SDValue lowerImplicitZextParam(SelectionDAG &DAG, SDValue Op,
99 MVT VT, unsigned Offset) const;
100 SDValue lowerImage(SDValue Op, const AMDGPU::ImageDimIntrinsicInfo *Intr,
101 SelectionDAG &DAG, bool WithChain) const;
102 SDValue lowerSBuffer(EVT VT, EVT MemVT, SDLoc DL, SDValue Chain, SDValue Rsrc,
103 SDValue Offset, SDValue CachePolicy, SelectionDAG &DAG,
104 MachineMemOperand *MMO = nullptr) const;
105
107 getBufferIntrinsicOps(SDValue Op, const AMDGPU::BufferIntrinsicInfo &Info,
108 SelectionDAG &DAG, SDValue VData = SDValue()) const;
109 SDValue lowerBufferIntrinsicWithChain(SDValue Op,
110 const AMDGPU::BufferIntrinsicInfo &Info,
111 SelectionDAG &DAG) const;
112 SDValue lowerBufferIntrinsicVoid(SDValue Op,
113 const AMDGPU::BufferIntrinsicInfo &Info,
114 SelectionDAG &DAG) const;
115 SDValue lowerBufferAtomicIntrin(SDValue Op, SelectionDAG &DAG,
116 unsigned NewOpcode) const;
117
118 SDValue lowerWaveID(SelectionDAG &DAG, SDValue Op) const;
119 SDValue lowerConstHwRegRead(SelectionDAG &DAG, SDValue Op,
120 AMDGPU::Hwreg::Id HwReg, unsigned LowBit,
121 unsigned Width) const;
122 SDValue lowerWorkitemID(SelectionDAG &DAG, SDValue Op, unsigned Dim,
123 const ArgDescriptor &ArgDesc) const;
124
125 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
126 SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
127 SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
128 SDValue LowerCONVERT_FROM_ARBITRARY_FP(SDValue Op, SelectionDAG &DAG) const;
129 SDValue lowerFromFP8(SDValue Op, bool IsBF8, SelectionDAG &DAG) const;
130 SDValue LowerCONVERT_TO_ARBITRARY_FP(SDValue Op, SelectionDAG &DAG) const;
131 SDValue lowerToFP8(SDValue Op, bool IsBF8, bool IsE5M3,
132 SelectionDAG &DAG) const;
133
134 // The raw.tbuffer and struct.tbuffer intrinsics have two offset args: offset
135 // (the offset that is included in bounds checking and swizzling, to be split
136 // between the instruction's voffset and immoffset fields) and soffset (the
137 // offset that is excluded from bounds checking and swizzling, to go in the
138 // instruction's soffset field). This function takes the first kind of
139 // offset and figures out how to split it between voffset and immoffset.
140 std::pair<SDValue, SDValue> splitBufferOffsets(SDValue Offset,
141 SelectionDAG &DAG) const;
142
143 SDValue widenLoad(LoadSDNode *Ld, DAGCombinerInfo &DCI) const;
144 SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;
145 SDValue lowerLoadStoreVGPR(SDValue Op, SelectionDAG &DAG) const;
146 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
147 SDValue lowerFastUnsafeFDIV(SDValue Op, SelectionDAG &DAG) const;
148 SDValue lowerFastUnsafeFDIV64(SDValue Op, SelectionDAG &DAG) const;
149 SDValue lowerFDIV_FAST(SDValue Op, SelectionDAG &DAG) const;
150 SDValue LowerFDIV16(SDValue Op, SelectionDAG &DAG) const;
151 SDValue LowerFDIV32(SDValue Op, SelectionDAG &DAG) const;
152 SDValue LowerFDIV64(SDValue Op, SelectionDAG &DAG) const;
153 SDValue LowerFDIV(SDValue Op, SelectionDAG &DAG) const;
154 SDValue LowerFFREXP(SDValue Op, SelectionDAG &DAG) const;
155 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;
156 SDValue LowerTrig(SDValue Op, SelectionDAG &DAG) const;
157 SDValue lowerFSQRTF16(SDValue Op, SelectionDAG &DAG) const;
158 SDValue lowerFSQRTF32(SDValue Op, SelectionDAG &DAG) const;
159 SDValue lowerFSQRTF64(SDValue Op, SelectionDAG &DAG) const;
160 SDValue LowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const;
161 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
162 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
163 SDValue lowerFrameIndex(SDValue Op, SelectionDAG &DAG) const;
164 SDValue LowerSPONENTRY(SDValue Op, SelectionDAG &DAG) const;
165 SDValue adjustLoadValueType(unsigned Opcode, MemSDNode *M, SelectionDAG &DAG,
167 bool IsIntrinsic = false) const;
168
169 SDValue lowerIntrinsicLoad(MemSDNode *M, bool IsFormat, SelectionDAG &DAG,
170 ArrayRef<SDValue> Ops) const;
171
172 // Call DAG.getMemIntrinsicNode for a load, but first widen a dwordx3 type to
173 // dwordx4 if on SI.
174 SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
176 MachineMemOperand *MMO, SelectionDAG &DAG) const;
177
178 SDValue handleD16VData(SDValue VData, SelectionDAG &DAG,
179 bool ImageStore = false) const;
180
181 /// Converts \p Op, which must be of floating point type, to the
182 /// floating point type \p VT, by either extending or truncating it.
183 SDValue getFPExtOrFPRound(SelectionDAG &DAG,
184 SDValue Op,
185 const SDLoc &DL,
186 EVT VT) const;
187
188 SDValue convertArgType(
189 SelectionDAG &DAG, EVT VT, EVT MemVT, const SDLoc &SL, SDValue Val,
190 bool Signed, const ISD::InputArg *Arg = nullptr) const;
191
192 /// Custom lowering for ISD::FP_ROUND for MVT::f16.
193 SDValue lowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;
194 SDValue splitFP_ROUNDVectorOp(SDValue Op, SelectionDAG &DAG) const;
195 SDValue lowerFMINNUM_FMAXNUM(SDValue Op, SelectionDAG &DAG) const;
196 SDValue lowerFMINIMUMNUM_FMAXIMUMNUM(SDValue Op, SelectionDAG &DAG) const;
197 SDValue lowerFLDEXP(SDValue Op, SelectionDAG &DAG) const;
198 SDValue promoteUniformOpToI32(SDValue Op, DAGCombinerInfo &DCI) const;
199 SDValue promoteUniformUnaryOpToI32(SDValue Op, DAGCombinerInfo &DCI) const;
200 SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
201 SDValue lowerMUL(SDValue Op, SelectionDAG &DAG) const;
202 SDValue lowerXMULO(SDValue Op, SelectionDAG &DAG) const;
203 SDValue lowerXMUL_LOHI(SDValue Op, SelectionDAG &DAG) const;
204
205 SDValue getBaseSegmentAperture(unsigned AS, const SDLoc &DL,
206 SelectionDAG &DAG) const;
207 SDValue getSegmentAperture(unsigned AS, const SDLoc &DL,
208 SelectionDAG &DAG) const;
209
210 SDValue lowerADDRSPACECAST(SDValue Op, SelectionDAG &DAG) const;
211 SDValue lowerINSERT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const;
212 SDValue lowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
213 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
214 SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
215 SDValue lowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
216 SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
217
218 SDValue lowerTRAP(SDValue Op, SelectionDAG &DAG) const;
219 SDValue lowerTrapEndpgm(SDValue Op, SelectionDAG &DAG) const;
220 SDValue lowerTrapHsaQueuePtr(SDValue Op, SelectionDAG &DAG) const;
221 SDValue lowerTrapHsa(SDValue Op, SelectionDAG &DAG) const;
222 SDValue lowerDEBUGTRAP(SDValue Op, SelectionDAG &DAG) const;
223 SDValue LowerINLINEASM(SDValue Op, SelectionDAG &DAG) const;
224
225 SDNode *adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const;
226
227 SDValue performUCharToFloatCombine(SDNode *N,
228 DAGCombinerInfo &DCI) const;
229 SDValue performFCopySignCombine(SDNode *N, DAGCombinerInfo &DCI) const;
230
231 SDValue performSHLPtrCombine(SDNode *N,
232 unsigned AS,
233 EVT MemVT,
234 DAGCombinerInfo &DCI) const;
235
236 SDValue performMemSDNodeCombine(MemSDNode *N, DAGCombinerInfo &DCI) const;
237
238 SDValue splitBinaryBitConstantOp(DAGCombinerInfo &DCI, const SDLoc &SL,
239 unsigned Opc, SDValue LHS,
240 const ConstantSDNode *CRHS) const;
241
242 SDValue performAndCombine(SDNode *N, DAGCombinerInfo &DCI) const;
243 SDValue performOrCombine(SDNode *N, DAGCombinerInfo &DCI) const;
244 SDValue performXorCombine(SDNode *N, DAGCombinerInfo &DCI) const;
245 SDValue performZeroOrAnyExtendCombine(SDNode *N, DAGCombinerInfo &DCI) const;
246 SDValue performExtendTruncShiftCombine(SDNode *N, DAGCombinerInfo &DCI) const;
247 SDValue performSignExtendInRegCombine(SDNode *N, DAGCombinerInfo &DCI) const;
248 SDValue performClassCombine(SDNode *N, DAGCombinerInfo &DCI) const;
249 SDValue getCanonicalConstantFP(SelectionDAG &DAG, const SDLoc &SL, EVT VT,
250 const APFloat &C) const;
251 SDValue performFCanonicalizeCombine(SDNode *N, DAGCombinerInfo &DCI) const;
252
253 SDValue performFPMed3ImmCombine(SelectionDAG &DAG, const SDLoc &SL,
254 SDValue Op0, SDValue Op1,
255 bool IsKnownNoNaNs) const;
256 SDValue performIntMed3ImmCombine(SelectionDAG &DAG, const SDLoc &SL,
257 SDValue Src, SDValue MinVal, SDValue MaxVal,
258 bool Signed) const;
259 SDValue performMinMaxCombine(SDNode *N, DAGCombinerInfo &DCI) const;
260 SDValue performFMed3Combine(SDNode *N, DAGCombinerInfo &DCI) const;
261 SDValue performCvtPkRTZCombine(SDNode *N, DAGCombinerInfo &DCI) const;
262 SDValue performExponentOnlyScaleCombine(SDNode *N,
263 DAGCombinerInfo &DCI) const;
264 SDValue performExtractVectorEltCombine(SDNode *N, DAGCombinerInfo &DCI) const;
265 SDValue performInsertVectorEltCombine(SDNode *N, DAGCombinerInfo &DCI) const;
266 SDValue performFPRoundCombine(SDNode *N, DAGCombinerInfo &DCI) const;
267 SDValue performFrexpSelectCombine(SDNode *N, DAGCombinerInfo &DCI) const;
268 SDValue performSelectCombine(SDNode *N, DAGCombinerInfo &DCI) const;
269
270 SDValue reassociateScalarOps(SDNode *N, SelectionDAG &DAG) const;
271 unsigned getFusedOpcode(const SelectionDAG &DAG,
272 const SDNode *N0, const SDNode *N1) const;
273 SDValue tryFoldToMad64_32(SDNode *N, DAGCombinerInfo &DCI) const;
274 SDValue foldAddSub64WithZeroLowBitsTo32(SDNode *N,
275 DAGCombinerInfo &DCI) const;
276
277 SDValue performAddCombine(SDNode *N, DAGCombinerInfo &DCI) const;
278 SDValue performPtrAddCombine(SDNode *N, DAGCombinerInfo &DCI) const;
279 SDValue performSubCombine(SDNode *N, DAGCombinerInfo &DCI) const;
280 SDValue performFAddCombine(SDNode *N, DAGCombinerInfo &DCI) const;
281 SDValue performFSubCombine(SDNode *N, DAGCombinerInfo &DCI) const;
282 SDValue performFDivCombine(SDNode *N, DAGCombinerInfo &DCI) const;
283 SDValue performFMulCombine(SDNode *N, DAGCombinerInfo &DCI) const;
284 SDValue performFMACombine(SDNode *N, DAGCombinerInfo &DCI) const;
285 SDValue performSetCCCombine(SDNode *N, DAGCombinerInfo &DCI) const;
286 SDValue performCvtF32UByteNCombine(SDNode *N, DAGCombinerInfo &DCI) const;
287 SDValue performClampCombine(SDNode *N, DAGCombinerInfo &DCI) const;
288 SDValue performRcpCombine(SDNode *N, DAGCombinerInfo &DCI) const;
289
290 bool isLegalMUBUFAddressingMode(const AddrMode &AM) const;
291
292 unsigned isCFIntrinsic(const SDNode *Intr) const;
293
294public:
295 /// \returns True if fixup needs to be emitted for given global value \p GV,
296 /// false otherwise.
297 bool shouldEmitFixup(const GlobalValue *GV) const;
298
299 /// \returns True if GOT relocation needs to be emitted for given global value
300 /// \p GV, false otherwise.
301 bool shouldEmitGOTReloc(const GlobalValue *GV) const;
302
303 /// \returns True if PC-relative relocation needs to be emitted for given
304 /// global value \p GV, false otherwise.
305 bool shouldEmitPCReloc(const GlobalValue *GV) const;
306
307 /// \returns true if this should use a literal constant for an LDS address,
308 /// and not emit a relocation for an LDS global.
309 bool shouldUseLDSConstAddress(const GlobalValue *GV) const;
310
311 /// Check if EXTRACT_VECTOR_ELT/INSERT_VECTOR_ELT (<n x e>, var-idx) should be
312 /// expanded into a set of cmp/select instructions.
313 static bool shouldExpandVectorDynExt(unsigned EltSize, unsigned NumElem,
314 bool IsDivergentIdx,
315 const GCNSubtarget *Subtarget);
316
317 bool shouldExpandVectorDynExt(SDNode *N) const;
318
319 bool shouldPreservePtrArith(const Function &F, EVT PtrVT) const override;
320
322 EVT PtrVT) const override;
323
324private:
325 /// Returns true if the first real instruction in MBB is 8 bytes and could
326 /// be split by a 32-byte fetch window boundary. Used on GFX950 to avoid
327 /// instruction fetch delays.
328 bool needsFetchWindowAlignment(const MachineBasicBlock &MBB) const;
329
330 // Analyze a combined offset from an amdgcn_s_buffer_load intrinsic and store
331 // the three offsets (voffset, soffset and instoffset) into the SDValue[3]
332 // array pointed to by Offsets.
333 void setBufferOffsets(SDValue CombinedOffset, SelectionDAG &DAG,
334 SDValue *Offsets, Align Alignment = Align(4)) const;
335
336 // Convert the i128 that an addrspace(8) pointer is natively represented as
337 // into the v4i32 that all the buffer intrinsics expect to receive. We can't
338 // add register classes for i128 on pain of the promotion logic going haywire,
339 // so this slightly ugly hack is what we've got. If passed a non-pointer
340 // argument (as would be seen in older buffer intrinsics), does nothing.
341 SDValue bufferRsrcPtrToVector(SDValue MaybePointer, SelectionDAG &DAG) const;
342
343 // Wrap a 64-bit pointer into a v4i32 (which is how all SelectionDAG code
344 // represents ptr addrspace(8)) using the flags specified in the intrinsic.
345 SDValue lowerPointerAsRsrcIntrin(SDNode *Op, SelectionDAG &DAG) const;
346
347 // Handle 8 bit and 16 bit buffer loads
348 SDValue handleByteShortBufferLoads(SelectionDAG &DAG, EVT LoadVT, SDLoc DL,
351 bool IsTFE = false) const;
352
353 // Handle 8 bit and 16 bit buffer stores
354 SDValue handleByteShortBufferStores(SelectionDAG &DAG, EVT VDataType,
355 SDLoc DL, SDValue Ops[],
356 MemSDNode *M) const;
357
358public:
359 SITargetLowering(const TargetMachine &tm, const GCNSubtarget &STI);
360
361 const GCNSubtarget *getSubtarget() const;
362
364
365 bool isFPExtFoldable(const SelectionDAG &DAG, unsigned Opcode, EVT DestVT,
366 EVT SrcVT) const override;
367
368 bool isFPExtFoldable(const MachineInstr &MI, unsigned Opcode, LLT DestTy,
369 LLT SrcTy) const override;
370
371 bool isShuffleMaskLegal(ArrayRef<int> /*Mask*/, EVT /*VT*/) const override;
372
373 // While address space 7 should never make it to codegen, it still needs to
374 // have a MVT to prevent some analyses that query this function from breaking.
375 // We use the custum MVT::amdgpuBufferFatPointer and
376 // amdgpu::amdgpuBufferStridedPointer for this, though we use v8i32 for the
377 // memory type (which is probably unused).
378 MVT getPointerTy(const DataLayout &DL, unsigned AS) const override;
379 MVT getPointerMemTy(const DataLayout &DL, unsigned AS) const override;
380
382 MachineFunction &MF,
383 unsigned IntrinsicID) const override;
384
387 Type *&AccessTy) const override;
388
389 bool isLegalFlatAddressingMode(const AddrMode &AM, unsigned AddrSpace) const;
390 bool isLegalGlobalAddressingMode(const AddrMode &AM) const;
391 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
392 unsigned AS,
393 Instruction *I = nullptr) const override;
394
395 bool canMergeStoresTo(unsigned AS, EVT MemVT,
396 const MachineFunction &MF) const override;
397
399 unsigned Size, unsigned AddrSpace, Align Alignment,
401 unsigned *IsFast = nullptr) const;
402
404 LLT Ty, unsigned AddrSpace, Align Alignment,
406 unsigned *IsFast = nullptr) const override {
407 if (IsFast)
408 *IsFast = 0;
409 return allowsMisalignedMemoryAccessesImpl(Ty.getSizeInBits(), AddrSpace,
410 Alignment, Flags, IsFast);
411 }
412
414 EVT VT, unsigned AS, Align Alignment,
416 unsigned *IsFast = nullptr) const override;
417
418 bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT,
419 unsigned AddrSpace, Align Alignment,
421 unsigned *IsFast) const override;
422
423 EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
424 const AttributeList &FuncAttributes) const override;
425
426 bool isMemOpHasNoClobberedMemOperand(const SDNode *N) const;
427
428 static bool isNonGlobalAddrSpace(unsigned AS);
429
430 bool isFreeAddrSpaceCast(const DataLayout &DL, unsigned SrcAS,
431 unsigned DestAS) const override;
432
434 getPreferredVectorAction(MVT VT) const override;
435
437 Type *Ty) const override;
438
440 unsigned Index) const override;
441 bool isExtractVecEltCheap(EVT VT, unsigned Index) const override;
442
443 bool isTypeDesirableForOp(unsigned Op, EVT VT) const override;
444 bool isTypeDesirableForOp(SDNode *N, EVT VT) const override;
445
446 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
447
448 unsigned combineRepeatedFPDivisors() const override {
449 // Combine multiple FDIVs with the same divisor into multiple FMULs by the
450 // reciprocal.
451 return 2;
452 }
453
454 bool supportSplitCSR(MachineFunction *MF) const override;
455 void initializeSplitCSR(MachineBasicBlock *Entry) const override;
457 MachineBasicBlock *Entry,
458 const SmallVectorImpl<MachineBasicBlock *> &Exits) const override;
459
461 bool isVarArg,
463 const SDLoc &DL, SelectionDAG &DAG,
464 SmallVectorImpl<SDValue> &InVals) const override;
465
466 bool CanLowerReturn(CallingConv::ID CallConv,
467 MachineFunction &MF, bool isVarArg,
469 LLVMContext &Context, const Type *RetTy) const override;
470
471 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
473 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
474 SelectionDAG &DAG) const override;
475
477 CallLoweringInfo &CLI,
478 CCState &CCInfo,
479 const SIMachineFunctionInfo &Info,
480 SmallVectorImpl<std::pair<unsigned, SDValue>> &RegsToPass,
481 SmallVectorImpl<SDValue> &MemOpChains,
482 SDValue Chain) const;
483
485 CallingConv::ID CallConv, bool isVarArg,
487 const SDLoc &DL, SelectionDAG &DAG,
488 SmallVectorImpl<SDValue> &InVals, bool isThisReturn,
489 SDValue ThisVal) const;
490
491 bool mayBeEmittedAsTailCall(const CallInst *) const override;
492
494 SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg,
496 const SmallVectorImpl<SDValue> &OutVals,
497 const SmallVectorImpl<ISD::InputArg> &Ins, SelectionDAG &DAG) const;
498
499 SDValue LowerCall(CallLoweringInfo &CLI,
500 SmallVectorImpl<SDValue> &InVals) const override;
501
506
512
513 Register getRegisterByName(const char* RegName, LLT VT,
514 const MachineFunction &MF) const override;
515
517 MachineBasicBlock *BB) const;
518
521 MachineBasicBlock *BB) const;
522
525 MachineBasicBlock *BB) const override;
526
527 bool enableAggressiveFMAFusion(EVT VT) const override;
528 bool enableAggressiveFMAFusion(LLT Ty) const override;
530 EVT VT) const override;
531 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override;
532 LLT getPreferredShiftAmountTy(LLT Ty) const override;
533
535 EVT VT) const override;
537 const LLT Ty) const override;
538 bool isFMADLegal(const SelectionDAG &DAG, const SDNode *N) const override;
539 bool isFMADLegal(const MachineInstr &MI, const LLT Ty) const override;
540
541 /// Variants for IR level callers, which have no MachineFunction to read the
542 /// denormal mode from and must pass \p FPEnv explicitly.
543 bool isFMAFasterThanFMulAndFAdd(EVT VT, DenormalFPEnv FPEnv) const;
544
545 /// \p VT is used as written, so a vector type reports false.
546 bool isFMADLegal(EVT VT, DenormalFPEnv FPEnv) const;
547
548 /// \p Ty is taken by its scalar type, so a vector type asks about a lane.
549 bool isFMADLegal(const Function &F, Type *Ty) const;
550
551 bool isFMAFasterThanFMulAndFAdd(const Function &F, Type *Ty) const override;
552
556 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
558 SelectionDAG &DAG) const override;
559
560 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
561 SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override;
562 void AddMemOpInit(MachineInstr &MI) const;
564 SDNode *Node) const override;
565
567
569 SDValue Ptr) const;
571 uint32_t RsrcDword1, uint64_t RsrcDword2And3) const;
572 std::pair<unsigned, const TargetRegisterClass *>
574 StringRef Constraint, MVT VT) const override;
575 ConstraintType getConstraintType(StringRef Constraint) const override;
577 getInlineAsmMemConstraint(StringRef ConstraintCode) const override;
579 std::vector<SDValue> &Ops,
580 SelectionDAG &DAG) const override;
581 bool getAsmOperandConstVal(SDValue Op, uint64_t &Val) const;
582 bool checkAsmConstraintVal(SDValue Op, StringRef Constraint,
583 uint64_t Val) const;
585 uint64_t Val,
586 unsigned MaxSize = 64) const;
587 SDValue copyToM0(SelectionDAG &DAG, SDValue Chain, const SDLoc &DL,
588 SDValue V) const;
589
590 void finalizeLowering(MachineFunction &MF) const override;
591
593 const APInt &DemandedElts,
594 const SelectionDAG &DAG,
595 unsigned Depth = 0) const override;
597 const MachineFunction &MF,
598 Align Alignment) const override;
601 const APInt &DemandedElts,
603 unsigned Depth = 0) const override;
604
606 Register R,
608 unsigned Depth = 0) const override;
610 UniformityInfo *UA) const override;
611
612 bool hasMemSDNodeUser(SDNode *N) const;
613
615 SDValue N1) const override;
616
618 Register N1) const override;
619
621 SDNodeFlags UserFlags = {}, unsigned MaxDepth = 5) const;
622
623 /// Returns true if \p Op is provably canonical (no FCANONICALIZE needed).
624 /// \p QueryVT is the scalar FP type being checked, threaded unchanged
625 /// through recursion since canonicality is per vector element. FP operands
626 /// whose scalar type differs from \p QueryVT are treated as non-canonical,
627 /// since canonicality does not survive a change of FP format (e.g. bitcast
628 /// v2bf16 to v2f16); non-FP operands are not checked against \p QueryVT.
629 bool isCanonicalized(SelectionDAG &DAG, SDValue Op, EVT QueryVT,
630 SDNodeFlags UserFlags, unsigned MaxDepth) const;
632 unsigned MaxDepth = 5) const;
633 bool denormalsEnabledForType(const SelectionDAG &DAG, EVT VT) const;
634 bool denormalsEnabledForType(LLT Ty, const MachineFunction &MF) const;
635
636 bool isKnownNeverNaNForTargetNode(SDValue Op, const APInt &DemandedElts,
637 const SelectionDAG &DAG, bool SNaN = false,
638 unsigned Depth = 0) const override;
640 shouldExpandAtomicRMWInIR(const AtomicRMWInst *) const override;
641 AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override;
642 AtomicExpansionKind shouldExpandAtomicStoreInIR(StoreInst *SI) const override;
644 shouldExpandAtomicCmpXchgInIR(const AtomicCmpXchgInst *AI) const override;
645
646 void emitExpandAtomicAddrSpacePredicate(Instruction *AI) const;
647 void emitExpandAtomicRMW(AtomicRMWInst *AI) const override;
648 void emitExpandAtomicCmpXchg(AtomicCmpXchgInst *CI) const override;
649 void emitExpandAtomicLoad(LoadInst *LI) const override;
650 void emitExpandAtomicStore(StoreInst *SI) const override;
651
653 bool isDivergent) const override;
655 const Value *V) const override;
656 Align
657 getPrefLoopAlignment(MachineLoop *ML,
658 const MachineBasicBlock *BlockToAlign) const override;
659 unsigned
660 getMaxPermittedBytesForAlignment(MachineBasicBlock *MBB) const override;
661
662 void allocateHSAUserSGPRs(CCState &CCInfo,
663 MachineFunction &MF,
664 const SIRegisterInfo &TRI,
665 SIMachineFunctionInfo &Info) const;
666
667 void allocatePreloadKernArgSGPRs(CCState &CCInfo,
668 SmallVectorImpl<CCValAssign> &ArgLocs,
669 const SmallVectorImpl<ISD::InputArg> &Ins,
670 MachineFunction &MF,
671 const SIRegisterInfo &TRI,
672 SIMachineFunctionInfo &Info) const;
673
674 void allocateLDSKernelId(CCState &CCInfo, MachineFunction &MF,
675 const SIRegisterInfo &TRI,
676 SIMachineFunctionInfo &Info) const;
677
678 void allocateSystemSGPRs(CCState &CCInfo,
679 MachineFunction &MF,
680 SIMachineFunctionInfo &Info,
681 CallingConv::ID CallConv,
682 bool IsShader) const;
683
684 void allocateSpecialEntryInputVGPRs(CCState &CCInfo,
685 MachineFunction &MF,
686 const SIRegisterInfo &TRI,
687 SIMachineFunctionInfo &Info) const;
689 CCState &CCInfo,
690 MachineFunction &MF,
691 const SIRegisterInfo &TRI,
692 SIMachineFunctionInfo &Info) const;
693
694 void allocateSpecialInputVGPRsFixed(CCState &CCInfo,
695 MachineFunction &MF,
696 const SIRegisterInfo &TRI,
697 SIMachineFunctionInfo &Info) const;
698
700 getTargetMMOFlags(const Instruction &I) const override;
701};
702
703// Returns true if argument is a boolean value which is not serialized into
704// memory or argument and does not require v_cndmask_b32 to be deserialized.
705bool isBoolSGPR(SDValue V);
706
707} // End namespace llvm
708
709#endif
return SDValue()
uint64_t uint64_t
uint64_t Imm
Interface definition of the TargetLowering class that is common to all AMD GPUs.
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
block Block Frequency Analysis
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
Utilities for dealing with flags related to floating point properties and mode controls.
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define RegName(no)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
StandardInstrumentations SI(Mod->getContext(), Debug, VerifyEach)
RISCVCC::CondCode CC
MachineRegisterInfo & MRI
Value * LHS
AMDGPUTargetLowering(const TargetMachine &TM, const TargetSubtargetInfo &STI, const AMDGPUSubtarget &AMDGPUSTI)
Class for arbitrary precision integers.
Definition APInt.h:78
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
CCState - This class holds information needed while lowering arguments and return values.
CCValAssign - Represent assignment of one arg/retval to a location.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
A wrapper class for inspecting calls to intrinsic functions.
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
This class is used to represent ISD::LOAD nodes.
Machine Value Type.
Representation of each machine instruction.
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
An SDNode that represents everything that will be needed to construct a MachineInstr.
This is an abstract virtual class for memory operations.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
bool isTypeDesirableForOp(unsigned Op, EVT VT) const override
Return true if the target has native support for the specified value type and it is 'desirable' to us...
SDNode * PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override
Fold the instructions after selecting them.
SDValue splitTernaryVectorOp(SDValue Op, SelectionDAG &DAG) const
MachineSDNode * wrapAddr64Rsrc(SelectionDAG &DAG, const SDLoc &DL, SDValue Ptr) const
bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
SDValue lowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const
AtomicExpansionKind shouldExpandAtomicRMWInIR(const AtomicRMWInst *) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
bool requiresUniformRegister(MachineFunction &MF, const Value *V) const override
Allows target to decide about the register class of the specific value that is live outside the defin...
bool isFMADLegal(const SelectionDAG &DAG, const SDNode *N) const override
Returns true if be combined with to form an ISD::FMAD.
AtomicExpansionKind shouldExpandAtomicStoreInIR(StoreInst *SI) const override
Returns how the given (atomic) store should be expanded by the IR-level AtomicExpand pass into.
void bundleInstWithWaitcnt(MachineInstr &MI) const
Insert MI into a BUNDLE with an S_WAITCNT 0 immediately following it.
SDValue lowerROTR(SDValue Op, SelectionDAG &DAG) const
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
MVT getPointerTy(const DataLayout &DL, unsigned AS) const override
Map address space 7 to MVT::amdgpuBufferFatPointer because that's its in-memory representation.
bool denormalsEnabledForType(const SelectionDAG &DAG, EVT VT) const
void insertCopiesSplitCSR(MachineBasicBlock *Entry, const SmallVectorImpl< MachineBasicBlock * > &Exits) const override
Insert explicit copies in entry and exit blocks.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the ValueType of the result of SETCC operations.
SDNode * legalizeTargetIndependentNode(SDNode *Node, SelectionDAG &DAG) const
Legalize target independent instructions (e.g.
bool allowsMisalignedMemoryAccessesImpl(unsigned Size, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *IsFast=nullptr) const
TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT) const override
Return the preferred vector type legalization action.
SDValue lowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const
const GCNSubtarget * getSubtarget() const
bool enableAggressiveFMAFusion(EVT VT) const override
Return true if target always benefits from combining into FMA for a given value type.
bool shouldEmitGOTReloc(const GlobalValue *GV) const
SDValue splitUnaryVectorOp(SDValue Op, SelectionDAG &DAG) const
SDValue lowerGET_FPENV(SDValue Op, SelectionDAG &DAG) const
bool isCanonicalized(SelectionDAG &DAG, SDValue Op, SDNodeFlags UserFlags={}, unsigned MaxDepth=5) const
void allocateSpecialInputSGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
void allocateLDSKernelId(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
SDValue LowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const
bool isReassocProfitable(SelectionDAG &DAG, SDValue N0, SDValue N1) const override
void allocateHSAUserSGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
ArrayRef< MCPhysReg > getRoundingControlRegisters() const override
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
ConstraintType getConstraintType(StringRef Constraint) const override
Given a constraint, return the type of constraint it is for this target.
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const override
This hook must be implemented to lower outgoing return values, described by the Outs array,...
const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent) const override
Return the register class that should be used for the specified value type.
void AddMemOpInit(MachineInstr &MI) const
MachineMemOperand::Flags getTargetMMOFlags(const Instruction &I) const override
This callback is used to inspect load/store instructions and add target-specific MachineMemOperand fl...
bool isLegalGlobalAddressingMode(const AddrMode &AM) const
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Return true if it is beneficial to convert a load of a constant to just the constant itself.
InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const override
bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags, unsigned *IsFast) const override
Return true if the target supports a memory access of this type for the given address space and align...
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
void emitExpandAtomicStore(StoreInst *SI) const override
Perform a atomic store using a target-specific way.
AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override
Returns how the given (atomic) load should be expanded by the IR-level AtomicExpand pass.
Align computeKnownAlignForTargetInstr(GISelValueTracking &Analysis, Register R, const MachineRegisterInfo &MRI, unsigned Depth=0) const override
Determine the known alignment for the pointer value R.
bool getAsmOperandConstVal(SDValue Op, uint64_t &Val) const
bool isShuffleMaskLegal(ArrayRef< int >, EVT) const override
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations,...
void emitExpandAtomicLoad(LoadInst *LI) const override
Perform a atomic load using a target-specific way.
EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op, const AttributeList &FuncAttributes) const override
Returns the target specific optimal type for load and store operations as a result of memset,...
void computeKnownBitsForStackObjectPointer(KnownBits &Known, const MachineFunction &MF, Align Alignment) const override
Determine known bits of a pointer to a known valid stack object.
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked when a node result type is illegal for the target, and the operation was reg...
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
LLT getPreferredShiftAmountTy(LLT Ty) const override
Return the preferred type to use for a shift opcode, given the shifted amount type is ShiftValueTy.
ExtractSubvectorCost getExtractSubvectorCost(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return the cost of extracting a subvector of type ResVT from a vector of type SrcVT,...
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
Align getPrefLoopAlignment(MachineLoop *ML, const MachineBasicBlock *BlockToAlign) const override
Return the preferred loop alignment.
SDValue lowerSET_FPENV(SDValue Op, SelectionDAG &DAG) const
bool shouldPreservePtrArith(const Function &F, EVT PtrVT) const override
True if target has some particular form of dealing with pointer arithmetic semantics for pointers wit...
void getTgtMemIntrinsic(SmallVectorImpl< IntrinsicInfo > &, const CallBase &, MachineFunction &MF, unsigned IntrinsicID) const override
Given an intrinsic, checks if on the target the intrinsic will need to map to a MemIntrinsicNode (tou...
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
SDValue lowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const
void allocateSpecialInputVGPRsFixed(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
Allocate implicit function VGPR arguments in fixed registers.
MachineBasicBlock * emitGWSMemViolTestLoop(MachineInstr &MI, MachineBasicBlock *BB) const
bool getAddrModeArguments(const IntrinsicInst *I, SmallVectorImpl< Value * > &Ops, Type *&AccessTy) const override
CodeGenPrepare sinks address calculations into the same BB as Load/Store instructions reading the add...
bool checkAsmConstraintValA(SDValue Op, uint64_t Val, unsigned MaxSize=64) const
bool shouldEmitFixup(const GlobalValue *GV) const
MachineBasicBlock * splitKillBlock(MachineInstr &MI, MachineBasicBlock *BB) const
void emitExpandAtomicCmpXchg(AtomicCmpXchgInst *CI) const override
Perform a cmpxchg expansion using a target-specific method.
bool canTransformPtrArithOutOfBounds(const Function &F, EVT PtrVT) const override
True if the target allows transformations of in-bounds pointer arithmetic that cause out-of-bounds in...
bool hasMemSDNodeUser(SDNode *N) const
bool isSDNodeSourceOfDivergence(const SDNode *N, FunctionLoweringInfo *FLI, UniformityInfo *UA) const override
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *BB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
bool isEligibleForTailCallOptimization(SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SmallVectorImpl< ISD::InputArg > &Ins, SelectionDAG &DAG) const
bool isMemOpHasNoClobberedMemOperand(const SDNode *N) const
bool isLegalFlatAddressingMode(const AddrMode &AM, unsigned AddrSpace) const
SDValue LowerCallResult(SDValue Chain, SDValue InGlue, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals, bool isThisReturn, SDValue ThisVal) const
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower the incoming (formal) arguments, described by the Ins array,...
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
bool isFPExtFoldable(const SelectionDAG &DAG, unsigned Opcode, EVT DestVT, EVT SrcVT) const override
Return true if an fpext operation input to an Opcode operation is free (for instance,...
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
Assign the register class depending on the number of bits set in the writemask.
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
void finalizeLowering(MachineFunction &MF) const override
Execute target specific actions to finalize target lowering.
static bool isNonGlobalAddrSpace(unsigned AS)
void emitExpandAtomicAddrSpacePredicate(Instruction *AI) const
MachineSDNode * buildRSRC(SelectionDAG &DAG, const SDLoc &DL, SDValue Ptr, uint32_t RsrcDword1, uint64_t RsrcDword2And3) const
Return a resource descriptor with the 'Add TID' bit enabled The TID (Thread ID) is multiplied by the ...
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain targets require unusual breakdowns of certain types.
bool mayBeEmittedAsTailCall(const CallInst *) const override
Return true if the target may be able emit the call instruction as a tail call.
void passSpecialInputs(CallLoweringInfo &CLI, CCState &CCInfo, const SIMachineFunctionInfo &Info, SmallVectorImpl< std::pair< unsigned, SDValue > > &RegsToPass, SmallVectorImpl< SDValue > &MemOpChains, SDValue Chain) const
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
bool checkAsmConstraintVal(SDValue Op, StringRef Constraint, uint64_t Val) const
bool isKnownNeverNaNForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool SNaN=false, unsigned Depth=0) const override
If SNaN is false,.
void emitExpandAtomicRMW(AtomicRMWInst *AI) const override
Perform a atomicrmw expansion using a target-specific way.
static bool shouldExpandVectorDynExt(unsigned EltSize, unsigned NumElem, bool IsDivergentIdx, const GCNSubtarget *Subtarget)
Check if EXTRACT_VECTOR_ELT/INSERT_VECTOR_ELT (<n x e>, var-idx) should be expanded into a set of cmp...
bool shouldUseLDSConstAddress(const GlobalValue *GV) const
bool supportSplitCSR(MachineFunction *MF) const override
Return true if the target supports that a subset of CSRs for the given machine function is handled ex...
bool isExtractVecEltCheap(EVT VT, unsigned Index) const override
Return true if extraction of a scalar element from the given vector type at the given index is cheap.
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const
bool allowsMisalignedMemoryAccesses(LLT Ty, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *IsFast=nullptr) const override
LLT handling variant.
unsigned combineRepeatedFPDivisors() const override
Indicate whether this target prefers to combine FDIVs with the same divisor.
bool canMergeStoresTo(unsigned AS, EVT MemVT, const MachineFunction &MF) const override
Returns if it's reasonable to merge stores to MemVT size.
SDValue lowerPREFETCH(SDValue Op, SelectionDAG &DAG) const
SITargetLowering(const TargetMachine &tm, const GCNSubtarget &STI)
void computeKnownBitsForTargetInstr(GISelValueTracking &Analysis, Register R, KnownBits &Known, const APInt &DemandedElts, const MachineRegisterInfo &MRI, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
bool isFreeAddrSpaceCast(const DataLayout &DL, unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast from SrcAS to DestAS is "cheap", such that e.g.
bool shouldEmitPCReloc(const GlobalValue *GV) const
bool isUniformLoad(const LoadSDNode *Load) const
AtomicExpansionKind shouldExpandAtomicCmpXchgInIR(const AtomicCmpXchgInst *AI) const override
Returns how the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass.
void initializeSplitCSR(MachineBasicBlock *Entry) const override
Perform necessary initialization to handle a subset of CSRs explicitly via copies.
void allocateSpecialEntryInputVGPRs(CCState &CCInfo, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
void allocatePreloadKernArgSGPRs(CCState &CCInfo, SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< ISD::InputArg > &Ins, MachineFunction &MF, const SIRegisterInfo &TRI, SIMachineFunctionInfo &Info) const
SDValue copyToM0(SelectionDAG &DAG, SDValue Chain, const SDLoc &DL, SDValue V) const
SDValue splitBinaryVectorOp(SDValue Op, SelectionDAG &DAG) const
MachinePointerInfo getKernargSegmentPtrInfo(MachineFunction &MF) const
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
MVT getPointerMemTy(const DataLayout &DL, unsigned AS) const override
Similarly, the in-memory representation of a p7 is {p8, i32}, aka v8i32 when padding is added.
void allocateSystemSGPRs(CCState &CCInfo, MachineFunction &MF, SIMachineFunctionInfo &Info, CallingConv::ID CallConv, bool IsShader) const
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context, const Type *RetTy) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
unsigned getMaxPermittedBytesForAlignment(MachineBasicBlock *MBB) const override
Return the maximum amount of bytes allowed to be emitted when padding for alignment.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
ExtractSubvectorCost
Enum that specifies how expensive lowering an EXTRACT_SUBVECTOR is.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
Primary interface to the complete machine description for the target machine.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
GenericUniformityInfo< SSAContext > UniformityInfo
@ Offset
Definition DWP.cpp:577
@ Known
Known to have no common set bits.
@ Load
The value being inserted comes from a load (InsertElement only).
bool isBoolSGPR(SDValue V)
DWARFExpression::Operation Op
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
#define N
The argument layout of a buffer intrinsic.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Represents the full denormal controls for a function, including the default mode and the f32 specific...
Extended Value Type.
Definition ValueTypes.h:35
InputArg - This struct carries flags and type information about a single incoming (formal) argument o...
This class contains a discriminated union of information about pointers in memory operands,...
These are IR-level optimization flags that may be propagated to SDNodes.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg + ScalableOffset*...