28#define DEBUG_TYPE "systemztti"
37 bool UsedAsMemCpySource =
false;
38 for (
const User *U : V->users())
40 if (isa<BitCastInst>(
User) || isa<GetElementPtrInst>(
User)) {
45 if (Memcpy->getOperand(1) == V && !Memcpy->isVolatile()) {
46 UsedAsMemCpySource =
true;
52 return UsedAsMemCpySource;
61 for (
Argument &Arg : Callee->args()) {
62 bool OtherUse =
false;
68 dbgs() <<
"++ SZTTI Adding inlining bonus: " <<
Bonus <<
"\n";);
82 if ((!ST->hasVector() && BitSize > 64) || BitSize > 128)
88 if (Imm.getBitWidth() <= 64) {
90 if (isInt<32>(Imm.getSExtValue()))
93 if (isUInt<32>(Imm.getZExtValue()))
96 if ((Imm.getZExtValue() & 0xffffffff) == 0)
124 case Instruction::GetElementPtr:
131 case Instruction::Store:
132 if (
Idx == 0 && Imm.getBitWidth() <= 64) {
137 if (isInt<16>(Imm.getSExtValue()))
141 case Instruction::ICmp:
142 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
144 if (isInt<32>(Imm.getSExtValue()))
147 if (isUInt<32>(Imm.getZExtValue()))
151 case Instruction::Add:
152 case Instruction::Sub:
153 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
155 if (isUInt<32>(Imm.getZExtValue()))
158 if (isUInt<32>(-Imm.getSExtValue()))
162 case Instruction::Mul:
163 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
165 if (isInt<32>(Imm.getSExtValue()))
169 case Instruction::Or:
170 case Instruction::Xor:
171 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
173 if (isUInt<32>(Imm.getZExtValue()))
176 if ((Imm.getZExtValue() & 0xffffffff) == 0)
180 case Instruction::And:
181 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
186 if (isUInt<32>(~Imm.getZExtValue()))
189 if ((Imm.getZExtValue() & 0xffffffff) == 0xffffffff)
194 if (
TII->isRxSBGMask(Imm.getZExtValue(), BitSize, Start,
End))
198 case Instruction::Shl:
199 case Instruction::LShr:
200 case Instruction::AShr:
205 case Instruction::UDiv:
206 case Instruction::SDiv:
207 case Instruction::URem:
208 case Instruction::SRem:
209 case Instruction::Trunc:
210 case Instruction::ZExt:
211 case Instruction::SExt:
212 case Instruction::IntToPtr:
213 case Instruction::PtrToInt:
214 case Instruction::BitCast:
215 case Instruction::PHI:
216 case Instruction::Call:
217 case Instruction::Select:
218 case Instruction::Ret:
219 case Instruction::Load:
244 case Intrinsic::sadd_with_overflow:
245 case Intrinsic::uadd_with_overflow:
246 case Intrinsic::ssub_with_overflow:
247 case Intrinsic::usub_with_overflow:
249 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
250 if (isUInt<32>(Imm.getZExtValue()))
252 if (isUInt<32>(-Imm.getSExtValue()))
256 case Intrinsic::smul_with_overflow:
257 case Intrinsic::umul_with_overflow:
259 if (
Idx == 1 && Imm.getBitWidth() <= 64) {
260 if (isInt<32>(Imm.getSExtValue()))
264 case Intrinsic::experimental_stackmap:
265 if ((
Idx < 2) || (Imm.getBitWidth() <= 64 && isInt<64>(Imm.getSExtValue())))
268 case Intrinsic::experimental_patchpoint_void:
269 case Intrinsic::experimental_patchpoint:
270 if ((
Idx < 4) || (Imm.getBitWidth() <= 64 && isInt<64>(Imm.getSExtValue())))
280 if (ST->hasPopulationCount() && TyWidth <= 64)
290 bool HasCall =
false;
292 for (
auto &BB : L->blocks())
293 for (
auto &
I : *BB) {
294 if (isa<CallInst>(&
I) || isa<InvokeInst>(&
I)) {
298 if (
F->getIntrinsicID() == Intrinsic::memcpy ||
299 F->getIntrinsicID() == Intrinsic::memset)
305 if (isa<StoreInst>(&
I)) {
306 Type *MemAccessTy =
I.getOperand(0)->getType();
315 unsigned const NumStoresVal = *NumStores.
getValue();
316 unsigned const Max = (NumStoresVal ? (12 / NumStoresVal) : UINT_MAX);
359 bool Vector = (ClassID == 1);
384 unsigned NumStridedMemAccesses,
385 unsigned NumPrefetches,
386 bool HasCall)
const {
388 if (NumPrefetches > 16)
393 if (NumStridedMemAccesses > 32 && !HasCall &&
394 (NumMemAccesses - NumStridedMemAccesses) * 32 <= NumStridedMemAccesses)
397 return ST->hasMiscellaneousExtensions3() ? 8192 : 2048;
410 assert(
Size > 0 &&
"Element must have non-zero size.");
418 auto *VTy = cast<FixedVectorType>(Ty);
420 assert(WideBits > 0 &&
"Could not compute size of vector");
421 return ((WideBits % 128U) ? ((WideBits / 128U) + 1) : (WideBits / 128U));
433 Op2Info, Args, CxtI);
447 const unsigned DivInstrCost = 20;
448 const unsigned DivMulSeqCost = 10;
449 const unsigned SDivPow2Cost = 4;
452 Opcode == Instruction::SDiv || Opcode == Instruction::SRem;
453 bool UnsignedDivRem =
454 Opcode == Instruction::UDiv || Opcode == Instruction::URem;
457 bool DivRemConst =
false;
458 bool DivRemConstPow2 =
false;
459 if ((SignedDivRem || UnsignedDivRem) && Args.size() == 2) {
460 if (
const Constant *
C = dyn_cast<Constant>(Args[1])) {
462 (
C->getType()->isVectorTy()
463 ? dyn_cast_or_null<const ConstantInt>(
C->getSplatValue())
464 : dyn_cast<const ConstantInt>(
C));
467 DivRemConstPow2 =
true;
477 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
478 Opcode == Instruction::FMul || Opcode == Instruction::FDiv)
482 if (Opcode == Instruction::FRem)
486 if (Args.size() == 2) {
487 if (Opcode == Instruction::Xor) {
488 for (
const Value *
A : Args) {
490 if (
I->hasOneUse() &&
491 (
I->getOpcode() == Instruction::Or ||
492 I->getOpcode() == Instruction::And ||
493 I->getOpcode() == Instruction::Xor))
494 if ((ScalarBits <= 64 && ST->hasMiscellaneousExtensions3()) ||
496 (
I->getOpcode() == Instruction::Or || ST->hasVectorEnhancements1())))
500 else if (Opcode == Instruction::And || Opcode == Instruction::Or) {
501 for (
const Value *
A : Args) {
503 if ((
I->hasOneUse() &&
I->getOpcode() == Instruction::Xor) &&
504 ((ScalarBits <= 64 && ST->hasMiscellaneousExtensions3()) ||
506 (Opcode == Instruction::And || ST->hasVectorEnhancements1()))))
513 if (Opcode == Instruction::Or)
516 if (Opcode == Instruction::Xor && ScalarBits == 1) {
517 if (ST->hasLoadStoreOnCond2())
523 return (SignedDivRem ? SDivPow2Cost : 1);
525 return DivMulSeqCost;
526 if (SignedDivRem || UnsignedDivRem)
529 else if (ST->hasVector()) {
530 auto *VTy = cast<FixedVectorType>(Ty);
531 unsigned VF = VTy->getNumElements();
536 if (Opcode == Instruction::Shl || Opcode == Instruction::LShr ||
537 Opcode == Instruction::AShr) {
542 return (NumVectors * (SignedDivRem ? SDivPow2Cost : 1));
545 return VF * DivMulSeqCost +
548 if ((SignedDivRem || UnsignedDivRem) && VF > 4)
559 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
560 Opcode == Instruction::FMul || Opcode == Instruction::FDiv) {
561 switch (ScalarBits) {
564 if (ST->hasVectorEnhancements1())
589 if (Opcode == Instruction::FRem) {
594 if (VF == 2 && ScalarBits == 32)
610 if (ST->hasVector()) {
626 return (
Index == 0 ? 0 : NumVectors);
633 return NumVectors - 1;
662 "Packing must reduce size of vector type.");
663 assert(cast<FixedVectorType>(SrcTy)->getNumElements() ==
664 cast<FixedVectorType>(DstTy)->getNumElements() &&
665 "Packing should not change number of elements.");
680 unsigned VF = cast<FixedVectorType>(SrcTy)->getNumElements();
681 for (
unsigned P = 0;
P < Log2Diff; ++
P) {
702 "Should only be called with vector types.");
704 unsigned PackCost = 0;
708 if (SrcScalarBits > DstScalarBits)
711 else if (SrcScalarBits < DstScalarBits) {
714 PackCost = Log2Diff * DstNumParts;
716 PackCost += DstNumParts - 1;
725 Type *OpTy =
nullptr;
726 if (
CmpInst *CI = dyn_cast<CmpInst>(
I->getOperand(0)))
727 OpTy = CI->getOperand(0)->getType();
728 else if (
Instruction *LogicI = dyn_cast<Instruction>(
I->getOperand(0)))
729 if (LogicI->getNumOperands() == 2)
730 if (
CmpInst *CI0 = dyn_cast<CmpInst>(LogicI->getOperand(0)))
731 if (isa<CmpInst>(LogicI->getOperand(1)))
732 OpTy = CI0->getOperand(0)->getType();
734 if (OpTy !=
nullptr) {
753 auto *DstVTy = cast<FixedVectorType>(Dst);
754 unsigned VF = DstVTy->getNumElements();
759 if (CmpOpTy !=
nullptr)
761 if (Opcode == Instruction::ZExt || Opcode == Instruction::UIToFP)
775 return BaseCost == 0 ? BaseCost : 1;
778 unsigned DstScalarBits = Dst->getScalarSizeInBits();
779 unsigned SrcScalarBits = Src->getScalarSizeInBits();
781 if (!Src->isVectorTy()) {
782 assert (!Dst->isVectorTy());
784 if (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP) {
785 if (Src->isIntegerTy(128))
787 if (SrcScalarBits >= 32 ||
788 (
I !=
nullptr && isa<LoadInst>(
I->getOperand(0))))
790 return SrcScalarBits > 1 ? 2 : 5 ;
793 if ((Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI) &&
794 Dst->isIntegerTy(128))
797 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt)) {
798 if (Src->isIntegerTy(1)) {
799 if (DstScalarBits == 128)
802 if (ST->hasLoadStoreOnCond2())
808 if (Opcode == Instruction::SExt)
809 Cost = (DstScalarBits < 64 ? 3 : 4);
810 if (Opcode == Instruction::ZExt)
818 else if (isInt128InVR(Dst)) {
821 if (Opcode == Instruction::ZExt &&
I !=
nullptr)
822 if (
LoadInst *Ld = dyn_cast<LoadInst>(
I->getOperand(0)))
829 if (Opcode == Instruction::Trunc && isInt128InVR(Src) &&
I !=
nullptr) {
830 if (
LoadInst *Ld = dyn_cast<LoadInst>(
I->getOperand(0)))
833 bool OnlyTruncatingStores =
true;
834 for (
const User *U :
I->users())
835 if (!isa<StoreInst>(U)) {
836 OnlyTruncatingStores =
false;
839 if (OnlyTruncatingStores)
844 else if (ST->hasVector()) {
846 auto *SrcVecTy = cast<FixedVectorType>(Src);
847 auto *DstVecTy = dyn_cast<FixedVectorType>(Dst);
852 unsigned VF = SrcVecTy->getNumElements();
856 if (Opcode == Instruction::Trunc) {
857 if (Src->getScalarSizeInBits() == Dst->getScalarSizeInBits())
862 if (Opcode == Instruction::ZExt || Opcode == Instruction::SExt) {
863 if (SrcScalarBits >= 8) {
865 if (Opcode == Instruction::ZExt)
866 return NumDstVectors;
873 unsigned NumSrcVectorOps =
874 (NumUnpacks > 1 ? (NumDstVectors - NumSrcVectors)
875 : (NumDstVectors / 2));
877 return (NumUnpacks * NumDstVectors) + NumSrcVectorOps;
879 else if (SrcScalarBits == 1)
883 if (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP ||
884 Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI) {
889 if (DstScalarBits == 64 || ST->hasVectorEnhancements2()) {
890 if (SrcScalarBits == DstScalarBits)
891 return NumDstVectors;
893 if (SrcScalarBits == 1)
901 Opcode, Dst->getScalarType(), Src->getScalarType(), CCH,
CostKind);
903 bool NeedsInserts =
true, NeedsExtracts =
true;
905 if (DstScalarBits == 128 &&
906 (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP))
907 NeedsInserts =
false;
908 if (SrcScalarBits == 128 &&
909 (Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI))
910 NeedsExtracts =
false;
918 if (VF == 2 && SrcScalarBits == 32 && DstScalarBits == 32)
924 if (Opcode == Instruction::FPTrunc) {
925 if (SrcScalarBits == 128)
930 return VF / 2 + std::max(1U, VF / 4 );
933 if (Opcode == Instruction::FPExt) {
934 if (SrcScalarBits == 32 && DstScalarBits == 64) {
952 unsigned ExtCost = 0;
955 if (!isa<LoadInst>(
Op) && !isa<ConstantInt>(
Op))
971 case Instruction::ICmp: {
975 if (
I !=
nullptr && (ScalarBits == 32 || ScalarBits == 64))
976 if (
LoadInst *Ld = dyn_cast<LoadInst>(
I->getOperand(0)))
977 if (
const ConstantInt *
C = dyn_cast<ConstantInt>(
I->getOperand(1)))
978 if (!Ld->hasOneUse() && Ld->getParent() ==
I->getParent() &&
987 case Instruction::Select:
993 else if (ST->hasVector()) {
994 unsigned VF = cast<FixedVectorType>(ValTy)->getNumElements();
997 if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) {
998 unsigned PredicateExtraCost = 0;
1001 switch (cast<CmpInst>(
I)->getPredicate()) {
1007 PredicateExtraCost = 1;
1013 PredicateExtraCost = 2;
1025 unsigned Cost = (NumVecs_cmp * (CmpCostPerVector + PredicateExtraCost));
1029 assert (Opcode == Instruction::Select);
1033 unsigned PackCost = 0;
1035 if (CmpOpTy !=
nullptr)
1053 return ((
Index % 2 == 0) ? 1 : 0);
1055 if (Opcode == Instruction::ExtractElement) {
1076 unsigned TruncBits = 0;
1077 unsigned SExtBits = 0;
1078 unsigned ZExtBits = 0;
1081 if (isa<TruncInst>(UserI))
1082 TruncBits = UserBits;
1083 else if (isa<SExtInst>(UserI))
1084 SExtBits = UserBits;
1085 else if (isa<ZExtInst>(UserI))
1086 ZExtBits = UserBits;
1088 if (TruncBits || SExtBits || ZExtBits) {
1089 FoldedValue = UserI;
1090 UserI = cast<Instruction>(*UserI->
user_begin());
1093 if ((UserI->
getOpcode() == Instruction::Sub ||
1094 UserI->
getOpcode() == Instruction::SDiv ||
1095 UserI->
getOpcode() == Instruction::UDiv) &&
1100 unsigned LoadOrTruncBits =
1101 ((SExtBits || ZExtBits) ? 0 : (TruncBits ? TruncBits : LoadedBits));
1103 case Instruction::Add:
1104 case Instruction::Sub:
1105 case Instruction::ICmp:
1106 if (LoadedBits == 32 && ZExtBits == 64)
1109 case Instruction::Mul:
1110 if (UserI->
getOpcode() != Instruction::ICmp) {
1111 if (LoadedBits == 16 &&
1113 (SExtBits == 64 && ST->hasMiscellaneousExtensions2())))
1115 if (LoadOrTruncBits == 16)
1119 case Instruction::SDiv:
1120 if (LoadedBits == 32 && SExtBits == 64)
1123 case Instruction::UDiv:
1124 case Instruction::And:
1125 case Instruction::Or:
1126 case Instruction::Xor:
1138 if (UserI->
getOpcode() == Instruction::ICmp)
1140 if (CI->getValue().isIntN(16))
1142 return (LoadOrTruncBits == 32 || LoadOrTruncBits == 64);
1150 if (
auto *CI = dyn_cast<CallInst>(
I))
1151 if (
auto *
F = CI->getCalledFunction())
1152 if (
F->getIntrinsicID() == Intrinsic::bswap)
1163 assert(!Src->isVoidTy() &&
"Invalid type");
1169 if (!Src->isVectorTy() && Opcode == Instruction::Load &&
I !=
nullptr) {
1178 for (
unsigned i = 0; i < 2; ++i) {
1183 LoadInst *OtherLoad = dyn_cast<LoadInst>(OtherOp);
1185 (isa<TruncInst>(OtherOp) || isa<SExtInst>(OtherOp) ||
1186 isa<ZExtInst>(OtherOp)))
1187 OtherLoad = dyn_cast<LoadInst>(OtherOp->getOperand(0));
1203 if (Src->isFP128Ty() && !ST->hasVectorEnhancements1())
1210 if (((!Src->isVectorTy() && NumOps == 1) || ST->hasVectorEnhancements2()) &&
1212 if (Opcode == Instruction::Load &&
I->hasOneUse()) {
1213 const Instruction *LdUser = cast<Instruction>(*
I->user_begin());
1219 else if (
const StoreInst *SI = dyn_cast<StoreInst>(
I)) {
1220 const Value *StoredVal = SI->getValueOperand();
1237 bool UseMaskForCond,
bool UseMaskForGaps) {
1238 if (UseMaskForCond || UseMaskForGaps)
1241 UseMaskForCond, UseMaskForGaps);
1242 assert(isa<VectorType>(VecTy) &&
1243 "Expect a vector type for interleaved memory op");
1245 unsigned NumElts = cast<FixedVectorType>(VecTy)->getNumElements();
1246 assert(Factor > 1 && NumElts % Factor == 0 &&
"Invalid interleave factor");
1247 unsigned VF = NumElts / Factor;
1250 unsigned NumPermutes = 0;
1252 if (Opcode == Instruction::Load) {
1256 BitVector UsedInsts(NumVectorMemOps,
false);
1257 std::vector<BitVector> ValueVecs(Factor,
BitVector(NumVectorMemOps,
false));
1258 for (
unsigned Index : Indices)
1259 for (
unsigned Elt = 0; Elt < VF; ++Elt) {
1260 unsigned Vec = (
Index + Elt * Factor) / NumEltsPerVecReg;
1264 NumVectorMemOps = UsedInsts.
count();
1266 for (
unsigned Index : Indices) {
1270 unsigned NumSrcVecs = ValueVecs[
Index].count();
1272 assert (NumSrcVecs >= NumDstVecs &&
"Expected at least as many sources");
1273 NumPermutes += std::max(1U, NumSrcVecs - NumDstVecs);
1279 unsigned NumSrcVecs = std::min(NumEltsPerVecReg, Factor);
1280 unsigned NumDstVecs = NumVectorMemOps;
1281 NumPermutes += (NumDstVecs * NumSrcVecs) - NumDstVecs;
1285 return NumVectorMemOps + NumPermutes;
1291 if (
RetTy->isVectorTy() &&
ID == Intrinsic::bswap)
1294 if (
ID == Intrinsic::vector_reduce_add) {
1296 auto *VTy = cast<FixedVectorType>(ParamTys.
front());
1297 unsigned ScalarSize = VTy->getScalarSizeInBits();
1304 unsigned LastVectorHandling = (ScalarSize < 32) ? 3 : 2;
1309 int Cost = VectorRegsNeeded + LastVectorHandling - 1;
1327 if (!ST->hasVector())
1332 unsigned NumElts =
Type->getNumElements();
1335 if (NumElts < MaxElts)
1341 case Intrinsic::vector_reduce_add:
1343 return ScalarSize >= 64;
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static cl::opt< TargetTransformInfo::TargetCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(TargetTransformInfo::TCK_RecipThroughput), cl::values(clEnumValN(TargetTransformInfo::TCK_RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(TargetTransformInfo::TCK_Latency, "latency", "Instruction latency"), clEnumValN(TargetTransformInfo::TCK_CodeSize, "code-size", "Code size"), clEnumValN(TargetTransformInfo::TCK_SizeAndLatency, "size-latency", "Code size and latency")))
Cost tables and simple lookup functions.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
const HexagonInstrInfo * TII
static const Function * getCalledFunction(const Value *V, bool &IsNoBuiltin)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file describes how to lower LLVM code to machine code.
Class for arbitrary precision integers.
bool isNegatedPowerOf2() const
Check if this APInt's negated value is a power of two greater than zero.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
Get intrinsic cost based on arguments.
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
unsigned getNumberOfParts(Type *Tp)
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Opd1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Opd2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
TTI::ShuffleKind improveShuffleKindFromMask(TTI::ShuffleKind Kind, ArrayRef< int > Mask, VectorType *Ty, int &Index, VectorType *&SubTy) const
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr)
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt, const Instruction *CxtI=nullptr)
InstructionCost getScalarizationOverhead(VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind)
Estimate the overhead of scalarizing an instruction.
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
size_type count() const
count - Returns the number of bits which are set.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
This class is the base class for the comparison instructions.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ ICMP_SLE
signed less or equal
@ ICMP_UGE
unsigned greater or equal
@ FCMP_ONE
0 1 1 0 True if ordered and operands are unequal
@ FCMP_UEQ
1 0 0 1 True if unordered or equal
@ FCMP_ORD
0 1 1 1 True if ordered (no nans)
@ ICMP_SGE
signed greater or equal
@ ICMP_ULE
unsigned less or equal
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
This is the shared class of boolean and integer constants.
const APInt & getValue() const
Return the constant as an APInt value reference.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
std::optional< CostType > getValue() const
This function is intended to be used as sparingly as possible, since the class provides the full rang...
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
const SmallVectorImpl< Type * > & getArgTypes() const
Type * getReturnType() const
Intrinsic::ID getID() const
A wrapper class for inspecting calls to intrinsic functions.
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
An instruction for reading from memory.
Represents a single loop in the control flow graph.
This class wraps the llvm.memcpy intrinsic.
The main scalar evolution driver.
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.
An instruction for storing to memory.
const SystemZInstrInfo * getInstrInfo() const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
bool shouldExpandReduction(const IntrinsicInst *II) const
unsigned getNumberOfRegisters(unsigned ClassID) const
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst, const Instruction *I)
unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const override
unsigned adjustInliningThreshold(const CallBase *CB) const
unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy)
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)
bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue)
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
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=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr)
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2)
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt, const Instruction *CxtI=nullptr)
unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy)
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr)
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
bool hasDivRemOp(Type *DataType, bool IsSigned)
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
bool isFP128Ty() const
Return true if this is 'fp128'.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
bool isIntegerTy() const
True if this is an instance of IntegerType.
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Value * getOperand(unsigned i) const
unsigned getNumOperands() const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
user_iterator user_begin()
bool hasOneUse() const
Return true if there is exactly one use of this value.
Base class of all SIMD vector types.
constexpr ScalarTy getFixedValue() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
const unsigned VectorBits
This is an optimization pass for GlobalISel generic memory operations.
uint64_t divideCeil(uint64_t Numerator, uint64_t Denominator)
Returns the integer ceil(Numerator / Denominator).
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
This struct is a compact representation of a valid (non-zero power of two) alignment.
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.