LLVM 22.0.0git
AMDGPUISelLowering.h
Go to the documentation of this file.
1//===-- AMDGPUISelLowering.h - AMDGPU 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/// Interface definition of the TargetLowering class that is common
11/// to all AMD GPUs.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUISELLOWERING_H
16#define LLVM_LIB_TARGET_AMDGPU_AMDGPUISELLOWERING_H
17
20
21namespace llvm {
22
23class AMDGPUMachineFunction;
24class AMDGPUSubtarget;
25struct ArgDescriptor;
26
28private:
29 const AMDGPUSubtarget *Subtarget;
30
31 /// \returns AMDGPUISD::FFBH_U32 node if the incoming \p Op may have been
32 /// legalized from a smaller type VT. Need to match pre-legalized type because
33 /// the generic legalization inserts the add/sub between the select and
34 /// compare.
35 SDValue getFFBX_U32(SelectionDAG &DAG, SDValue Op, const SDLoc &DL, unsigned Opc) const;
36
37public:
38 /// \returns The minimum number of bits needed to store the value of \Op as an
39 /// unsigned integer. Truncating to this size and then zero-extending to the
40 /// original size will not change the value.
41 static unsigned numBitsUnsigned(SDValue Op, SelectionDAG &DAG);
42
43 /// \returns The minimum number of bits needed to store the value of \Op as a
44 /// signed integer. Truncating to this size and then sign-extending to the
45 /// original size will not change the value.
46 static unsigned numBitsSigned(SDValue Op, SelectionDAG &DAG);
47
48protected:
51 /// Split a vector store into multiple scalar stores.
52 /// \returns The resulting chain.
53
59
63
64 static bool allowApproxFunc(const SelectionDAG &DAG, SDNodeFlags Flags);
65 static bool needsDenormHandlingF32(const SelectionDAG &DAG, SDValue Src,
66 SDNodeFlags Flags);
68 SDNodeFlags Flags) const;
70 std::pair<SDValue, SDValue> getScaledLogInput(SelectionDAG &DAG,
71 const SDLoc SL, SDValue Op,
72 SDNodeFlags Flags) const;
73
78 bool IsLog10, SDNodeFlags Flags) const;
80
82 SDNodeFlags Flags) const;
84 SDNodeFlags Flags) const;
86
88
90
95
99
101 SelectionDAG &DAG) const;
102
104
105protected:
106 bool shouldCombineMemoryType(EVT VT) const;
111
113 unsigned Opc, SDValue LHS,
114 uint32_t ValLo, uint32_t ValHi) const;
124 SDValue RHS, DAGCombinerInfo &DCI) const;
125
127 SDValue N) const;
129
132
138
140
142 SelectionDAG &DAG) const;
143
144 /// Return 64-bit value Op as two 32-bit integers.
145 std::pair<SDValue, SDValue> split64BitValue(SDValue Op,
146 SelectionDAG &DAG) const;
149
150 /// Split a vector type into two parts. The first part is a power of two
151 /// vector. The second part is whatever is left over, and is a scalar if it
152 /// would otherwise be a 1-vector.
153 std::pair<EVT, EVT> getSplitDestVTs(const EVT &VT, SelectionDAG &DAG) const;
154
155 /// Split a vector value into two parts of types LoVT and HiVT. HiVT could be
156 /// scalar.
157 std::pair<SDValue, SDValue> splitVector(const SDValue &N, const SDLoc &DL,
158 const EVT &LoVT, const EVT &HighVT,
159 SelectionDAG &DAG) const;
160
161 /// Split a vector load into 2 loads of half the vector.
163
164 /// Widen a suitably aligned v3 load. For all other cases, split the input
165 /// vector load.
167
168 /// Split a vector store into 2 stores of half the vector.
170
174 SDValue LowerDIVREM24(SDValue Op, SelectionDAG &DAG, bool sign) const;
177
179 CCState &State,
180 const SmallVectorImpl<ISD::InputArg> &Ins) const;
181
182public:
184
185 bool mayIgnoreSignedZero(SDValue Op) const;
186
187 static inline SDValue stripBitcast(SDValue Val) {
188 return Val.getOpcode() == ISD::BITCAST ? Val.getOperand(0) : Val;
189 }
190
191 static bool shouldFoldFNegIntoSrc(SDNode *FNeg, SDValue FNegSrc);
192 static bool allUsesHaveSourceMods(const SDNode *N,
193 unsigned CostThreshold = 4);
194 bool isFAbsFree(EVT VT) const override;
195 bool isFNegFree(EVT VT) const override;
196 bool isTruncateFree(EVT Src, EVT Dest) const override;
197 bool isTruncateFree(Type *Src, Type *Dest) const override;
198
199 bool isZExtFree(Type *Src, Type *Dest) const override;
200 bool isZExtFree(EVT Src, EVT Dest) const override;
201
203 bool LegalOperations, bool ForCodeSize,
205 unsigned Depth) const override;
206
207 bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override;
208
210 CombineLevel Level) const override;
211
213 ISD::NodeType ExtendKind) const override;
214
215 unsigned getVectorIdxWidth(const DataLayout &) const override;
216 bool isSelectSupported(SelectSupportKind) const override;
217
218 bool isFPImmLegal(const APFloat &Imm, EVT VT,
219 bool ForCodeSize) const override;
220 bool ShouldShrinkFPConstant(EVT VT) const override;
221 bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtType, EVT ExtVT,
222 std::optional<unsigned> ByteOffset) const override;
223
225 const MachineMemOperand &MMO) const final;
226
227 bool storeOfVectorConstantIsCheap(bool IsZero, EVT MemVT,
228 unsigned NumElem,
229 unsigned AS) const override;
230 bool aggressivelyPreferBuildVectorSources(EVT VecVT) const override;
231 bool isCheapToSpeculateCttz(Type *Ty) const override;
232 bool isCheapToSpeculateCtlz(Type *Ty) const override;
233
234 bool isSDNodeAlwaysUniform(const SDNode *N) const override;
235
236 // FIXME: This hook should not exist
239 }
240
243 }
244
247 }
248
249 static CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg);
250 static CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg);
251
252 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
254 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
255 SelectionDAG &DAG) const override;
256
258 SelectionDAG &DAG,
259 MachineFrameInfo &MFI,
260 int ClobberedFI) const;
261
262 SDValue lowerUnhandledCall(CallLoweringInfo &CLI,
264 StringRef Reason) const;
265 SDValue LowerCall(CallLoweringInfo &CLI,
266 SmallVectorImpl<SDValue> &InVals) const override;
267
269 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
270 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
273 SelectionDAG &DAG) const override;
274
276 SDValue RHS, SDValue True, SDValue False,
277 SDValue CC, DAGCombinerInfo &DCI) const;
278
280 SDValue RHS, SDValue True, SDValue False,
281 SDValue CC, DAGCombinerInfo &DCI) const;
282
283 const char* getTargetNodeName(unsigned Opcode) const override;
284
285 // FIXME: Turn off MergeConsecutiveStores() before Instruction Selection for
286 // AMDGPU. Commit r319036,
287 // (https://github.com/llvm/llvm-project/commit/db77e57ea86d941a4262ef60261692f4cb6893e6)
288 // turned on MergeConsecutiveStores() before Instruction Selection for all
289 // targets. Enough AMDGPU compiles go into an infinite loop (
290 // MergeConsecutiveStores() merges two stores; LegalizeStoreOps() un-merges;
291 // MergeConsecutiveStores() re-merges, etc. ) to warrant turning it off for
292 // now.
293 bool mergeStoresAfterLegalization(EVT) const override { return false; }
294
295 bool isFsqrtCheap(SDValue Operand, SelectionDAG &DAG) const override {
296 return true;
297 }
299 int &RefinementSteps, bool &UseOneConstNR,
300 bool Reciprocal) const override;
302 int &RefinementSteps) const override;
303
305 SelectionDAG &DAG) const = 0;
306
307 /// Determine which of the bits specified in \p Mask are known to be
308 /// either zero or one and return them in the \p KnownZero and \p KnownOne
309 /// bitsets.
311 KnownBits &Known,
312 const APInt &DemandedElts,
313 const SelectionDAG &DAG,
314 unsigned Depth = 0) const override;
315
316 unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts,
317 const SelectionDAG &DAG,
318 unsigned Depth = 0) const override;
319
321 Register R,
322 const APInt &DemandedElts,
324 unsigned Depth = 0) const override;
325
327 const APInt &DemandedElts,
328 const SelectionDAG &DAG,
329 bool PoisonOnly, bool ConsiderFlags,
330 unsigned Depth) const override;
331
332 bool isKnownNeverNaNForTargetNode(SDValue Op, const APInt &DemandedElts,
333 const SelectionDAG &DAG, bool SNaN = false,
334 unsigned Depth = 0) const override;
335
337 Register N1) const override;
338
339 /// Helper function that adds Reg to the LiveIn list of the DAG's
340 /// MachineFunction.
341 ///
342 /// \returns a RegisterSDNode representing Reg if \p RawReg is true, otherwise
343 /// a copy from the register.
345 const TargetRegisterClass *RC,
346 Register Reg, EVT VT,
347 const SDLoc &SL,
348 bool RawReg = false) const;
350 const TargetRegisterClass *RC,
351 Register Reg, EVT VT) const {
352 return CreateLiveInRegister(DAG, RC, Reg, VT, SDLoc(DAG.getEntryNode()));
353 }
354
355 // Returns the raw live in register rather than a copy from it.
357 const TargetRegisterClass *RC,
358 Register Reg, EVT VT) const {
359 return CreateLiveInRegister(DAG, RC, Reg, VT, SDLoc(DAG.getEntryNode()), true);
360 }
361
362 /// Similar to CreateLiveInRegister, except value maybe loaded from a stack
363 /// slot rather than passed in a register.
365 EVT VT,
366 const SDLoc &SL,
367 int64_t Offset) const;
368
370 const SDLoc &SL,
371 SDValue Chain,
372 SDValue ArgVal,
373 int64_t Offset) const;
374
376 const TargetRegisterClass *RC,
377 EVT VT, const SDLoc &SL,
378 const ArgDescriptor &Arg) const;
379
385 };
386
387 /// Helper function that returns the byte offset of the given
388 /// type of implicit parameter.
390 const ImplicitParameter Param) const;
391 uint32_t getImplicitParameterOffset(const uint64_t ExplicitKernArgSize,
392 const ImplicitParameter Param) const;
393
394 MVT getFenceOperandTy(const DataLayout &DL) const override {
395 return MVT::i32;
396 }
397
398 bool hasMultipleConditionRegisters(EVT VT) const override {
399 // FIXME: This is only partially true. If we have to do vector compares, any
400 // SGPR pair can be a condition register. If we have a uniform condition, we
401 // are better off doing SALU operations, where there is only one SCC. For
402 // now, we don't have a way of knowing during instruction selection if a
403 // condition will be uniform and we always use vector compares. Assume we
404 // are using vector compares until that is fixed.
405 return true;
406 }
407};
408
409namespace AMDGPUISD {
410
411enum NodeType : unsigned {
412 // AMDIL ISD Opcodes
415 // End AMDIL ISD Opcodes
416
417 // Function call.
424
425 // Masked control flow nodes.
429
430 // A uniform kernel return that terminates the wavefront.
432
433 // s_endpgm, but we may want to insert it in the middle of the block.
435
436 // "s_trap 2" equivalent on hardware that does not support it.
438
439 // Return to a shader part's epilog code.
441
442 // Return with values from a non-entry function.
444
445 // Convert a unswizzled wave uniform stack address to an address compatible
446 // with a vector offset for use in stack access.
448
451
452 /// CLAMP value between 0.0 and 1.0. NaN clamped to 0, following clamp output
453 /// modifier behavior with dx10_enable.
455
456 // This is SETCC with the full mask result which is used for a compare with a
457 // result bit per item in the wavefront.
459
461
462 // FP ops with input and output chain.
465
466 // SIN_HW, COS_HW - f32 for SI, 1 ULP max error, valid from -100 pi to 100 pi.
467 // Denormals handled on some parts.
472
489 // For emitting ISD::FMAD when f32 denormals are enabled because mac/mad is
490 // treated as an illegal operation.
492
493 // RCP, RSQ - For f32, 1 ULP max error, no denormal handling.
494 // For f64, max error 2^29 ULP, handles denormals.
499
500 // log2, no denormal handling for f32.
502
503 // exp2, no denormal handling for f32.
505
512 BFE_U32, // Extract range of bits with zero extension to 32-bits.
513 BFE_I32, // Extract range of bits with sign extension to 32-bits.
514 BFI, // (src0 & src1) | (~src0 & src2)
515 BFM, // Insert a range of bits into a 32-bit word.
516 FFBH_U32, // ctlz with -1 if input is zero.
518 FFBL_B32, // cttz with -1 if input is zero.
533
534 // These cvt_f32_ubyte* nodes need to remain consecutive and in order.
539
540 // Convert two float 32 numbers into a single register holding two packed f16
541 // with round to zero.
547
548 // Same as the standard node, except the high bits of the resulting integer
549 // are known 0.
551
552 /// This node is for VLIW targets and it is used to represent a vector
553 /// that is stored in consecutive registers with the same channel.
554 /// For example:
555 /// |X |Y|Z|W|
556 /// T0|v.x| | | |
557 /// T1|v.y| | | |
558 /// T2|v.z| | | |
559 /// T3|v.w| | | |
561 /// Pointer to the start of the shader's constant data.
566
568
576
627
628 // Set up a whole wave function.
630
631 // Return from a whole wave function.
633};
634
635} // End namespace AMDGPUISD
636
637} // End namespace llvm
638
639#endif
unsigned const MachineRegisterInfo * MRI
#define AMDGPUSubtarget
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
block Block Frequency Analysis
Register Reg
const SmallVectorImpl< MachineOperand > & Cond
This file describes how to lower LLVM code to machine code.
Value * RHS
Value * LHS
static unsigned numBitsSigned(SDValue Op, SelectionDAG &DAG)
SDValue combineFMinMaxLegacy(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, SDValue True, SDValue False, SDValue CC, DAGCombinerInfo &DCI) const
Generate Min/Max node.
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
This method can be implemented by targets that want to expose additional information about sign bits ...
SDValue performMulhuCombine(SDNode *N, DAGCombinerInfo &DCI) const
EVT getTypeForExtReturn(LLVMContext &Context, EVT VT, ISD::NodeType ExtendKind) const override
Return the type that should be used to zero or sign extend a zeroext/signext integer return value.
SDValue SplitVectorLoad(SDValue Op, SelectionDAG &DAG) const
Split a vector load into 2 loads of half the vector.
SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const
SDValue performLoadCombine(SDNode *N, DAGCombinerInfo &DCI) const
void analyzeFormalArgumentsCompute(CCState &State, const SmallVectorImpl< ISD::InputArg > &Ins) const
The SelectionDAGBuilder will automatically promote function arguments with illegal types.
SDValue LowerF64ToF16Safe(SDValue Src, const SDLoc &DL, SelectionDAG &DAG) const
SDValue LowerFROUND(SDValue Op, SelectionDAG &DAG) const
SDValue storeStackInputValue(SelectionDAG &DAG, const SDLoc &SL, SDValue Chain, SDValue ArgVal, int64_t Offset) const
bool storeOfVectorConstantIsCheap(bool IsZero, EVT MemVT, unsigned NumElem, unsigned AS) const override
Return true if it is expected to be cheaper to do a store of vector constant with the given size and ...
SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const
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...
bool shouldCombineMemoryType(EVT VT) const
SDValue splitBinaryBitConstantOpImpl(DAGCombinerInfo &DCI, const SDLoc &SL, unsigned Opc, SDValue LHS, uint32_t ValLo, uint32_t ValHi) const
Split the 64-bit value LHS into two 32-bit components, and perform the binary operation Opc to it wit...
SDValue lowerUnhandledCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals, StringRef Reason) const
SDValue performAssertSZExtCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const
bool isTruncateFree(EVT Src, EVT Dest) const override
bool aggressivelyPreferBuildVectorSources(EVT VecVT) const override
SDValue LowerFCEIL(SDValue Op, SelectionDAG &DAG) const
TargetLowering::NegatibleCost getConstantNegateCost(const ConstantFPSDNode *C) const
SDValue LowerFLOGUnsafe(SDValue Op, const SDLoc &SL, SelectionDAG &DAG, bool IsLog10, SDNodeFlags Flags) const
bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const override
Return true if Op can create undef or poison from non-undef & non-poison operands.
SDValue performMulhsCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool isSDNodeAlwaysUniform(const SDNode *N) const override
bool isDesirableToCommuteWithShift(const SDNode *N, CombineLevel Level) const override
Return true if it is profitable to move this shift by a constant amount through its operand,...
SDValue LowerFREM(SDValue Op, SelectionDAG &DAG) const
Split a vector store into multiple scalar stores.
virtual SDNode * PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const =0
SDValue performShlCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
SDValue LowerSDIVREM(SDValue Op, SelectionDAG &DAG) const
bool isFNegFree(EVT VT) const override
Return true if an fneg operation is free to the point where it is never worthwhile to replace it with...
SDValue LowerFLOG10(SDValue Op, SelectionDAG &DAG) const
SDValue LowerINT_TO_FP64(SDValue Op, SelectionDAG &DAG, bool Signed) const
unsigned computeNumSignBitsForTargetInstr(GISelValueTracking &Analysis, Register R, const APInt &DemandedElts, const MachineRegisterInfo &MRI, unsigned Depth=0) const override
This method can be implemented by targets that want to expose additional information about sign bits ...
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...
SDValue LowerFP_TO_FP16(SDValue Op, SelectionDAG &DAG) const
SDValue addTokenForArgument(SDValue Chain, SelectionDAG &DAG, MachineFrameInfo &MFI, int ClobberedFI) const
bool isConstantCheaperToNegate(SDValue N) const
bool isReassocProfitable(MachineRegisterInfo &MRI, Register N0, Register N1) const override
bool isKnownNeverNaNForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool SNaN=false, unsigned Depth=0) const override
If SNaN is false,.
static bool needsDenormHandlingF32(const SelectionDAG &DAG, SDValue Src, SDNodeFlags Flags)
MVT getFenceOperandTy(const DataLayout &DL) const override
Return the type for operands of fence.
uint32_t getImplicitParameterOffset(const MachineFunction &MF, const ImplicitParameter Param) const
Helper function that returns the byte offset of the given type of implicit parameter.
SDValue LowerFFLOOR(SDValue Op, SelectionDAG &DAG) const
SDValue performSelectCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue performFNegCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const
virtual SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, SelectionDAG &DAG) const
bool isConstantCostlierToNegate(SDValue N) const
SDValue loadInputValue(SelectionDAG &DAG, const TargetRegisterClass *RC, EVT VT, const SDLoc &SL, const ArgDescriptor &Arg) const
SDValue LowerDIVREM24(SDValue Op, SelectionDAG &DAG, bool sign) const
SDValue lowerFEXP10Unsafe(SDValue Op, const SDLoc &SL, SelectionDAG &DAG, SDNodeFlags Flags) const
Emit approx-funcs appropriate lowering for exp10.
bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtType, EVT ExtVT, std::optional< unsigned > ByteOffset) const override
Return true if it is profitable to reduce a load to a smaller type.
SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const
SDValue CreateLiveInRegisterRaw(SelectionDAG &DAG, const TargetRegisterClass *RC, Register Reg, EVT VT) const
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
SDValue performCtlz_CttzCombine(const SDLoc &SL, SDValue Cond, SDValue LHS, SDValue RHS, DAGCombinerInfo &DCI) const
SDValue performSraCombine(SDNode *N, DAGCombinerInfo &DCI) const
bool isSelectSupported(SelectSupportKind) const override
bool isZExtFree(Type *Src, Type *Dest) const override
Return true if any actual instruction that defines a value of type FromTy implicitly zero-extends the...
SDValue lowerFEXP2(SDValue Op, SelectionDAG &DAG) const
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
AtomicExpansionKind shouldCastAtomicLoadInIR(LoadInst *LI) const override
Returns how the given (atomic) load should be cast by the IR-level AtomicExpand pass.
SDValue performSrlCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue lowerFEXP(SDValue Op, SelectionDAG &DAG) const
SDValue getIsLtSmallestNormal(SelectionDAG &DAG, SDValue Op, SDNodeFlags Flags) const
bool mayIgnoreSignedZero(SDValue Op) const
SDValue getIsFinite(SelectionDAG &DAG, SDValue Op, SDNodeFlags Flags) const
bool isLoadBitCastBeneficial(EVT, EVT, const SelectionDAG &DAG, const MachineMemOperand &MMO) const final
Return true if the following transform is beneficial: fold (conv (load x)) -> (load (conv*)x) On arch...
std::pair< SDValue, SDValue > splitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HighVT, SelectionDAG &DAG) const
Split a vector value into two parts of types LoVT and HiVT.
SDValue LowerFLOGCommon(SDValue Op, SelectionDAG &DAG) const
SDValue foldFreeOpFromSelect(TargetLowering::DAGCombinerInfo &DCI, SDValue N) const
SDValue LowerINT_TO_FP32(SDValue Op, SelectionDAG &DAG, bool Signed) const
bool isFAbsFree(EVT VT) const override
Return true if an fabs operation is free to the point where it is never worthwhile to replace it with...
SDValue loadStackInputValue(SelectionDAG &DAG, EVT VT, const SDLoc &SL, int64_t Offset) const
Similar to CreateLiveInRegister, except value maybe loaded from a stack slot rather than passed in a ...
SDValue LowerFLOG2(SDValue Op, SelectionDAG &DAG) const
static EVT getEquivalentMemType(LLVMContext &Context, EVT VT)
SDValue getSqrtEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled, int &RefinementSteps, bool &UseOneConstNR, bool Reciprocal) const override
Hooks for building estimates in place of slower divisions and square roots.
SDValue performTruncateCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const
static SDValue stripBitcast(SDValue Val)
SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC, Register Reg, EVT VT, const SDLoc &SL, bool RawReg=false) const
Helper function that adds Reg to the LiveIn list of the DAG's MachineFunction.
SDValue SplitVectorStore(SDValue Op, SelectionDAG &DAG) const
Split a vector store into 2 stores of half the vector.
SDValue LowerCTLZ_CTTZ(SDValue Op, SelectionDAG &DAG) const
SDValue getNegatedExpression(SDValue Op, SelectionDAG &DAG, bool LegalOperations, bool ForCodeSize, NegatibleCost &Cost, unsigned Depth) const override
Return the newly negated expression if the cost is not expensive and set the cost in Cost to indicate...
AtomicExpansionKind shouldCastAtomicStoreInIR(StoreInst *SI) const override
Returns how the given (atomic) store should be cast by the IR-level AtomicExpand pass into.
std::pair< SDValue, SDValue > split64BitValue(SDValue Op, SelectionDAG &DAG) const
Return 64-bit value Op as two 32-bit integers.
SDValue performMulCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue getRecipEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled, int &RefinementSteps) const override
Return a reciprocal estimate value for the input operand.
SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC, Register Reg, EVT VT) const
bool hasMultipleConditionRegisters(EVT VT) const override
Does the target have multiple (allocatable) condition registers that can be used to store the results...
SDValue LowerFNEARBYINT(SDValue Op, SelectionDAG &DAG) const
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const
static CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg)
std::pair< SDValue, SDValue > getScaledLogInput(SelectionDAG &DAG, const SDLoc SL, SDValue Op, SDNodeFlags Flags) const
If denormal handling is required return the scaled input to FLOG2, and the check for denormal range.
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
Selects the correct CCAssignFn for a given CallingConvention value.
static bool allUsesHaveSourceMods(const SDNode *N, unsigned CostThreshold=4)
SDValue LowerFROUNDEVEN(SDValue Op, SelectionDAG &DAG) const
bool isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize) const override
Returns true if the target can instruction select the specified FP immediate natively.
static unsigned numBitsUnsigned(SDValue Op, SelectionDAG &DAG)
SDValue lowerFEXPUnsafe(SDValue Op, const SDLoc &SL, SelectionDAG &DAG, SDNodeFlags Flags) const
SDValue LowerFTRUNC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const
static bool allowApproxFunc(const SelectionDAG &DAG, SDNodeFlags Flags)
bool ShouldShrinkFPConstant(EVT VT) const override
If true, then instruction selection should seek to shrink the FP constant of the specified type to a ...
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,...
SDValue performStoreCombine(SDNode *N, DAGCombinerInfo &DCI) const
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...
SDValue performRcpCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue getLoHalf64(SDValue Op, SelectionDAG &DAG) const
SDValue lowerCTLZResults(SDValue Op, SelectionDAG &DAG) const
SDValue performFAbsCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerFP_TO_INT64(SDValue Op, SelectionDAG &DAG, bool Signed) const
static bool shouldFoldFNegIntoSrc(SDNode *FNeg, SDValue FNegSrc)
bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override
Return true if it's profitable to narrow operations of type SrcVT to DestVT.
SDValue LowerFRINT(SDValue Op, SelectionDAG &DAG) const
SDValue performIntrinsicWOChainCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerUDIVREM(SDValue Op, SelectionDAG &DAG) const
SDValue performMulLoHiCombine(SDNode *N, DAGCombinerInfo &DCI) const
AtomicExpansionKind shouldCastAtomicRMWIInIR(AtomicRMWInst *) const override
Returns how the given atomic atomicrmw should be cast by the IR-level AtomicExpand pass.
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...
void LowerUDIVREM64(SDValue Op, SelectionDAG &DAG, SmallVectorImpl< SDValue > &Results) const
SDValue WidenOrSplitVectorLoad(SDValue Op, SelectionDAG &DAG) const
Widen a suitably aligned v3 load.
bool mergeStoresAfterLegalization(EVT) const override
Allow store merging for the specified type after legalization in addition to before legalization.
std::pair< EVT, EVT > getSplitDestVTs(const EVT &VT, SelectionDAG &DAG) const
Split a vector type into two parts.
SDValue getHiHalf64(SDValue Op, SelectionDAG &DAG) const
bool isFsqrtCheap(SDValue Operand, SelectionDAG &DAG) const override
Return true if SQRT(X) shouldn't be replaced with X*RSQRT(X).
SDValue combineFMinMaxLegacyImpl(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, SDValue True, SDValue False, SDValue CC, DAGCombinerInfo &DCI) const
unsigned getVectorIdxWidth(const DataLayout &) const override
Returns the type to be used for the index operand vector operations.
Class for arbitrary precision integers.
Definition: APInt.h:78
an instruction that atomically reads a memory location, combines it with another value,...
Definition: Instructions.h:709
CCState - This class holds information needed while lowering arguments and return values.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
An instruction for reading from memory.
Definition: Instructions.h:180
Machine Value Type.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
A description of a memory reference used in the backend.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
An SDNode that represents everything that will be needed to construct a MachineInstr.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
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.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:229
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
Definition: SelectionDAG.h:581
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
An instruction for storing to memory.
Definition: Instructions.h:296
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
SelectSupportKind
Enum that describes what type of support for selects the target has.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
NegatibleCost
Enum that specifies when a float negation is beneficial.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:83
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
@ BUILD_VERTICAL_VECTOR
This node is for VLIW targets and it is used to represent a vector that is stored in consecutive regi...
@ CONST_DATA_PTR
Pointer to the start of the shader's constant data.
@ CLAMP
CLAMP value between 0.0 and 1.0.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition: ISDOpcodes.h:41
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
Definition: ISDOpcodes.h:975
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:1568
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
Definition: ISDOpcodes.h:1665
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
CombineLevel
Definition: DAGCombine.h:15
static cl::opt< int > CostThreshold("sbvec-cost-threshold", cl::init(0), cl::Hidden, cl::desc("Vectorization cost threshold."))
#define N
Extended Value Type.
Definition: ValueTypes.h:35
These are IR-level optimization flags that may be propagated to SDNodes.