Index: include/llvm/Analysis/TargetTransformInfo.h =================================================================== --- include/llvm/Analysis/TargetTransformInfo.h +++ include/llvm/Analysis/TargetTransformInfo.h @@ -145,6 +145,9 @@ llvm_unreachable("Unknown instruction cost kind"); } + /// \brief Return true if the target architecture is register-rich + bool isRegisterRich() const; + /// \brief Underlying constants for 'cost' values in this interface. /// /// Many APIs in this interface return a cost. This enum defines the @@ -959,6 +962,7 @@ virtual int getUserCost(const User *U, ArrayRef<const Value *> Operands) = 0; virtual bool hasBranchDivergence() = 0; + virtual bool isRegisterRich() = 0; virtual bool isSourceOfDivergence(const Value *V) = 0; virtual bool isAlwaysUniform(const Value *V) = 0; virtual unsigned getFlatAddressSpace() = 0; @@ -1155,6 +1159,7 @@ int getUserCost(const User *U, ArrayRef<const Value *> Operands) override { return Impl.getUserCost(U, Operands); } + bool isRegisterRich() override { return Impl.isRegisterRich(); } bool hasBranchDivergence() override { return Impl.hasBranchDivergence(); } bool isSourceOfDivergence(const Value *V) override { return Impl.isSourceOfDivergence(V); Index: include/llvm/Analysis/TargetTransformInfoImpl.h =================================================================== --- include/llvm/Analysis/TargetTransformInfoImpl.h +++ include/llvm/Analysis/TargetTransformInfoImpl.h @@ -178,6 +178,8 @@ } } + bool isRegisterRich() { return false; } + bool hasBranchDivergence() { return false; } bool isSourceOfDivergence(const Value *V) { return false; } Index: lib/Analysis/TargetTransformInfo.cpp =================================================================== --- lib/Analysis/TargetTransformInfo.cpp +++ lib/Analysis/TargetTransformInfo.cpp @@ -108,6 +108,10 @@ return Cost; } +bool TargetTransformInfo::isRegisterRich() const { + return TTIImpl->isRegisterRich(); +} + bool TargetTransformInfo::hasBranchDivergence() const { return TTIImpl->hasBranchDivergence(); }