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