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 17 #include "AMDGPUISelLowering.h" 18 #include "AMDGPUArgumentUsageInfo.h" 19 20 namespace llvm { 21 22 class GCNSubtarget; 23 class SIMachineFunctionInfo; 24 class SIRegisterInfo; 25 26 namespace AMDGPU { 27 struct ImageDimIntrinsicInfo; 28 } 29 30 class SITargetLowering final : public AMDGPUTargetLowering { 31 private: 32 const GCNSubtarget *Subtarget; 33 34 public: 35 MVT getRegisterTypeForCallingConv(LLVMContext &Context, 36 CallingConv::ID CC, 37 EVT VT) const override; 38 unsigned getNumRegistersForCallingConv(LLVMContext &Context, 39 CallingConv::ID CC, 40 EVT VT) const override; 41 42 unsigned getVectorTypeBreakdownForCallingConv( 43 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, 44 unsigned &NumIntermediates, MVT &RegisterVT) const override; 45 46 private: 47 SDValue lowerKernArgParameterPtr(SelectionDAG &DAG, const SDLoc &SL, 48 SDValue Chain, uint64_t Offset) const; 49 SDValue getImplicitArgPtr(SelectionDAG &DAG, const SDLoc &SL) const; 50 SDValue lowerKernargMemParameter(SelectionDAG &DAG, EVT VT, EVT MemVT, 51 const SDLoc &SL, SDValue Chain, 52 uint64_t Offset, Align Alignment, 53 bool Signed, 54 const ISD::InputArg *Arg = nullptr) const; 55 56 SDValue lowerStackParameter(SelectionDAG &DAG, CCValAssign &VA, 57 const SDLoc &SL, SDValue Chain, 58 const ISD::InputArg &Arg) const; 59 SDValue getPreloadedValue(SelectionDAG &DAG, 60 const SIMachineFunctionInfo &MFI, 61 EVT VT, 62 AMDGPUFunctionArgInfo::PreloadedValue) const; 63 64 SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, 65 SelectionDAG &DAG) const override; 66 SDValue lowerImplicitZextParam(SelectionDAG &DAG, SDValue Op, 67 MVT VT, unsigned Offset) const; 68 SDValue lowerImage(SDValue Op, const AMDGPU::ImageDimIntrinsicInfo *Intr, 69 SelectionDAG &DAG, bool WithChain) const; 70 SDValue lowerSBuffer(EVT VT, SDLoc DL, SDValue Rsrc, SDValue Offset, 71 SDValue CachePolicy, SelectionDAG &DAG) const; 72 73 SDValue lowerRawBufferAtomicIntrin(SDValue Op, SelectionDAG &DAG, 74 unsigned NewOpcode) const; 75 SDValue lowerStructBufferAtomicIntrin(SDValue Op, SelectionDAG &DAG, 76 unsigned NewOpcode) const; 77 78 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; 79 SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const; 80 SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const; 81 82 // The raw.tbuffer and struct.tbuffer intrinsics have two offset args: offset 83 // (the offset that is included in bounds checking and swizzling, to be split 84 // between the instruction's voffset and immoffset fields) and soffset (the 85 // offset that is excluded from bounds checking and swizzling, to go in the 86 // instruction's soffset field). This function takes the first kind of 87 // offset and figures out how to split it between voffset and immoffset. 88 std::pair<SDValue, SDValue> splitBufferOffsets(SDValue Offset, 89 SelectionDAG &DAG) const; 90 91 SDValue widenLoad(LoadSDNode *Ld, DAGCombinerInfo &DCI) const; 92 SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const; 93 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; 94 SDValue lowerFastUnsafeFDIV(SDValue Op, SelectionDAG &DAG) const; 95 SDValue lowerFastUnsafeFDIV64(SDValue Op, SelectionDAG &DAG) const; 96 SDValue lowerFDIV_FAST(SDValue Op, SelectionDAG &DAG) const; 97 SDValue LowerFDIV16(SDValue Op, SelectionDAG &DAG) const; 98 SDValue LowerFDIV32(SDValue Op, SelectionDAG &DAG) const; 99 SDValue LowerFDIV64(SDValue Op, SelectionDAG &DAG) const; 100 SDValue LowerFDIV(SDValue Op, SelectionDAG &DAG) const; 101 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const; 102 SDValue LowerTrig(SDValue Op, SelectionDAG &DAG) const; 103 SDValue LowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const; 104 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const; 105 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; 106 SDValue adjustLoadValueType(unsigned Opcode, MemSDNode *M, 107 SelectionDAG &DAG, ArrayRef<SDValue> Ops, 108 bool IsIntrinsic = false) const; 109 110 SDValue lowerIntrinsicLoad(MemSDNode *M, bool IsFormat, SelectionDAG &DAG, 111 ArrayRef<SDValue> Ops) const; 112 113 // Call DAG.getMemIntrinsicNode for a load, but first widen a dwordx3 type to 114 // dwordx4 if on SI. 115 SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, 116 ArrayRef<SDValue> Ops, EVT MemVT, 117 MachineMemOperand *MMO, SelectionDAG &DAG) const; 118 119 SDValue handleD16VData(SDValue VData, SelectionDAG &DAG, 120 bool ImageStore = false) const; 121 122 /// Converts \p Op, which must be of floating point type, to the 123 /// floating point type \p VT, by either extending or truncating it. 124 SDValue getFPExtOrFPRound(SelectionDAG &DAG, 125 SDValue Op, 126 const SDLoc &DL, 127 EVT VT) const; 128 129 SDValue convertArgType( 130 SelectionDAG &DAG, EVT VT, EVT MemVT, const SDLoc &SL, SDValue Val, 131 bool Signed, const ISD::InputArg *Arg = nullptr) const; 132 133 /// Custom lowering for ISD::FP_ROUND for MVT::f16. 134 SDValue lowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const; 135 SDValue lowerFMINNUM_FMAXNUM(SDValue Op, SelectionDAG &DAG) const; 136 SDValue lowerXMULO(SDValue Op, SelectionDAG &DAG) const; 137 138 SDValue getSegmentAperture(unsigned AS, const SDLoc &DL, 139 SelectionDAG &DAG) const; 140 141 SDValue lowerADDRSPACECAST(SDValue Op, SelectionDAG &DAG) const; 142 SDValue lowerINSERT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const; 143 SDValue lowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; 144 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; 145 SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; 146 SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; 147 148 SDValue lowerTRAP(SDValue Op, SelectionDAG &DAG) const; 149 SDValue lowerTrapEndpgm(SDValue Op, SelectionDAG &DAG) const; 150 SDValue lowerTrapHsaQueuePtr(SDValue Op, SelectionDAG &DAG) const; 151 SDValue lowerTrapHsa(SDValue Op, SelectionDAG &DAG) const; 152 SDValue lowerDEBUGTRAP(SDValue Op, SelectionDAG &DAG) const; 153 154 SDNode *adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const; 155 156 SDValue performUCharToFloatCombine(SDNode *N, 157 DAGCombinerInfo &DCI) const; 158 SDValue performSHLPtrCombine(SDNode *N, 159 unsigned AS, 160 EVT MemVT, 161 DAGCombinerInfo &DCI) const; 162 163 SDValue performMemSDNodeCombine(MemSDNode *N, DAGCombinerInfo &DCI) const; 164 165 SDValue splitBinaryBitConstantOp(DAGCombinerInfo &DCI, const SDLoc &SL, 166 unsigned Opc, SDValue LHS, 167 const ConstantSDNode *CRHS) const; 168 169 SDValue performAndCombine(SDNode *N, DAGCombinerInfo &DCI) const; 170 SDValue performOrCombine(SDNode *N, DAGCombinerInfo &DCI) const; 171 SDValue performXorCombine(SDNode *N, DAGCombinerInfo &DCI) const; 172 SDValue performZeroExtendCombine(SDNode *N, DAGCombinerInfo &DCI) const; 173 SDValue performSignExtendInRegCombine(SDNode *N, DAGCombinerInfo &DCI) const; 174 SDValue performClassCombine(SDNode *N, DAGCombinerInfo &DCI) const; 175 SDValue getCanonicalConstantFP(SelectionDAG &DAG, const SDLoc &SL, EVT VT, 176 const APFloat &C) const; 177 SDValue performFCanonicalizeCombine(SDNode *N, DAGCombinerInfo &DCI) const; 178 179 SDValue performFPMed3ImmCombine(SelectionDAG &DAG, const SDLoc &SL, 180 SDValue Op0, SDValue Op1) const; 181 SDValue performIntMed3ImmCombine(SelectionDAG &DAG, const SDLoc &SL, 182 SDValue Op0, SDValue Op1, bool Signed) const; 183 SDValue performMinMaxCombine(SDNode *N, DAGCombinerInfo &DCI) const; 184 SDValue performFMed3Combine(SDNode *N, DAGCombinerInfo &DCI) const; 185 SDValue performCvtPkRTZCombine(SDNode *N, DAGCombinerInfo &DCI) const; 186 SDValue performExtractVectorEltCombine(SDNode *N, DAGCombinerInfo &DCI) const; 187 SDValue performInsertVectorEltCombine(SDNode *N, DAGCombinerInfo &DCI) const; 188 189 SDValue reassociateScalarOps(SDNode *N, SelectionDAG &DAG) const; 190 unsigned getFusedOpcode(const SelectionDAG &DAG, 191 const SDNode *N0, const SDNode *N1) const; 192 SDValue performAddCombine(SDNode *N, DAGCombinerInfo &DCI) const; 193 SDValue performAddCarrySubCarryCombine(SDNode *N, DAGCombinerInfo &DCI) const; 194 SDValue performSubCombine(SDNode *N, DAGCombinerInfo &DCI) const; 195 SDValue performFAddCombine(SDNode *N, DAGCombinerInfo &DCI) const; 196 SDValue performFSubCombine(SDNode *N, DAGCombinerInfo &DCI) const; 197 SDValue performFMACombine(SDNode *N, DAGCombinerInfo &DCI) const; 198 SDValue performSetCCCombine(SDNode *N, DAGCombinerInfo &DCI) const; 199 SDValue performCvtF32UByteNCombine(SDNode *N, DAGCombinerInfo &DCI) const; 200 SDValue performClampCombine(SDNode *N, DAGCombinerInfo &DCI) const; 201 SDValue performRcpCombine(SDNode *N, DAGCombinerInfo &DCI) const; 202 203 bool isLegalFlatAddressingMode(const AddrMode &AM) const; 204 bool isLegalMUBUFAddressingMode(const AddrMode &AM) const; 205 206 unsigned isCFIntrinsic(const SDNode *Intr) const; 207 208 public: 209 /// \returns True if fixup needs to be emitted for given global value \p GV, 210 /// false otherwise. 211 bool shouldEmitFixup(const GlobalValue *GV) const; 212 213 /// \returns True if GOT relocation needs to be emitted for given global value 214 /// \p GV, false otherwise. 215 bool shouldEmitGOTReloc(const GlobalValue *GV) const; 216 217 /// \returns True if PC-relative relocation needs to be emitted for given 218 /// global value \p GV, false otherwise. 219 bool shouldEmitPCReloc(const GlobalValue *GV) const; 220 221 /// \returns true if this should use a literal constant for an LDS address, 222 /// and not emit a relocation for an LDS global. 223 bool shouldUseLDSConstAddress(const GlobalValue *GV) const; 224 225 /// Check if EXTRACT_VECTOR_ELT/INSERT_VECTOR_ELT (<n x e>, var-idx) should be 226 /// expanded into a set of cmp/select instructions. 227 static bool shouldExpandVectorDynExt(unsigned EltSize, unsigned NumElem, 228 bool IsDivergentIdx); 229 230 private: 231 // Analyze a combined offset from an amdgcn_buffer_ intrinsic and store the 232 // three offsets (voffset, soffset and instoffset) into the SDValue[3] array 233 // pointed to by Offsets. 234 void setBufferOffsets(SDValue CombinedOffset, SelectionDAG &DAG, 235 SDValue *Offsets, Align Alignment = Align(4)) const; 236 237 // Handle 8 bit and 16 bit buffer loads 238 SDValue handleByteShortBufferLoads(SelectionDAG &DAG, EVT LoadVT, SDLoc DL, 239 ArrayRef<SDValue> Ops, MemSDNode *M) const; 240 241 // Handle 8 bit and 16 bit buffer stores 242 SDValue handleByteShortBufferStores(SelectionDAG &DAG, EVT VDataType, 243 SDLoc DL, SDValue Ops[], 244 MemSDNode *M) const; 245 246 public: 247 SITargetLowering(const TargetMachine &tm, const GCNSubtarget &STI); 248 249 const GCNSubtarget *getSubtarget() const; 250 251 bool isFPExtFoldable(const SelectionDAG &DAG, unsigned Opcode, EVT DestVT, 252 EVT SrcVT) const override; 253 254 bool isShuffleMaskLegal(ArrayRef<int> /*Mask*/, EVT /*VT*/) const override; 255 256 bool getTgtMemIntrinsic(IntrinsicInfo &, const CallInst &, 257 MachineFunction &MF, 258 unsigned IntrinsicID) const override; 259 260 bool getAddrModeArguments(IntrinsicInst * /*I*/, 261 SmallVectorImpl<Value*> &/*Ops*/, 262 Type *&/*AccessTy*/) const override; 263 264 bool isLegalGlobalAddressingMode(const AddrMode &AM) const; 265 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, 266 unsigned AS, 267 Instruction *I = nullptr) const override; 268 269 bool canMergeStoresTo(unsigned AS, EVT MemVT, 270 const SelectionDAG &DAG) const override; 271 272 bool allowsMisalignedMemoryAccessesImpl( 273 unsigned Size, unsigned AddrSpace, Align Alignment, 274 MachineMemOperand::Flags Flags = MachineMemOperand::MONone, 275 bool *IsFast = nullptr) const; 276 277 bool allowsMisalignedMemoryAccesses( 278 LLT Ty, unsigned AddrSpace, Align Alignment, 279 MachineMemOperand::Flags Flags = MachineMemOperand::MONone, 280 bool *IsFast = nullptr) const override { 281 if (IsFast) 282 *IsFast = false; 283 return allowsMisalignedMemoryAccessesImpl(Ty.getSizeInBits(), AddrSpace, 284 Alignment, Flags, IsFast); 285 } 286 287 bool allowsMisalignedMemoryAccesses( 288 EVT VT, unsigned AS, Align Alignment, 289 MachineMemOperand::Flags Flags = MachineMemOperand::MONone, 290 bool *IsFast = nullptr) const override; 291 292 EVT getOptimalMemOpType(const MemOp &Op, 293 const AttributeList &FuncAttributes) const override; 294 295 bool isMemOpUniform(const SDNode *N) const; 296 bool isMemOpHasNoClobberedMemOperand(const SDNode *N) const; 297 298 static bool isNonGlobalAddrSpace(unsigned AS); 299 300 bool isFreeAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override; 301 302 TargetLoweringBase::LegalizeTypeAction 303 getPreferredVectorAction(MVT VT) const override; 304 305 bool shouldConvertConstantLoadToIntImm(const APInt &Imm, 306 Type *Ty) const override; 307 308 bool isTypeDesirableForOp(unsigned Op, EVT VT) const override; 309 310 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; 311 312 bool supportSplitCSR(MachineFunction *MF) const override; 313 void initializeSplitCSR(MachineBasicBlock *Entry) const override; 314 void insertCopiesSplitCSR( 315 MachineBasicBlock *Entry, 316 const SmallVectorImpl<MachineBasicBlock *> &Exits) const override; 317 318 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, 319 bool isVarArg, 320 const SmallVectorImpl<ISD::InputArg> &Ins, 321 const SDLoc &DL, SelectionDAG &DAG, 322 SmallVectorImpl<SDValue> &InVals) const override; 323 324 bool CanLowerReturn(CallingConv::ID CallConv, 325 MachineFunction &MF, bool isVarArg, 326 const SmallVectorImpl<ISD::OutputArg> &Outs, 327 LLVMContext &Context) const override; 328 329 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, 330 const SmallVectorImpl<ISD::OutputArg> &Outs, 331 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL, 332 SelectionDAG &DAG) const override; 333 334 void passSpecialInputs( 335 CallLoweringInfo &CLI, 336 CCState &CCInfo, 337 const SIMachineFunctionInfo &Info, 338 SmallVectorImpl<std::pair<unsigned, SDValue>> &RegsToPass, 339 SmallVectorImpl<SDValue> &MemOpChains, 340 SDValue Chain) const; 341 342 SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 343 CallingConv::ID CallConv, bool isVarArg, 344 const SmallVectorImpl<ISD::InputArg> &Ins, 345 const SDLoc &DL, SelectionDAG &DAG, 346 SmallVectorImpl<SDValue> &InVals, bool isThisReturn, 347 SDValue ThisVal) const; 348 349 bool mayBeEmittedAsTailCall(const CallInst *) const override; 350 351 bool isEligibleForTailCallOptimization( 352 SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg, 353 const SmallVectorImpl<ISD::OutputArg> &Outs, 354 const SmallVectorImpl<SDValue> &OutVals, 355 const SmallVectorImpl<ISD::InputArg> &Ins, SelectionDAG &DAG) const; 356 357 SDValue LowerCall(CallLoweringInfo &CLI, 358 SmallVectorImpl<SDValue> &InVals) const override; 359 360 SDValue lowerDYNAMIC_STACKALLOCImpl(SDValue Op, SelectionDAG &DAG) const; 361 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const; 362 363 Register getRegisterByName(const char* RegName, LLT VT, 364 const MachineFunction &MF) const override; 365 366 MachineBasicBlock *splitKillBlock(MachineInstr &MI, 367 MachineBasicBlock *BB) const; 368 369 void bundleInstWithWaitcnt(MachineInstr &MI) const; 370 MachineBasicBlock *emitGWSMemViolTestLoop(MachineInstr &MI, 371 MachineBasicBlock *BB) const; 372 373 MachineBasicBlock * 374 EmitInstrWithCustomInserter(MachineInstr &MI, 375 MachineBasicBlock *BB) const override; 376 377 bool hasBitPreservingFPLogic(EVT VT) const override; 378 bool enableAggressiveFMAFusion(EVT VT) const override; 379 EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, 380 EVT VT) const override; 381 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override; 382 LLT getPreferredShiftAmountTy(LLT Ty) const override; 383 384 bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, 385 EVT VT) const override; 386 bool isFMADLegal(const SelectionDAG &DAG, const SDNode *N) const override; 387 388 SDValue splitUnaryVectorOp(SDValue Op, SelectionDAG &DAG) const; 389 SDValue splitBinaryVectorOp(SDValue Op, SelectionDAG &DAG) const; 390 SDValue splitTernaryVectorOp(SDValue Op, SelectionDAG &DAG) const; 391 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; 392 393 void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results, 394 SelectionDAG &DAG) const override; 395 396 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; 397 SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override; 398 void AddIMGInit(MachineInstr &MI) const; 399 void AdjustInstrPostInstrSelection(MachineInstr &MI, 400 SDNode *Node) const override; 401 402 SDNode *legalizeTargetIndependentNode(SDNode *Node, SelectionDAG &DAG) const; 403 404 MachineSDNode *wrapAddr64Rsrc(SelectionDAG &DAG, const SDLoc &DL, 405 SDValue Ptr) const; 406 MachineSDNode *buildRSRC(SelectionDAG &DAG, const SDLoc &DL, SDValue Ptr, 407 uint32_t RsrcDword1, uint64_t RsrcDword2And3) const; 408 std::pair<unsigned, const TargetRegisterClass *> 409 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, 410 StringRef Constraint, MVT VT) const override; 411 ConstraintType getConstraintType(StringRef Constraint) const override; 412 void LowerAsmOperandForConstraint(SDValue Op, 413 std::string &Constraint, 414 std::vector<SDValue> &Ops, 415 SelectionDAG &DAG) const override; 416 bool getAsmOperandConstVal(SDValue Op, uint64_t &Val) const; 417 bool checkAsmConstraintVal(SDValue Op, 418 const std::string &Constraint, 419 uint64_t Val) const; 420 bool checkAsmConstraintValA(SDValue Op, 421 uint64_t Val, 422 unsigned MaxSize = 64) const; 423 SDValue copyToM0(SelectionDAG &DAG, SDValue Chain, const SDLoc &DL, 424 SDValue V) const; 425 426 void finalizeLowering(MachineFunction &MF) const override; 427 428 void computeKnownBitsForFrameIndex(int FrameIdx, 429 KnownBits &Known, 430 const MachineFunction &MF) const override; 431 void computeKnownBitsForTargetInstr(GISelKnownBits &Analysis, Register R, 432 KnownBits &Known, 433 const APInt &DemandedElts, 434 const MachineRegisterInfo &MRI, 435 unsigned Depth = 0) const override; 436 437 Align computeKnownAlignForTargetInstr(GISelKnownBits &Analysis, Register R, 438 const MachineRegisterInfo &MRI, 439 unsigned Depth = 0) const override; 440 bool isSDNodeSourceOfDivergence(const SDNode *N, 441 FunctionLoweringInfo *FLI, LegacyDivergenceAnalysis *DA) const override; 442 443 bool isCanonicalized(SelectionDAG &DAG, SDValue Op, 444 unsigned MaxDepth = 5) const; 445 bool isCanonicalized(Register Reg, MachineFunction &MF, 446 unsigned MaxDepth = 5) const; 447 bool denormalsEnabledForType(const SelectionDAG &DAG, EVT VT) const; 448 bool denormalsEnabledForType(LLT Ty, MachineFunction &MF) const; 449 450 bool isKnownNeverNaNForTargetNode(SDValue Op, 451 const SelectionDAG &DAG, 452 bool SNaN = false, 453 unsigned Depth = 0) const override; 454 AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *) const override; 455 456 virtual const TargetRegisterClass * 457 getRegClassFor(MVT VT, bool isDivergent) const override; 458 virtual bool requiresUniformRegister(MachineFunction &MF, 459 const Value *V) const override; 460 Align getPrefLoopAlignment(MachineLoop *ML) const override; 461 462 void allocateHSAUserSGPRs(CCState &CCInfo, 463 MachineFunction &MF, 464 const SIRegisterInfo &TRI, 465 SIMachineFunctionInfo &Info) const; 466 467 void allocateSystemSGPRs(CCState &CCInfo, 468 MachineFunction &MF, 469 SIMachineFunctionInfo &Info, 470 CallingConv::ID CallConv, 471 bool IsShader) const; 472 473 void allocateSpecialEntryInputVGPRs(CCState &CCInfo, 474 MachineFunction &MF, 475 const SIRegisterInfo &TRI, 476 SIMachineFunctionInfo &Info) const; 477 void allocateSpecialInputSGPRs( 478 CCState &CCInfo, 479 MachineFunction &MF, 480 const SIRegisterInfo &TRI, 481 SIMachineFunctionInfo &Info) const; 482 483 void allocateSpecialInputVGPRs(CCState &CCInfo, 484 MachineFunction &MF, 485 const SIRegisterInfo &TRI, 486 SIMachineFunctionInfo &Info) const; 487 void allocateSpecialInputVGPRsFixed(CCState &CCInfo, 488 MachineFunction &MF, 489 const SIRegisterInfo &TRI, 490 SIMachineFunctionInfo &Info) const; 491 492 std::pair<InstructionCost, MVT> getTypeLegalizationCost(const DataLayout &DL, 493 Type *Ty) const; 494 }; 495 496 } // End namespace llvm 497 498 #endif 499