mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[TTI] NFC: Change getRegUsageForType to return InstructionCost.
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 Reviewed By: sdesmalen Differential Revision: https://reviews.llvm.org/D102541
This commit is contained in:
parent
02b1451e34
commit
53f301ea10
@ -709,7 +709,7 @@ public:
|
||||
bool isTypeLegal(Type *Ty) const;
|
||||
|
||||
/// Returns the estimated number of registers required to represent \p Ty.
|
||||
unsigned getRegUsageForType(Type *Ty) const;
|
||||
InstructionCost getRegUsageForType(Type *Ty) const;
|
||||
|
||||
/// Return true if switches should be turned into lookup tables for the
|
||||
/// target.
|
||||
@ -1528,7 +1528,7 @@ public:
|
||||
virtual bool isProfitableToHoist(Instruction *I) = 0;
|
||||
virtual bool useAA() = 0;
|
||||
virtual bool isTypeLegal(Type *Ty) = 0;
|
||||
virtual unsigned getRegUsageForType(Type *Ty) = 0;
|
||||
virtual InstructionCost getRegUsageForType(Type *Ty) = 0;
|
||||
virtual bool shouldBuildLookupTables() = 0;
|
||||
virtual bool shouldBuildLookupTablesForConstant(Constant *C) = 0;
|
||||
virtual bool shouldBuildRelLookupTables() = 0;
|
||||
@ -1921,7 +1921,7 @@ public:
|
||||
}
|
||||
bool useAA() override { return Impl.useAA(); }
|
||||
bool isTypeLegal(Type *Ty) override { return Impl.isTypeLegal(Ty); }
|
||||
unsigned getRegUsageForType(Type *Ty) override {
|
||||
InstructionCost getRegUsageForType(Type *Ty) override {
|
||||
return Impl.getRegUsageForType(Ty);
|
||||
}
|
||||
bool shouldBuildLookupTables() override {
|
||||
|
@ -291,7 +291,7 @@ public:
|
||||
|
||||
bool isTypeLegal(Type *Ty) const { return false; }
|
||||
|
||||
unsigned getRegUsageForType(Type *Ty) const { return 1; }
|
||||
InstructionCost getRegUsageForType(Type *Ty) const { return 1; }
|
||||
|
||||
bool shouldBuildLookupTables() const { return true; }
|
||||
|
||||
|
@ -356,9 +356,8 @@ public:
|
||||
return getTLI()->isTypeLegal(VT);
|
||||
}
|
||||
|
||||
unsigned getRegUsageForType(Type *Ty) {
|
||||
InstructionCost::CostType Val =
|
||||
*getTLI()->getTypeLegalizationCost(DL, Ty).first.getValue();
|
||||
InstructionCost getRegUsageForType(Type *Ty) {
|
||||
InstructionCost Val = getTLI()->getTypeLegalizationCost(DL, Ty).first;
|
||||
assert(Val >= 0 && "Negative cost!");
|
||||
return Val;
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ bool TargetTransformInfo::isTypeLegal(Type *Ty) const {
|
||||
return TTIImpl->isTypeLegal(Ty);
|
||||
}
|
||||
|
||||
unsigned TargetTransformInfo::getRegUsageForType(Type *Ty) const {
|
||||
InstructionCost TargetTransformInfo::getRegUsageForType(Type *Ty) const {
|
||||
return TTIImpl->getRegUsageForType(Ty);
|
||||
}
|
||||
|
||||
|
@ -6568,8 +6568,8 @@ LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef<ElementCount> VFs) {
|
||||
const auto &TTICapture = TTI;
|
||||
auto GetRegUsage = [&TTICapture](Type *Ty, ElementCount VF) {
|
||||
if (Ty->isTokenTy() || !VectorType::isValidElementType(Ty))
|
||||
return 0U;
|
||||
return TTICapture.getRegUsageForType(VectorType::get(Ty, VF));
|
||||
return 0;
|
||||
return *TTICapture.getRegUsageForType(VectorType::get(Ty, VF)).getValue();
|
||||
};
|
||||
|
||||
for (unsigned int i = 0, s = IdxToInstr.size(); i < s; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user