Chandler Carruth | d3e7355 | 2013-01-07 03:08:10 +0000 | [diff] [blame] | 1 | //===- llvm/Analysis/TargetTransformInfo.cpp ------------------------------===// |
Nadav Rotem | 5dc203e | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Chandler Carruth | d3e7355 | 2013-01-07 03:08:10 +0000 | [diff] [blame] | 10 | #include "llvm/Analysis/TargetTransformInfo.h" |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 11 | #include "llvm/Analysis/TargetTransformInfoImpl.h" |
Chandler Carruth | 219b89b | 2014-03-04 11:01:28 +0000 | [diff] [blame] | 12 | #include "llvm/IR/CallSite.h" |
Chandler Carruth | 511aa76 | 2013-01-21 01:27:39 +0000 | [diff] [blame] | 13 | #include "llvm/IR/DataLayout.h" |
Chandler Carruth | 511aa76 | 2013-01-21 01:27:39 +0000 | [diff] [blame] | 14 | #include "llvm/IR/Instruction.h" |
Chandler Carruth | 511aa76 | 2013-01-21 01:27:39 +0000 | [diff] [blame] | 15 | #include "llvm/IR/Instructions.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 16 | #include "llvm/IR/IntrinsicInst.h" |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 17 | #include "llvm/IR/Module.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 18 | #include "llvm/IR/Operator.h" |
Sean Fertile | 9cd1cdf | 2017-07-07 02:00:06 +0000 | [diff] [blame^] | 19 | #include "llvm/Support/CommandLine.h" |
Nadav Rotem | 5dc203e | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 20 | #include "llvm/Support/ErrorHandling.h" |
Benjamin Kramer | 82de7d3 | 2016-05-27 14:27:24 +0000 | [diff] [blame] | 21 | #include <utility> |
Nadav Rotem | 5dc203e | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 22 | |
| 23 | using namespace llvm; |
| 24 | |
Chandler Carruth | f1221bd | 2014-04-22 02:48:03 +0000 | [diff] [blame] | 25 | #define DEBUG_TYPE "tti" |
| 26 | |
Sean Fertile | 9cd1cdf | 2017-07-07 02:00:06 +0000 | [diff] [blame^] | 27 | static cl::opt<bool> UseWideMemcpyLoopLowering( |
| 28 | "use-wide-memcpy-loop-lowering", cl::init(false), |
| 29 | cl::desc("Enables the new wide memcpy loop lowering in Transforms/Utils."), |
| 30 | cl::Hidden); |
| 31 | |
Chandler Carruth | 93dcdc4 | 2015-01-31 11:17:59 +0000 | [diff] [blame] | 32 | namespace { |
| 33 | /// \brief No-op implementation of the TTI interface using the utility base |
| 34 | /// classes. |
| 35 | /// |
| 36 | /// This is used when no target specific information is available. |
| 37 | struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> { |
Mehdi Amini | 5010ebf | 2015-07-09 02:08:42 +0000 | [diff] [blame] | 38 | explicit NoTTIImpl(const DataLayout &DL) |
Chandler Carruth | 93dcdc4 | 2015-01-31 11:17:59 +0000 | [diff] [blame] | 39 | : TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {} |
| 40 | }; |
| 41 | } |
| 42 | |
Mehdi Amini | 5010ebf | 2015-07-09 02:08:42 +0000 | [diff] [blame] | 43 | TargetTransformInfo::TargetTransformInfo(const DataLayout &DL) |
Chandler Carruth | 93dcdc4 | 2015-01-31 11:17:59 +0000 | [diff] [blame] | 44 | : TTIImpl(new Model<NoTTIImpl>(NoTTIImpl(DL))) {} |
| 45 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 46 | TargetTransformInfo::~TargetTransformInfo() {} |
Nadav Rotem | 5dc203e | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 47 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 48 | TargetTransformInfo::TargetTransformInfo(TargetTransformInfo &&Arg) |
| 49 | : TTIImpl(std::move(Arg.TTIImpl)) {} |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 50 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 51 | TargetTransformInfo &TargetTransformInfo::operator=(TargetTransformInfo &&RHS) { |
| 52 | TTIImpl = std::move(RHS.TTIImpl); |
| 53 | return *this; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 54 | } |
| 55 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 56 | int TargetTransformInfo::getOperationCost(unsigned Opcode, Type *Ty, |
| 57 | Type *OpTy) const { |
| 58 | int Cost = TTIImpl->getOperationCost(Opcode, Ty, OpTy); |
| 59 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 60 | return Cost; |
Chandler Carruth | 511aa76 | 2013-01-21 01:27:39 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 63 | int TargetTransformInfo::getCallCost(FunctionType *FTy, int NumArgs) const { |
| 64 | int Cost = TTIImpl->getCallCost(FTy, NumArgs); |
| 65 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 66 | return Cost; |
Chandler Carruth | 0ba8db4 | 2013-01-22 11:26:02 +0000 | [diff] [blame] | 67 | } |
| 68 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 69 | int TargetTransformInfo::getCallCost(const Function *F, |
| 70 | ArrayRef<const Value *> Arguments) const { |
| 71 | int Cost = TTIImpl->getCallCost(F, Arguments); |
| 72 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 73 | return Cost; |
Chandler Carruth | 0ba8db4 | 2013-01-22 11:26:02 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Justin Lebar | 8650a4d | 2016-04-15 01:38:48 +0000 | [diff] [blame] | 76 | unsigned TargetTransformInfo::getInliningThresholdMultiplier() const { |
| 77 | return TTIImpl->getInliningThresholdMultiplier(); |
| 78 | } |
| 79 | |
Jingyue Wu | 15f3e82 | 2016-07-08 21:48:05 +0000 | [diff] [blame] | 80 | int TargetTransformInfo::getGEPCost(Type *PointeeType, const Value *Ptr, |
| 81 | ArrayRef<const Value *> Operands) const { |
| 82 | return TTIImpl->getGEPCost(PointeeType, Ptr, Operands); |
| 83 | } |
| 84 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 85 | int TargetTransformInfo::getIntrinsicCost( |
| 86 | Intrinsic::ID IID, Type *RetTy, ArrayRef<const Value *> Arguments) const { |
| 87 | int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments); |
| 88 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 89 | return Cost; |
Chandler Carruth | 0ba8db4 | 2013-01-22 11:26:02 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Jun Bum Lim | 919f9e8 | 2017-04-28 16:04:03 +0000 | [diff] [blame] | 92 | unsigned |
| 93 | TargetTransformInfo::getEstimatedNumberOfCaseClusters(const SwitchInst &SI, |
| 94 | unsigned &JTSize) const { |
| 95 | return TTIImpl->getEstimatedNumberOfCaseClusters(SI, JTSize); |
| 96 | } |
| 97 | |
Evgeny Astigeevich | 70ed78e | 2017-06-29 13:42:12 +0000 | [diff] [blame] | 98 | int TargetTransformInfo::getUserCost(const User *U, |
| 99 | ArrayRef<const Value *> Operands) const { |
| 100 | int Cost = TTIImpl->getUserCost(U, Operands); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 101 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 102 | return Cost; |
Chandler Carruth | 511aa76 | 2013-01-21 01:27:39 +0000 | [diff] [blame] | 103 | } |
| 104 | |
Tom Stellard | 8b1e021 | 2013-07-27 00:01:07 +0000 | [diff] [blame] | 105 | bool TargetTransformInfo::hasBranchDivergence() const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 106 | return TTIImpl->hasBranchDivergence(); |
Tom Stellard | 8b1e021 | 2013-07-27 00:01:07 +0000 | [diff] [blame] | 107 | } |
| 108 | |
Jingyue Wu | 5da831c | 2015-04-10 05:03:50 +0000 | [diff] [blame] | 109 | bool TargetTransformInfo::isSourceOfDivergence(const Value *V) const { |
| 110 | return TTIImpl->isSourceOfDivergence(V); |
| 111 | } |
| 112 | |
Alexander Timofeev | 0f9c84c | 2017-06-15 19:33:10 +0000 | [diff] [blame] | 113 | bool llvm::TargetTransformInfo::isAlwaysUniform(const Value *V) const { |
| 114 | return TTIImpl->isAlwaysUniform(V); |
| 115 | } |
| 116 | |
Matt Arsenault | 42b6478 | 2017-01-30 23:02:12 +0000 | [diff] [blame] | 117 | unsigned TargetTransformInfo::getFlatAddressSpace() const { |
| 118 | return TTIImpl->getFlatAddressSpace(); |
| 119 | } |
| 120 | |
Chandler Carruth | 0ba8db4 | 2013-01-22 11:26:02 +0000 | [diff] [blame] | 121 | bool TargetTransformInfo::isLoweredToCall(const Function *F) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 122 | return TTIImpl->isLoweredToCall(F); |
Chandler Carruth | 0ba8db4 | 2013-01-22 11:26:02 +0000 | [diff] [blame] | 123 | } |
| 124 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 125 | void TargetTransformInfo::getUnrollingPreferences( |
Geoff Berry | 66d9bdb | 2017-06-28 15:53:17 +0000 | [diff] [blame] | 126 | Loop *L, ScalarEvolution &SE, UnrollingPreferences &UP) const { |
| 127 | return TTIImpl->getUnrollingPreferences(L, SE, UP); |
Hal Finkel | 8f2e700 | 2013-09-11 19:25:43 +0000 | [diff] [blame] | 128 | } |
| 129 | |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 130 | bool TargetTransformInfo::isLegalAddImmediate(int64_t Imm) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 131 | return TTIImpl->isLegalAddImmediate(Imm); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | bool TargetTransformInfo::isLegalICmpImmediate(int64_t Imm) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 135 | return TTIImpl->isLegalICmpImmediate(Imm); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | bool TargetTransformInfo::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, |
| 139 | int64_t BaseOffset, |
| 140 | bool HasBaseReg, |
Matt Arsenault | e83379e | 2015-06-07 20:12:03 +0000 | [diff] [blame] | 141 | int64_t Scale, |
| 142 | unsigned AddrSpace) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 143 | return TTIImpl->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, |
Matt Arsenault | e83379e | 2015-06-07 20:12:03 +0000 | [diff] [blame] | 144 | Scale, AddrSpace); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 145 | } |
| 146 | |
Evgeny Stupachenko | f2b3b46 | 2017-06-05 23:37:00 +0000 | [diff] [blame] | 147 | bool TargetTransformInfo::isLSRCostLess(LSRCost &C1, LSRCost &C2) const { |
| 148 | return TTIImpl->isLSRCostLess(C1, C2); |
| 149 | } |
| 150 | |
Elena Demikhovsky | 20662e3 | 2015-10-19 07:43:38 +0000 | [diff] [blame] | 151 | bool TargetTransformInfo::isLegalMaskedStore(Type *DataType) const { |
| 152 | return TTIImpl->isLegalMaskedStore(DataType); |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Elena Demikhovsky | 20662e3 | 2015-10-19 07:43:38 +0000 | [diff] [blame] | 155 | bool TargetTransformInfo::isLegalMaskedLoad(Type *DataType) const { |
| 156 | return TTIImpl->isLegalMaskedLoad(DataType); |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 157 | } |
| 158 | |
Elena Demikhovsky | 0928585 | 2015-10-25 15:37:55 +0000 | [diff] [blame] | 159 | bool TargetTransformInfo::isLegalMaskedGather(Type *DataType) const { |
| 160 | return TTIImpl->isLegalMaskedGather(DataType); |
| 161 | } |
| 162 | |
| 163 | bool TargetTransformInfo::isLegalMaskedScatter(Type *DataType) const { |
| 164 | return TTIImpl->isLegalMaskedGather(DataType); |
| 165 | } |
| 166 | |
Jonas Paulsson | 8624b7e | 2017-05-24 13:42:56 +0000 | [diff] [blame] | 167 | bool TargetTransformInfo::prefersVectorizedAddressing() const { |
| 168 | return TTIImpl->prefersVectorizedAddressing(); |
| 169 | } |
| 170 | |
Quentin Colombet | bf490d4 | 2013-05-31 21:29:03 +0000 | [diff] [blame] | 171 | int TargetTransformInfo::getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, |
| 172 | int64_t BaseOffset, |
| 173 | bool HasBaseReg, |
Matt Arsenault | e83379e | 2015-06-07 20:12:03 +0000 | [diff] [blame] | 174 | int64_t Scale, |
| 175 | unsigned AddrSpace) const { |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 176 | int Cost = TTIImpl->getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg, |
| 177 | Scale, AddrSpace); |
| 178 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 179 | return Cost; |
Quentin Colombet | bf490d4 | 2013-05-31 21:29:03 +0000 | [diff] [blame] | 180 | } |
| 181 | |
Jonas Paulsson | 7a79422 | 2016-08-17 13:24:19 +0000 | [diff] [blame] | 182 | bool TargetTransformInfo::isFoldableMemAccessOffset(Instruction *I, |
| 183 | int64_t Offset) const { |
| 184 | return TTIImpl->isFoldableMemAccessOffset(I, Offset); |
| 185 | } |
| 186 | |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 187 | bool TargetTransformInfo::isTruncateFree(Type *Ty1, Type *Ty2) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 188 | return TTIImpl->isTruncateFree(Ty1, Ty2); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 189 | } |
| 190 | |
Chad Rosier | 5439005 | 2015-02-23 19:15:16 +0000 | [diff] [blame] | 191 | bool TargetTransformInfo::isProfitableToHoist(Instruction *I) const { |
| 192 | return TTIImpl->isProfitableToHoist(I); |
| 193 | } |
| 194 | |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 195 | bool TargetTransformInfo::isTypeLegal(Type *Ty) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 196 | return TTIImpl->isTypeLegal(Ty); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | unsigned TargetTransformInfo::getJumpBufAlignment() const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 200 | return TTIImpl->getJumpBufAlignment(); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | unsigned TargetTransformInfo::getJumpBufSize() const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 204 | return TTIImpl->getJumpBufSize(); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | bool TargetTransformInfo::shouldBuildLookupTables() const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 208 | return TTIImpl->shouldBuildLookupTables(); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 209 | } |
Oliver Stannard | 4df1cc0 | 2016-10-07 08:48:24 +0000 | [diff] [blame] | 210 | bool TargetTransformInfo::shouldBuildLookupTablesForConstant(Constant *C) const { |
| 211 | return TTIImpl->shouldBuildLookupTablesForConstant(C); |
| 212 | } |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 213 | |
Jonas Paulsson | 8e2f948 | 2017-01-26 07:03:25 +0000 | [diff] [blame] | 214 | unsigned TargetTransformInfo:: |
| 215 | getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) const { |
| 216 | return TTIImpl->getScalarizationOverhead(Ty, Insert, Extract); |
| 217 | } |
| 218 | |
| 219 | unsigned TargetTransformInfo:: |
| 220 | getOperandsScalarizationOverhead(ArrayRef<const Value *> Args, |
| 221 | unsigned VF) const { |
| 222 | return TTIImpl->getOperandsScalarizationOverhead(Args, VF); |
| 223 | } |
| 224 | |
Jonas Paulsson | da74ed4 | 2017-04-12 12:41:37 +0000 | [diff] [blame] | 225 | bool TargetTransformInfo::supportsEfficientVectorElementLoadStore() const { |
| 226 | return TTIImpl->supportsEfficientVectorElementLoadStore(); |
| 227 | } |
| 228 | |
Olivier Sallenave | 049d803 | 2015-03-06 23:12:04 +0000 | [diff] [blame] | 229 | bool TargetTransformInfo::enableAggressiveInterleaving(bool LoopHasReductions) const { |
| 230 | return TTIImpl->enableAggressiveInterleaving(LoopHasReductions); |
| 231 | } |
| 232 | |
Zaara Syeda | 3a7578c | 2017-05-31 17:12:38 +0000 | [diff] [blame] | 233 | bool TargetTransformInfo::expandMemCmp(Instruction *I, unsigned &MaxLoadSize) const { |
| 234 | return TTIImpl->expandMemCmp(I, MaxLoadSize); |
| 235 | } |
| 236 | |
Silviu Baranga | 61bdc51 | 2015-08-10 14:50:54 +0000 | [diff] [blame] | 237 | bool TargetTransformInfo::enableInterleavedAccessVectorization() const { |
| 238 | return TTIImpl->enableInterleavedAccessVectorization(); |
| 239 | } |
| 240 | |
Renato Golin | 5cb666a | 2016-04-14 20:42:18 +0000 | [diff] [blame] | 241 | bool TargetTransformInfo::isFPVectorizationPotentiallyUnsafe() const { |
| 242 | return TTIImpl->isFPVectorizationPotentiallyUnsafe(); |
| 243 | } |
| 244 | |
Alina Sbirlea | 6f937b1 | 2016-08-04 16:38:44 +0000 | [diff] [blame] | 245 | bool TargetTransformInfo::allowsMisalignedMemoryAccesses(LLVMContext &Context, |
| 246 | unsigned BitWidth, |
Alina Sbirlea | 327955e | 2016-07-11 20:46:17 +0000 | [diff] [blame] | 247 | unsigned AddressSpace, |
| 248 | unsigned Alignment, |
| 249 | bool *Fast) const { |
Alina Sbirlea | 6f937b1 | 2016-08-04 16:38:44 +0000 | [diff] [blame] | 250 | return TTIImpl->allowsMisalignedMemoryAccesses(Context, BitWidth, AddressSpace, |
Alina Sbirlea | 327955e | 2016-07-11 20:46:17 +0000 | [diff] [blame] | 251 | Alignment, Fast); |
| 252 | } |
| 253 | |
Chandler Carruth | 50a36cd | 2013-01-07 03:16:03 +0000 | [diff] [blame] | 254 | TargetTransformInfo::PopcntSupportKind |
| 255 | TargetTransformInfo::getPopcntSupport(unsigned IntTyWidthInBit) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 256 | return TTIImpl->getPopcntSupport(IntTyWidthInBit); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 257 | } |
| 258 | |
Richard Sandiford | 37cd6cf | 2013-08-23 10:27:02 +0000 | [diff] [blame] | 259 | bool TargetTransformInfo::haveFastSqrt(Type *Ty) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 260 | return TTIImpl->haveFastSqrt(Ty); |
Richard Sandiford | 37cd6cf | 2013-08-23 10:27:02 +0000 | [diff] [blame] | 261 | } |
| 262 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 263 | int TargetTransformInfo::getFPOpCost(Type *Ty) const { |
| 264 | int Cost = TTIImpl->getFPOpCost(Ty); |
| 265 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 266 | return Cost; |
Cameron Esfahani | 17177d1 | 2015-02-05 02:09:33 +0000 | [diff] [blame] | 267 | } |
| 268 | |
Sjoerd Meijer | 38c2cd0 | 2016-07-14 07:44:20 +0000 | [diff] [blame] | 269 | int TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, |
| 270 | const APInt &Imm, |
| 271 | Type *Ty) const { |
| 272 | int Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty); |
| 273 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 274 | return Cost; |
| 275 | } |
| 276 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 277 | int TargetTransformInfo::getIntImmCost(const APInt &Imm, Type *Ty) const { |
| 278 | int Cost = TTIImpl->getIntImmCost(Imm, Ty); |
| 279 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 280 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 281 | } |
| 282 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 283 | int TargetTransformInfo::getIntImmCost(unsigned Opcode, unsigned Idx, |
| 284 | const APInt &Imm, Type *Ty) const { |
| 285 | int Cost = TTIImpl->getIntImmCost(Opcode, Idx, Imm, Ty); |
| 286 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 287 | return Cost; |
Juergen Ributzka | f26beda | 2014-01-25 02:02:55 +0000 | [diff] [blame] | 288 | } |
| 289 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 290 | int TargetTransformInfo::getIntImmCost(Intrinsic::ID IID, unsigned Idx, |
| 291 | const APInt &Imm, Type *Ty) const { |
| 292 | int Cost = TTIImpl->getIntImmCost(IID, Idx, Imm, Ty); |
| 293 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 294 | return Cost; |
Juergen Ributzka | f26beda | 2014-01-25 02:02:55 +0000 | [diff] [blame] | 295 | } |
| 296 | |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 297 | unsigned TargetTransformInfo::getNumberOfRegisters(bool Vector) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 298 | return TTIImpl->getNumberOfRegisters(Vector); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 299 | } |
| 300 | |
Nadav Rotem | b1791a7 | 2013-01-09 22:29:00 +0000 | [diff] [blame] | 301 | unsigned TargetTransformInfo::getRegisterBitWidth(bool Vector) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 302 | return TTIImpl->getRegisterBitWidth(Vector); |
Nadav Rotem | b1791a7 | 2013-01-09 22:29:00 +0000 | [diff] [blame] | 303 | } |
| 304 | |
Adam Nemet | e29686e | 2017-05-15 21:15:01 +0000 | [diff] [blame] | 305 | unsigned TargetTransformInfo::getMinVectorRegisterBitWidth() const { |
| 306 | return TTIImpl->getMinVectorRegisterBitWidth(); |
| 307 | } |
| 308 | |
Jun Bum Lim | dee5565 | 2017-04-03 19:20:07 +0000 | [diff] [blame] | 309 | bool TargetTransformInfo::shouldConsiderAddressTypePromotion( |
| 310 | const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const { |
| 311 | return TTIImpl->shouldConsiderAddressTypePromotion( |
| 312 | I, AllowPromotionWithoutCommonHeader); |
| 313 | } |
| 314 | |
Adam Nemet | af76110 | 2016-01-21 18:28:36 +0000 | [diff] [blame] | 315 | unsigned TargetTransformInfo::getCacheLineSize() const { |
| 316 | return TTIImpl->getCacheLineSize(); |
| 317 | } |
| 318 | |
Adam Nemet | dadfbb5 | 2016-01-27 22:21:25 +0000 | [diff] [blame] | 319 | unsigned TargetTransformInfo::getPrefetchDistance() const { |
| 320 | return TTIImpl->getPrefetchDistance(); |
| 321 | } |
| 322 | |
Adam Nemet | 6d8beec | 2016-03-18 00:27:38 +0000 | [diff] [blame] | 323 | unsigned TargetTransformInfo::getMinPrefetchStride() const { |
| 324 | return TTIImpl->getMinPrefetchStride(); |
| 325 | } |
| 326 | |
Adam Nemet | 709e304 | 2016-03-18 00:27:43 +0000 | [diff] [blame] | 327 | unsigned TargetTransformInfo::getMaxPrefetchIterationsAhead() const { |
| 328 | return TTIImpl->getMaxPrefetchIterationsAhead(); |
| 329 | } |
| 330 | |
Wei Mi | 062c744 | 2015-05-06 17:12:25 +0000 | [diff] [blame] | 331 | unsigned TargetTransformInfo::getMaxInterleaveFactor(unsigned VF) const { |
| 332 | return TTIImpl->getMaxInterleaveFactor(VF); |
Nadav Rotem | b696c36 | 2013-01-09 01:15:42 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 335 | int TargetTransformInfo::getArithmeticInstrCost( |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 336 | unsigned Opcode, Type *Ty, OperandValueKind Opd1Info, |
| 337 | OperandValueKind Opd2Info, OperandValueProperties Opd1PropInfo, |
Mohammed Agabaria | 2c96c43 | 2017-01-11 08:23:37 +0000 | [diff] [blame] | 338 | OperandValueProperties Opd2PropInfo, |
| 339 | ArrayRef<const Value *> Args) const { |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 340 | int Cost = TTIImpl->getArithmeticInstrCost(Opcode, Ty, Opd1Info, Opd2Info, |
Mohammed Agabaria | 2c96c43 | 2017-01-11 08:23:37 +0000 | [diff] [blame] | 341 | Opd1PropInfo, Opd2PropInfo, Args); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 342 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 343 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 344 | } |
| 345 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 346 | int TargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Ty, int Index, |
| 347 | Type *SubTp) const { |
| 348 | int Cost = TTIImpl->getShuffleCost(Kind, Ty, Index, SubTp); |
| 349 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 350 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 351 | } |
| 352 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 353 | int TargetTransformInfo::getCastInstrCost(unsigned Opcode, Type *Dst, |
Jonas Paulsson | fccc7d6 | 2017-04-12 11:49:08 +0000 | [diff] [blame] | 354 | Type *Src, const Instruction *I) const { |
| 355 | assert ((I == nullptr || I->getOpcode() == Opcode) && |
| 356 | "Opcode should reflect passed instruction."); |
| 357 | int Cost = TTIImpl->getCastInstrCost(Opcode, Dst, Src, I); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 358 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 359 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 360 | } |
| 361 | |
Matthew Simpson | e5dfb08 | 2016-04-27 15:20:21 +0000 | [diff] [blame] | 362 | int TargetTransformInfo::getExtractWithExtendCost(unsigned Opcode, Type *Dst, |
| 363 | VectorType *VecTy, |
| 364 | unsigned Index) const { |
| 365 | int Cost = TTIImpl->getExtractWithExtendCost(Opcode, Dst, VecTy, Index); |
| 366 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 367 | return Cost; |
| 368 | } |
| 369 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 370 | int TargetTransformInfo::getCFInstrCost(unsigned Opcode) const { |
| 371 | int Cost = TTIImpl->getCFInstrCost(Opcode); |
| 372 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 373 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 374 | } |
| 375 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 376 | int TargetTransformInfo::getCmpSelInstrCost(unsigned Opcode, Type *ValTy, |
Jonas Paulsson | fccc7d6 | 2017-04-12 11:49:08 +0000 | [diff] [blame] | 377 | Type *CondTy, const Instruction *I) const { |
| 378 | assert ((I == nullptr || I->getOpcode() == Opcode) && |
| 379 | "Opcode should reflect passed instruction."); |
| 380 | int Cost = TTIImpl->getCmpSelInstrCost(Opcode, ValTy, CondTy, I); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 381 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 382 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 383 | } |
| 384 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 385 | int TargetTransformInfo::getVectorInstrCost(unsigned Opcode, Type *Val, |
| 386 | unsigned Index) const { |
| 387 | int Cost = TTIImpl->getVectorInstrCost(Opcode, Val, Index); |
| 388 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 389 | return Cost; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 390 | } |
| 391 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 392 | int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src, |
| 393 | unsigned Alignment, |
Jonas Paulsson | fccc7d6 | 2017-04-12 11:49:08 +0000 | [diff] [blame] | 394 | unsigned AddressSpace, |
| 395 | const Instruction *I) const { |
| 396 | assert ((I == nullptr || I->getOpcode() == Opcode) && |
| 397 | "Opcode should reflect passed instruction."); |
| 398 | int Cost = TTIImpl->getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, I); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 399 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 400 | return Cost; |
Elena Demikhovsky | a3232f7 | 2015-01-25 08:44:46 +0000 | [diff] [blame] | 401 | } |
| 402 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 403 | int TargetTransformInfo::getMaskedMemoryOpCost(unsigned Opcode, Type *Src, |
| 404 | unsigned Alignment, |
| 405 | unsigned AddressSpace) const { |
| 406 | int Cost = |
| 407 | TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace); |
| 408 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 409 | return Cost; |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 410 | } |
| 411 | |
Elena Demikhovsky | 5494698 | 2015-12-28 20:10:59 +0000 | [diff] [blame] | 412 | int TargetTransformInfo::getGatherScatterOpCost(unsigned Opcode, Type *DataTy, |
| 413 | Value *Ptr, bool VariableMask, |
| 414 | unsigned Alignment) const { |
| 415 | int Cost = TTIImpl->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask, |
| 416 | Alignment); |
| 417 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 418 | return Cost; |
| 419 | } |
| 420 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 421 | int TargetTransformInfo::getInterleavedMemoryOpCost( |
Hao Liu | 32c0539 | 2015-06-08 06:39:56 +0000 | [diff] [blame] | 422 | unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices, |
| 423 | unsigned Alignment, unsigned AddressSpace) const { |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 424 | int Cost = TTIImpl->getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices, |
| 425 | Alignment, AddressSpace); |
| 426 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 427 | return Cost; |
Hao Liu | 32c0539 | 2015-06-08 06:39:56 +0000 | [diff] [blame] | 428 | } |
| 429 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 430 | int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, |
Jonas Paulsson | a48ea23 | 2017-03-14 06:35:36 +0000 | [diff] [blame] | 431 | ArrayRef<Type *> Tys, FastMathFlags FMF, |
| 432 | unsigned ScalarizationCostPassed) const { |
| 433 | int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Tys, FMF, |
| 434 | ScalarizationCostPassed); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 435 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 436 | return Cost; |
| 437 | } |
| 438 | |
Elena Demikhovsky | 5494698 | 2015-12-28 20:10:59 +0000 | [diff] [blame] | 439 | int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, |
Jonas Paulsson | a48ea23 | 2017-03-14 06:35:36 +0000 | [diff] [blame] | 440 | ArrayRef<Value *> Args, FastMathFlags FMF, unsigned VF) const { |
| 441 | int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Args, FMF, VF); |
Elena Demikhovsky | 5494698 | 2015-12-28 20:10:59 +0000 | [diff] [blame] | 442 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 443 | return Cost; |
| 444 | } |
| 445 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 446 | int TargetTransformInfo::getCallInstrCost(Function *F, Type *RetTy, |
| 447 | ArrayRef<Type *> Tys) const { |
| 448 | int Cost = TTIImpl->getCallInstrCost(F, RetTy, Tys); |
| 449 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 450 | return Cost; |
Michael Zolotukhin | 7ed84a8 | 2015-03-17 19:26:23 +0000 | [diff] [blame] | 451 | } |
| 452 | |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 453 | unsigned TargetTransformInfo::getNumberOfParts(Type *Tp) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 454 | return TTIImpl->getNumberOfParts(Tp); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 455 | } |
| 456 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 457 | int TargetTransformInfo::getAddressComputationCost(Type *Tp, |
Mohammed Agabaria | 23599ba | 2017-01-05 14:03:41 +0000 | [diff] [blame] | 458 | ScalarEvolution *SE, |
| 459 | const SCEV *Ptr) const { |
| 460 | int Cost = TTIImpl->getAddressComputationCost(Tp, SE, Ptr); |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 461 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 462 | return Cost; |
Arnold Schwaighofer | 594fa2d | 2013-02-08 14:50:48 +0000 | [diff] [blame] | 463 | } |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 464 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 465 | int TargetTransformInfo::getReductionCost(unsigned Opcode, Type *Ty, |
| 466 | bool IsPairwiseForm) const { |
| 467 | int Cost = TTIImpl->getReductionCost(Opcode, Ty, IsPairwiseForm); |
| 468 | assert(Cost >= 0 && "TTI should not produce negative costs!"); |
| 469 | return Cost; |
Arnold Schwaighofer | cae8735 | 2013-09-17 18:06:50 +0000 | [diff] [blame] | 470 | } |
| 471 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 472 | unsigned |
| 473 | TargetTransformInfo::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const { |
| 474 | return TTIImpl->getCostOfKeepingLiveOverCall(Tys); |
Chad Rosier | f9327d6 | 2015-01-26 22:51:15 +0000 | [diff] [blame] | 475 | } |
| 476 | |
| 477 | bool TargetTransformInfo::getTgtMemIntrinsic(IntrinsicInst *Inst, |
| 478 | MemIntrinsicInfo &Info) const { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 479 | return TTIImpl->getTgtMemIntrinsic(Inst, Info); |
Chad Rosier | f9327d6 | 2015-01-26 22:51:15 +0000 | [diff] [blame] | 480 | } |
| 481 | |
Anna Thomas | b2a212c | 2017-06-06 16:45:25 +0000 | [diff] [blame] | 482 | unsigned TargetTransformInfo::getAtomicMemIntrinsicMaxElementSize() const { |
| 483 | return TTIImpl->getAtomicMemIntrinsicMaxElementSize(); |
| 484 | } |
| 485 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 486 | Value *TargetTransformInfo::getOrCreateResultFromMemIntrinsic( |
| 487 | IntrinsicInst *Inst, Type *ExpectedType) const { |
| 488 | return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType); |
| 489 | } |
| 490 | |
Sean Fertile | 9cd1cdf | 2017-07-07 02:00:06 +0000 | [diff] [blame^] | 491 | Type *TargetTransformInfo::getMemcpyLoopLoweringType(LLVMContext &Context, |
| 492 | Value *Length, |
| 493 | unsigned SrcAlign, |
| 494 | unsigned DestAlign) const { |
| 495 | return TTIImpl->getMemcpyLoopLoweringType(Context, Length, SrcAlign, |
| 496 | DestAlign); |
| 497 | } |
| 498 | |
| 499 | void TargetTransformInfo::getMemcpyLoopResidualLoweringType( |
| 500 | SmallVectorImpl<Type *> &OpsOut, LLVMContext &Context, |
| 501 | unsigned RemainingBytes, unsigned SrcAlign, unsigned DestAlign) const { |
| 502 | TTIImpl->getMemcpyLoopResidualLoweringType(OpsOut, Context, RemainingBytes, |
| 503 | SrcAlign, DestAlign); |
| 504 | } |
| 505 | |
| 506 | bool TargetTransformInfo::useWideIRMemcpyLoopLowering() const { |
| 507 | return UseWideMemcpyLoopLowering; |
| 508 | } |
| 509 | |
Eric Christopher | d566fb1 | 2015-07-29 22:09:48 +0000 | [diff] [blame] | 510 | bool TargetTransformInfo::areInlineCompatible(const Function *Caller, |
| 511 | const Function *Callee) const { |
| 512 | return TTIImpl->areInlineCompatible(Caller, Callee); |
Eric Christopher | 4371b13 | 2015-07-02 01:11:47 +0000 | [diff] [blame] | 513 | } |
| 514 | |
Volkan Keles | 1c38681 | 2016-10-03 10:31:34 +0000 | [diff] [blame] | 515 | unsigned TargetTransformInfo::getLoadStoreVecRegBitWidth(unsigned AS) const { |
| 516 | return TTIImpl->getLoadStoreVecRegBitWidth(AS); |
| 517 | } |
| 518 | |
| 519 | bool TargetTransformInfo::isLegalToVectorizeLoad(LoadInst *LI) const { |
| 520 | return TTIImpl->isLegalToVectorizeLoad(LI); |
| 521 | } |
| 522 | |
| 523 | bool TargetTransformInfo::isLegalToVectorizeStore(StoreInst *SI) const { |
| 524 | return TTIImpl->isLegalToVectorizeStore(SI); |
| 525 | } |
| 526 | |
| 527 | bool TargetTransformInfo::isLegalToVectorizeLoadChain( |
| 528 | unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const { |
| 529 | return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment, |
| 530 | AddrSpace); |
| 531 | } |
| 532 | |
| 533 | bool TargetTransformInfo::isLegalToVectorizeStoreChain( |
| 534 | unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const { |
| 535 | return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment, |
| 536 | AddrSpace); |
| 537 | } |
| 538 | |
| 539 | unsigned TargetTransformInfo::getLoadVectorFactor(unsigned VF, |
| 540 | unsigned LoadSize, |
| 541 | unsigned ChainSizeInBytes, |
| 542 | VectorType *VecTy) const { |
| 543 | return TTIImpl->getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy); |
| 544 | } |
| 545 | |
| 546 | unsigned TargetTransformInfo::getStoreVectorFactor(unsigned VF, |
| 547 | unsigned StoreSize, |
| 548 | unsigned ChainSizeInBytes, |
| 549 | VectorType *VecTy) const { |
| 550 | return TTIImpl->getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy); |
| 551 | } |
| 552 | |
Amara Emerson | cf9daa3 | 2017-05-09 10:43:25 +0000 | [diff] [blame] | 553 | bool TargetTransformInfo::useReductionIntrinsic(unsigned Opcode, |
| 554 | Type *Ty, ReductionFlags Flags) const { |
| 555 | return TTIImpl->useReductionIntrinsic(Opcode, Ty, Flags); |
| 556 | } |
| 557 | |
Amara Emerson | 836b0f4 | 2017-05-10 09:42:49 +0000 | [diff] [blame] | 558 | bool TargetTransformInfo::shouldExpandReduction(const IntrinsicInst *II) const { |
| 559 | return TTIImpl->shouldExpandReduction(II); |
| 560 | } |
Amara Emerson | cf9daa3 | 2017-05-09 10:43:25 +0000 | [diff] [blame] | 561 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 562 | TargetTransformInfo::Concept::~Concept() {} |
| 563 | |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 564 | TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {} |
| 565 | |
| 566 | TargetIRAnalysis::TargetIRAnalysis( |
Eric Christopher | a4e5d3c | 2015-09-16 23:38:13 +0000 | [diff] [blame] | 567 | std::function<Result(const Function &)> TTICallback) |
Benjamin Kramer | 82de7d3 | 2016-05-27 14:27:24 +0000 | [diff] [blame] | 568 | : TTICallback(std::move(TTICallback)) {} |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 569 | |
Chandler Carruth | 164a2aa6 | 2016-06-17 00:11:01 +0000 | [diff] [blame] | 570 | TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F, |
Sean Silva | 36e0d01 | 2016-08-09 00:28:15 +0000 | [diff] [blame] | 571 | FunctionAnalysisManager &) { |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 572 | return TTICallback(F); |
| 573 | } |
| 574 | |
Chandler Carruth | dab4eae | 2016-11-23 17:53:26 +0000 | [diff] [blame] | 575 | AnalysisKey TargetIRAnalysis::Key; |
NAKAMURA Takumi | df0cd72 | 2016-02-28 17:17:00 +0000 | [diff] [blame] | 576 | |
Eric Christopher | a4e5d3c | 2015-09-16 23:38:13 +0000 | [diff] [blame] | 577 | TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) { |
Mehdi Amini | 5010ebf | 2015-07-09 02:08:42 +0000 | [diff] [blame] | 578 | return Result(F.getParent()->getDataLayout()); |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 579 | } |
| 580 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 581 | // Register the basic pass. |
| 582 | INITIALIZE_PASS(TargetTransformInfoWrapperPass, "tti", |
| 583 | "Target Transform Information", false, true) |
| 584 | char TargetTransformInfoWrapperPass::ID = 0; |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 585 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 586 | void TargetTransformInfoWrapperPass::anchor() {} |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 587 | |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 588 | TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass() |
Chandler Carruth | 5ec2b1d | 2015-02-01 12:26:09 +0000 | [diff] [blame] | 589 | : ImmutablePass(ID) { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 590 | initializeTargetTransformInfoWrapperPassPass( |
| 591 | *PassRegistry::getPassRegistry()); |
| 592 | } |
| 593 | |
| 594 | TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass( |
Chandler Carruth | 5ec2b1d | 2015-02-01 12:26:09 +0000 | [diff] [blame] | 595 | TargetIRAnalysis TIRA) |
| 596 | : ImmutablePass(ID), TIRA(std::move(TIRA)) { |
Chandler Carruth | 705b185 | 2015-01-31 03:43:40 +0000 | [diff] [blame] | 597 | initializeTargetTransformInfoWrapperPassPass( |
| 598 | *PassRegistry::getPassRegistry()); |
| 599 | } |
| 600 | |
Eric Christopher | a4e5d3c | 2015-09-16 23:38:13 +0000 | [diff] [blame] | 601 | TargetTransformInfo &TargetTransformInfoWrapperPass::getTTI(const Function &F) { |
Sean Silva | 36e0d01 | 2016-08-09 00:28:15 +0000 | [diff] [blame] | 602 | FunctionAnalysisManager DummyFAM; |
Chandler Carruth | 164a2aa6 | 2016-06-17 00:11:01 +0000 | [diff] [blame] | 603 | TTI = TIRA.run(F, DummyFAM); |
Chandler Carruth | 5ec2b1d | 2015-02-01 12:26:09 +0000 | [diff] [blame] | 604 | return *TTI; |
| 605 | } |
| 606 | |
Chandler Carruth | 93dcdc4 | 2015-01-31 11:17:59 +0000 | [diff] [blame] | 607 | ImmutablePass * |
Chandler Carruth | 5ec2b1d | 2015-02-01 12:26:09 +0000 | [diff] [blame] | 608 | llvm::createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA) { |
| 609 | return new TargetTransformInfoWrapperPass(std::move(TIRA)); |
Chandler Carruth | 539edf4 | 2013-01-05 11:43:11 +0000 | [diff] [blame] | 610 | } |