[PATCH] D100316: [TTI] NFC: Change getFPOpCost to return InstructionCost
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 12 08:46:47 PDT 2021
sdesmalen created this revision.
Herald added a subscriber: hiraditya.
sdesmalen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100316
Files:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
Index: llvm/lib/Analysis/TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Analysis/TargetTransformInfo.cpp
+++ llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -526,8 +526,8 @@
return TTIImpl->isFCmpOrdCheaperThanFCmpZero(Ty);
}
-int TargetTransformInfo::getFPOpCost(Type *Ty) const {
- int Cost = TTIImpl->getFPOpCost(Ty);
+InstructionCost TargetTransformInfo::getFPOpCost(Type *Ty) const {
+ InstructionCost Cost = TTIImpl->getFPOpCost(Ty);
assert(Cost >= 0 && "TTI should not produce negative costs!");
return Cost;
}
Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -390,7 +390,7 @@
return true;
}
- unsigned getFPOpCost(Type *Ty) {
+ InstructionCost getFPOpCost(Type *Ty) {
// Check whether FADD is available, as a proxy for floating-point in
// general.
const TargetLoweringBase *TLI = getTLI();
Index: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -337,7 +337,7 @@
bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) const { return true; }
- unsigned getFPOpCost(Type *Ty) const {
+ InstructionCost getFPOpCost(Type *Ty) const {
return TargetTransformInfo::TCC_Basic;
}
Index: llvm/include/llvm/Analysis/TargetTransformInfo.h
===================================================================
--- llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -809,7 +809,7 @@
/// Return the expected cost of supporting the floating point operation
/// of the specified type.
- int getFPOpCost(Type *Ty) const;
+ InstructionCost getFPOpCost(Type *Ty) const;
/// Return the expected cost of materializing for the given integer
/// immediate of the specified type.
@@ -1510,7 +1510,7 @@
virtual PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) = 0;
virtual bool haveFastSqrt(Type *Ty) = 0;
virtual bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) = 0;
- virtual int getFPOpCost(Type *Ty) = 0;
+ virtual InstructionCost getFPOpCost(Type *Ty) = 0;
virtual int getIntImmCodeSizeCost(unsigned Opc, unsigned Idx,
const APInt &Imm, Type *Ty) = 0;
virtual int getIntImmCost(const APInt &Imm, Type *Ty,
@@ -1929,7 +1929,9 @@
return Impl.isFCmpOrdCheaperThanFCmpZero(Ty);
}
- int getFPOpCost(Type *Ty) override { return Impl.getFPOpCost(Ty); }
+ InstructionCost getFPOpCost(Type *Ty) override {
+ return Impl.getFPOpCost(Ty);
+ }
int getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, const APInt &Imm,
Type *Ty) override {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100316.336851.patch
Type: text/x-patch
Size: 2948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210412/2731121d/attachment.bin>
More information about the llvm-commits
mailing list