LLVM: lib/Target/NVPTX/NVPTXTargetTransformInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETTRANSFORMINFO_H
17#define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETTRANSFORMINFO_H
18
25#include
26
27namespace llvm {
28
32 friend BaseT;
33
36
39
40public:
42 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl()),
43 TLI(ST->getTargetLowering()) {}
44
48
50
52 return AddressSpace::ADDRESS_SPACE_GENERIC;
53 }
54
55 bool
57 return AS != AddressSpace::ADDRESS_SPACE_SHARED &&
59 }
60
61 std::optional<Instruction *>
63
64
65
67 unsigned AddrSpace) const override {
68 return Alignment >= ChainSizeInBytes;
69 }
71 unsigned AddrSpace) const override {
73 }
74
75
76
77
78
79
81
82
83
89
91
92
93
94 return false;
95 }
96
97
98
99
101 const Function *Callee) const override {
102 return true;
103 }
104
105
106
108
112
118 const Instruction *CxtI = nullptr) const override;
119
121 VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract,
126
130 if (Insert && !VL.empty()) {
131 bool AllConstant = all_of(seq(NumElements), [&](int Idx) {
132 return !DemandedElts[Idx] || isa(VL[Idx]);
133 });
134 if (AllConstant) {
136 Insert = false;
137 }
138 }
140
141
144 }
145 if (Insert && VT == MVT::v4i8) {
147 for (auto Idx : seq(NumElements))
148 if (DemandedElts[Idx])
149 Cost += 1;
151 }
154 ForPoisonSrc, VL);
155 }
156
159 OptimizationRemarkEmitter *ORE) const override;
160
163
165
166
170 return false;
171
172 switch(I->getOpcode()){
173 default:
174 return false;
175 case Instruction::Load:
176 case Instruction::Store:
177 return true;
178 }
179 }
180
183
186
189
191
193 Value *NewV) const override;
195
198 SmallVectorImpl<std::pair<StringRef, int64_t>> &LB) const override;
199
201
202 return false;
203 }
204};
205
206}
207
208#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
uint64_t IntrinsicInst * II
This file describes how to lower LLVM code to machine code.
This pass exposes codegen information to IR-level passes.
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
InstructionCost getScalarizationOverhead(VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind, bool ForPoisonSrc=true, ArrayRef< Value * > VL={}) const override
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
The core instruction combiner logic.
static InstructionCost getInvalid(CostType Val=0)
A wrapper class for inspecting calls to intrinsic functions.
unsigned getNumberOfRegisters(unsigned ClassID) const override
Definition NVPTXTargetTransformInfo.h:80
unsigned getFlatAddressSpace() const override
Definition NVPTXTargetTransformInfo.h:51
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
Definition NVPTXTargetTransformInfo.h:85
bool isLegalMaskedStore(Type *DataType, Align Alignment, unsigned AddrSpace, TTI::MaskKind MaskKind) const override
Value * rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, Value *OldV, Value *NewV) const override
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const override
Definition NVPTXTargetTransformInfo.h:70
InstructionCost getInstructionCost(const User *U, ArrayRef< const Value * > Operands, TTI::TargetCostKind CostKind) const override
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const override
bool areInlineCompatible(const Function *Caller, const Function *Callee) const override
Definition NVPTXTargetTransformInfo.h:100
std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const override
bool shouldBuildRelLookupTables() const override
Definition NVPTXTargetTransformInfo.h:200
unsigned getInliningThresholdMultiplier() const override
Definition NVPTXTargetTransformInfo.h:107
bool canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const override
Definition NVPTXTargetTransformInfo.h:56
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
bool shouldExpandReduction(const IntrinsicInst *II) const override
Definition NVPTXTargetTransformInfo.h:90
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const override
Definition NVPTXTargetTransformInfo.h:66
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const override
NVPTXTTIImpl(const NVPTXTargetMachine *TM, const Function &F)
Definition NVPTXTargetTransformInfo.h:41
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
bool isSourceOfDivergence(const Value *V) const override
bool collectFlatAddressOperands(SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const override
bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) const override
Definition NVPTXTargetTransformInfo.h:164
InstructionCost getScalarizationOverhead(VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind, bool ForPoisonSrc=true, ArrayRef< Value * > VL={}) const override
Estimate the overhead of scalarizing an instruction.
Definition NVPTXTargetTransformInfo.h:120
unsigned getAssumedAddrSpace(const Value *V) const override
void collectKernelLaunchBounds(const Function &F, SmallVectorImpl< std::pair< StringRef, int64_t > > &LB) const override
bool isLegalMaskedLoad(Type *DataType, Align Alignment, unsigned AddrSpace, TTI::MaskKind MaskKind) const override
unsigned getMinVectorRegisterBitWidth() const override
Definition NVPTXTargetTransformInfo.h:88
bool hasBranchDivergence(const Function *F=nullptr) const override
Definition NVPTXTargetTransformInfo.h:45
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
virtual const DataLayout & getDataLayout() const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
MaskKind
Some targets only support masked load/store with a constant mask.
TargetCostKind
The kind of cost model.
@ TCC_Free
Expected to fold away in lowering.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Base class of all SIMD vector types.
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
constexpr ScalarTy getFixedValue() const
constexpr bool isFixed() const
Returns true if the quantity is not scaled by vscale.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool isPackedVectorTy(EVT VT)
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
ArrayRef(const T &OneElt) -> ArrayRef< T >
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Parameters that control the generic loop unrolling transformation.