Add final and owerride keywords to TargetTransformInfo's subclasses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200021 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Juergen Ributzka 2014-01-24 18:22:59 +00:00
parent 342a479f8d
commit 8346f147ab
7 changed files with 143 additions and 126 deletions

View File

@ -231,14 +231,14 @@ unsigned TargetTransformInfo::getReductionCost(unsigned Opcode, Type *Ty,
namespace { namespace {
struct NoTTI : ImmutablePass, TargetTransformInfo { struct NoTTI LLVM_FINAL : ImmutablePass, TargetTransformInfo {
const DataLayout *DL; const DataLayout *DL;
NoTTI() : ImmutablePass(ID), DL(0) { NoTTI() : ImmutablePass(ID), DL(0) {
initializeNoTTIPass(*PassRegistry::getPassRegistry()); initializeNoTTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { virtual void initializePass() LLVM_OVERRIDE {
// Note that this subclass is special, and must *not* call initializeTTI as // Note that this subclass is special, and must *not* call initializeTTI as
// it does not chain. // it does not chain.
TopTTI = this; TopTTI = this;
@ -246,7 +246,7 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
DL = getAnalysisIfAvailable<DataLayout>(); DL = getAnalysisIfAvailable<DataLayout>();
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
// Note that this subclass is special, and must *not* call // Note that this subclass is special, and must *not* call
// TTI::getAnalysisUsage as it breaks the recursion. // TTI::getAnalysisUsage as it breaks the recursion.
} }
@ -255,13 +255,14 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
static char ID; static char ID;
/// Provide necessary pointer adjustments for the two base classes. /// Provide necessary pointer adjustments for the two base classes.
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo*)this; return (TargetTransformInfo*)this;
return this; return this;
} }
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) const { unsigned getOperationCost(unsigned Opcode, Type *Ty,
Type *OpTy) const LLVM_OVERRIDE {
switch (Opcode) { switch (Opcode) {
default: default:
// By default, just classify everything as 'basic'. // By default, just classify everything as 'basic'.
@ -318,7 +319,7 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
} }
unsigned getGEPCost(const Value *Ptr, unsigned getGEPCost(const Value *Ptr,
ArrayRef<const Value *> Operands) const { ArrayRef<const Value *> Operands) const LLVM_OVERRIDE {
// In the basic model, we just assume that all-constant GEPs will be folded // In the basic model, we just assume that all-constant GEPs will be folded
// into their uses via addressing modes. // into their uses via addressing modes.
for (unsigned Idx = 0, Size = Operands.size(); Idx != Size; ++Idx) for (unsigned Idx = 0, Size = Operands.size(); Idx != Size; ++Idx)
@ -328,7 +329,8 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
return TCC_Free; return TCC_Free;
} }
unsigned getCallCost(FunctionType *FTy, int NumArgs = -1) const { unsigned getCallCost(FunctionType *FTy, int NumArgs = -1) const LLVM_OVERRIDE
{
assert(FTy && "FunctionType must be provided to this routine."); assert(FTy && "FunctionType must be provided to this routine.");
// The target-independent implementation just measures the size of the // The target-independent implementation just measures the size of the
@ -343,7 +345,8 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
return TCC_Basic * (NumArgs + 1); return TCC_Basic * (NumArgs + 1);
} }
unsigned getCallCost(const Function *F, int NumArgs = -1) const { unsigned getCallCost(const Function *F, int NumArgs = -1) const LLVM_OVERRIDE
{
assert(F && "A concrete function must be provided to this routine."); assert(F && "A concrete function must be provided to this routine.");
if (NumArgs < 0) if (NumArgs < 0)
@ -364,7 +367,7 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
} }
unsigned getCallCost(const Function *F, unsigned getCallCost(const Function *F,
ArrayRef<const Value *> Arguments) const { ArrayRef<const Value *> Arguments) const LLVM_OVERRIDE {
// Simply delegate to generic handling of the call. // Simply delegate to generic handling of the call.
// FIXME: We should use instsimplify or something else to catch calls which // FIXME: We should use instsimplify or something else to catch calls which
// will constant fold with these arguments. // will constant fold with these arguments.
@ -372,7 +375,7 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
} }
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
ArrayRef<Type *> ParamTys) const { ArrayRef<Type *> ParamTys) const LLVM_OVERRIDE {
switch (IID) { switch (IID) {
default: default:
// Intrinsics rarely (if ever) have normal argument setup constraints. // Intrinsics rarely (if ever) have normal argument setup constraints.
@ -394,8 +397,9 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
} }
} }
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, unsigned
ArrayRef<const Value *> Arguments) const { getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
ArrayRef<const Value *> Arguments) const LLVM_OVERRIDE {
// Delegate to the generic intrinsic handling code. This mostly provides an // Delegate to the generic intrinsic handling code. This mostly provides an
// opportunity for targets to (for example) special case the cost of // opportunity for targets to (for example) special case the cost of
// certain intrinsics based on constants used as arguments. // certain intrinsics based on constants used as arguments.
@ -406,7 +410,7 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
return TopTTI->getIntrinsicCost(IID, RetTy, ParamTys); return TopTTI->getIntrinsicCost(IID, RetTy, ParamTys);
} }
unsigned getUserCost(const User *U) const { unsigned getUserCost(const User *U) const LLVM_OVERRIDE {
if (isa<PHINode>(U)) if (isa<PHINode>(U))
return TCC_Free; // Model all PHI nodes as free. return TCC_Free; // Model all PHI nodes as free.
@ -446,9 +450,9 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
U->getOperand(0)->getType() : 0); U->getOperand(0)->getType() : 0);
} }
bool hasBranchDivergence() const { return false; } bool hasBranchDivergence() const LLVM_OVERRIDE { return false; }
bool isLoweredToCall(const Function *F) const { bool isLoweredToCall(const Function *F) const LLVM_OVERRIDE {
// FIXME: These should almost certainly not be handled here, and instead // FIXME: These should almost certainly not be handled here, and instead
// handled with the help of TLI or the target itself. This was largely // handled with the help of TLI or the target itself. This was largely
// ported from existing analysis heuristics here so that such refactorings // ported from existing analysis heuristics here so that such refactorings
@ -479,126 +483,130 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
return true; return true;
} }
void getUnrollingPreferences(Loop *, UnrollingPreferences &) const { } void getUnrollingPreferences(Loop *,
UnrollingPreferences &) const LLVM_OVERRIDE
{ }
bool isLegalAddImmediate(int64_t Imm) const { bool isLegalAddImmediate(int64_t Imm) const LLVM_OVERRIDE {
return false; return false;
} }
bool isLegalICmpImmediate(int64_t Imm) const { bool isLegalICmpImmediate(int64_t Imm) const LLVM_OVERRIDE {
return false; return false;
} }
bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset,
bool HasBaseReg, int64_t Scale) const { bool HasBaseReg, int64_t Scale) const LLVM_OVERRIDE
{
// Guess that reg+reg addressing is allowed. This heuristic is taken from // Guess that reg+reg addressing is allowed. This heuristic is taken from
// the implementation of LSR. // the implementation of LSR.
return !BaseGV && BaseOffset == 0 && Scale <= 1; return !BaseGV && BaseOffset == 0 && Scale <= 1;
} }
int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset,
bool HasBaseReg, int64_t Scale) const { bool HasBaseReg, int64_t Scale) const LLVM_OVERRIDE {
// Guess that all legal addressing mode are free. // Guess that all legal addressing mode are free.
if(isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, Scale)) if(isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, Scale))
return 0; return 0;
return -1; return -1;
} }
bool isTruncateFree(Type *Ty1, Type *Ty2) const LLVM_OVERRIDE {
bool isTruncateFree(Type *Ty1, Type *Ty2) const {
return false; return false;
} }
bool isTypeLegal(Type *Ty) const { bool isTypeLegal(Type *Ty) const LLVM_OVERRIDE {
return false; return false;
} }
unsigned getJumpBufAlignment() const { unsigned getJumpBufAlignment() const LLVM_OVERRIDE {
return 0; return 0;
} }
unsigned getJumpBufSize() const { unsigned getJumpBufSize() const LLVM_OVERRIDE {
return 0; return 0;
} }
bool shouldBuildLookupTables() const { bool shouldBuildLookupTables() const LLVM_OVERRIDE {
return true; return true;
} }
PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const { PopcntSupportKind
getPopcntSupport(unsigned IntTyWidthInBit) const LLVM_OVERRIDE {
return PSK_Software; return PSK_Software;
} }
bool haveFastSqrt(Type *Ty) const { bool haveFastSqrt(Type *Ty) const LLVM_OVERRIDE {
return false; return false;
} }
unsigned getIntImmCost(const APInt &Imm, Type *Ty) const { unsigned getIntImmCost(const APInt &Imm, Type *Ty) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getNumberOfRegisters(bool Vector) const { unsigned getNumberOfRegisters(bool Vector) const LLVM_OVERRIDE {
return 8; return 8;
} }
unsigned getRegisterBitWidth(bool Vector) const { unsigned getRegisterBitWidth(bool Vector) const LLVM_OVERRIDE {
return 32; return 32;
} }
unsigned getMaximumUnrollFactor() const { unsigned getMaximumUnrollFactor() const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, OperandValueKind, unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, OperandValueKind,
OperandValueKind) const { OperandValueKind) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, unsigned getShuffleCost(ShuffleKind Kind, Type *Ty,
int Index = 0, Type *SubTp = 0) const { int Index = 0, Type *SubTp = 0) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getCastInstrCost(unsigned Opcode, Type *Dst, unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const { Type *Src) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getCFInstrCost(unsigned Opcode) const { unsigned getCFInstrCost(unsigned Opcode) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
Type *CondTy = 0) const { Type *CondTy = 0) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned getVectorInstrCost(unsigned Opcode, Type *Val,
unsigned Index = -1) const { unsigned Index = -1) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned getMemoryOpCost(unsigned Opcode,
Type *Src,
unsigned Alignment, unsigned Alignment,
unsigned AddressSpace) const { unsigned AddressSpace) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getIntrinsicInstrCost(Intrinsic::ID ID, unsigned getIntrinsicInstrCost(Intrinsic::ID ID,
Type *RetTy, Type *RetTy,
ArrayRef<Type*> Tys) const { ArrayRef<Type*> Tys) const LLVM_OVERRIDE {
return 1; return 1;
} }
unsigned getNumberOfParts(Type *Tp) const { unsigned getNumberOfParts(Type *Tp) const LLVM_OVERRIDE {
return 0; return 0;
} }
unsigned getAddressComputationCost(Type *Tp, bool) const { unsigned getAddressComputationCost(Type *Tp, bool) const LLVM_OVERRIDE {
return 0; return 0;
} }
unsigned getReductionCost(unsigned, Type *, bool) const { unsigned getReductionCost(unsigned, Type *, bool) const LLVM_OVERRIDE {
return 1; return 1;
} }
}; };

View File

@ -25,7 +25,7 @@ using namespace llvm;
namespace { namespace {
class BasicTTI : public ImmutablePass, public TargetTransformInfo { class BasicTTI LLVM_FINAL : public ImmutablePass, public TargetTransformInfo {
const TargetMachine *TM; const TargetMachine *TM;
/// Estimate the overhead of scalarizing an instruction. Insert and Extract /// Estimate the overhead of scalarizing an instruction. Insert and Extract
@ -43,7 +43,7 @@ public:
initializeBasicTTIPass(*PassRegistry::getPassRegistry()); initializeBasicTTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { virtual void initializePass() LLVM_OVERRIDE {
pushTTIStack(this); pushTTIStack(this);
} }
@ -51,7 +51,7 @@ public:
popTTIStack(); popTTIStack();
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
TargetTransformInfo::getAnalysisUsage(AU); TargetTransformInfo::getAnalysisUsage(AU);
} }
@ -59,61 +59,64 @@ public:
static char ID; static char ID;
/// Provide necessary pointer adjustments for the two base classes. /// Provide necessary pointer adjustments for the two base classes.
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo*)this; return (TargetTransformInfo*)this;
return this; return this;
} }
virtual bool hasBranchDivergence() const; virtual bool hasBranchDivergence() const LLVM_OVERRIDE;
/// \name Scalar TTI Implementations /// \name Scalar TTI Implementations
/// @{ /// @{
virtual bool isLegalAddImmediate(int64_t imm) const; virtual bool isLegalAddImmediate(int64_t imm) const LLVM_OVERRIDE;
virtual bool isLegalICmpImmediate(int64_t imm) const; virtual bool isLegalICmpImmediate(int64_t imm) const LLVM_OVERRIDE;
virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
int64_t BaseOffset, bool HasBaseReg, int64_t BaseOffset, bool HasBaseReg,
int64_t Scale) const; int64_t Scale) const LLVM_OVERRIDE;
virtual int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, virtual int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
int64_t BaseOffset, bool HasBaseReg, int64_t BaseOffset, bool HasBaseReg,
int64_t Scale) const; int64_t Scale) const LLVM_OVERRIDE;
virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const; virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const LLVM_OVERRIDE;
virtual bool isTypeLegal(Type *Ty) const; virtual bool isTypeLegal(Type *Ty) const LLVM_OVERRIDE;
virtual unsigned getJumpBufAlignment() const; virtual unsigned getJumpBufAlignment() const LLVM_OVERRIDE;
virtual unsigned getJumpBufSize() const; virtual unsigned getJumpBufSize() const LLVM_OVERRIDE;
virtual bool shouldBuildLookupTables() const; virtual bool shouldBuildLookupTables() const LLVM_OVERRIDE;
virtual bool haveFastSqrt(Type *Ty) const; virtual bool haveFastSqrt(Type *Ty) const LLVM_OVERRIDE;
virtual void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) const; virtual void getUnrollingPreferences(
Loop *L, UnrollingPreferences &UP) const LLVM_OVERRIDE;
/// @} /// @}
/// \name Vector TTI Implementations /// \name Vector TTI Implementations
/// @{ /// @{
virtual unsigned getNumberOfRegisters(bool Vector) const; virtual unsigned getNumberOfRegisters(bool Vector) const LLVM_OVERRIDE;
virtual unsigned getMaximumUnrollFactor() const; virtual unsigned getMaximumUnrollFactor() const LLVM_OVERRIDE;
virtual unsigned getRegisterBitWidth(bool Vector) const; virtual unsigned getRegisterBitWidth(bool Vector) const LLVM_OVERRIDE;
virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty,
OperandValueKind, OperandValueKind,
OperandValueKind) const; OperandValueKind) const LLVM_OVERRIDE;
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
int Index, Type *SubTp) const; int Index, Type *SubTp) const LLVM_OVERRIDE;
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst, virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const; Type *Src) const LLVM_OVERRIDE;
virtual unsigned getCFInstrCost(unsigned Opcode) const; virtual unsigned getCFInstrCost(unsigned Opcode) const LLVM_OVERRIDE;
virtual unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, virtual unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
Type *CondTy) const; Type *CondTy) const LLVM_OVERRIDE;
virtual unsigned getVectorInstrCost(unsigned Opcode, Type *Val, virtual unsigned getVectorInstrCost(unsigned Opcode, Type *Val,
unsigned Index) const; unsigned Index) const LLVM_OVERRIDE;
virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src, virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src,
unsigned Alignment, unsigned Alignment,
unsigned AddressSpace) const; unsigned AddressSpace) const LLVM_OVERRIDE;
virtual unsigned getIntrinsicInstrCost(Intrinsic::ID, Type *RetTy, virtual unsigned getIntrinsicInstrCost(
ArrayRef<Type*> Tys) const; Intrinsic::ID, Type *RetTy, ArrayRef<Type*> Tys) const LLVM_OVERRIDE;
virtual unsigned getNumberOfParts(Type *Tp) const; virtual unsigned getNumberOfParts(Type *Tp) const LLVM_OVERRIDE;
virtual unsigned getAddressComputationCost(Type *Ty, bool IsComplex) const; virtual unsigned getAddressComputationCost(
virtual unsigned getReductionCost(unsigned Opcode, Type *Ty, bool IsPairwise) const; Type *Ty, bool IsComplex) const LLVM_OVERRIDE;
virtual unsigned getReductionCost(unsigned Opcode, Type *Ty,
bool IsPairwise) const LLVM_OVERRIDE;
/// @} /// @}
}; };

View File

@ -32,7 +32,7 @@ void initializeARMTTIPass(PassRegistry &);
namespace { namespace {
class ARMTTI : public ImmutablePass, public TargetTransformInfo { class ARMTTI LLVM_FINAL : public ImmutablePass, public TargetTransformInfo {
const ARMBaseTargetMachine *TM; const ARMBaseTargetMachine *TM;
const ARMSubtarget *ST; const ARMSubtarget *ST;
const ARMTargetLowering *TLI; const ARMTargetLowering *TLI;
@ -52,7 +52,7 @@ public:
initializeARMTTIPass(*PassRegistry::getPassRegistry()); initializeARMTTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { virtual void initializePass() LLVM_OVERRIDE {
pushTTIStack(this); pushTTIStack(this);
} }
@ -60,7 +60,7 @@ public:
popTTIStack(); popTTIStack();
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
TargetTransformInfo::getAnalysisUsage(AU); TargetTransformInfo::getAnalysisUsage(AU);
} }
@ -68,7 +68,7 @@ public:
static char ID; static char ID;
/// Provide necessary pointer adjustments for the two base classes. /// Provide necessary pointer adjustments for the two base classes.
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo*)this; return (TargetTransformInfo*)this;
return this; return this;
@ -77,7 +77,8 @@ public:
/// \name Scalar TTI Implementations /// \name Scalar TTI Implementations
/// @{ /// @{
virtual unsigned getIntImmCost(const APInt &Imm, Type *Ty) const; virtual unsigned
getIntImmCost(const APInt &Imm, Type *Ty) const LLVM_OVERRIDE;
/// @} /// @}
@ -180,7 +181,7 @@ unsigned ARMTTI::getIntImmCost(const APInt &Imm, Type *Ty) const {
} }
unsigned ARMTTI::getCastInstrCost(unsigned Opcode, Type *Dst, unsigned ARMTTI::getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const { Type *Src) const {
int ISD = TLI->InstructionOpcodeToISD(Opcode); int ISD = TLI->InstructionOpcodeToISD(Opcode);
assert(ISD && "Invalid opcode"); assert(ISD && "Invalid opcode");
@ -469,7 +470,8 @@ unsigned ARMTTI::getShuffleCost(ShuffleKind Kind, Type *Tp, int Index,
return LT.first * NEONShuffleTbl[Idx].Cost; return LT.first * NEONShuffleTbl[Idx].Cost;
} }
unsigned ARMTTI::getArithmeticInstrCost(unsigned Opcode, Type *Ty, OperandValueKind Op1Info, unsigned ARMTTI::getArithmeticInstrCost(unsigned Opcode, Type *Ty,
OperandValueKind Op1Info,
OperandValueKind Op2Info) const { OperandValueKind Op2Info) const {
int ISDOpcode = TLI->InstructionOpcodeToISD(Opcode); int ISDOpcode = TLI->InstructionOpcodeToISD(Opcode);

View File

@ -32,7 +32,7 @@ void initializePPCTTIPass(PassRegistry &);
namespace { namespace {
class PPCTTI : public ImmutablePass, public TargetTransformInfo { class PPCTTI LLVM_FINAL : public ImmutablePass, public TargetTransformInfo {
const PPCTargetMachine *TM; const PPCTargetMachine *TM;
const PPCSubtarget *ST; const PPCSubtarget *ST;
const PPCTargetLowering *TLI; const PPCTargetLowering *TLI;
@ -52,7 +52,7 @@ public:
initializePPCTTIPass(*PassRegistry::getPassRegistry()); initializePPCTTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { virtual void initializePass() LLVM_OVERRIDE {
pushTTIStack(this); pushTTIStack(this);
} }
@ -60,7 +60,7 @@ public:
popTTIStack(); popTTIStack();
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
TargetTransformInfo::getAnalysisUsage(AU); TargetTransformInfo::getAnalysisUsage(AU);
} }
@ -68,7 +68,7 @@ public:
static char ID; static char ID;
/// Provide necessary pointer adjustments for the two base classes. /// Provide necessary pointer adjustments for the two base classes.
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo*)this; return (TargetTransformInfo*)this;
return this; return this;
@ -76,31 +76,33 @@ public:
/// \name Scalar TTI Implementations /// \name Scalar TTI Implementations
/// @{ /// @{
virtual PopcntSupportKind getPopcntSupport(unsigned TyWidth) const; virtual PopcntSupportKind
virtual void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) const; getPopcntSupport(unsigned TyWidth) const LLVM_OVERRIDE;
virtual void getUnrollingPreferences(
Loop *L, UnrollingPreferences &UP) const LLVM_OVERRIDE;
/// @} /// @}
/// \name Vector TTI Implementations /// \name Vector TTI Implementations
/// @{ /// @{
virtual unsigned getNumberOfRegisters(bool Vector) const; virtual unsigned getNumberOfRegisters(bool Vector) const LLVM_OVERRIDE;
virtual unsigned getRegisterBitWidth(bool Vector) const; virtual unsigned getRegisterBitWidth(bool Vector) const LLVM_OVERRIDE;
virtual unsigned getMaximumUnrollFactor() const; virtual unsigned getMaximumUnrollFactor() const LLVM_OVERRIDE;
virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty,
OperandValueKind, OperandValueKind,
OperandValueKind) const; OperandValueKind) const LLVM_OVERRIDE;
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
int Index, Type *SubTp) const; int Index, Type *SubTp) const LLVM_OVERRIDE;
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst, virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const; Type *Src) const LLVM_OVERRIDE;
virtual unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, virtual unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
Type *CondTy) const; Type *CondTy) const LLVM_OVERRIDE;
virtual unsigned getVectorInstrCost(unsigned Opcode, Type *Val, virtual unsigned getVectorInstrCost(unsigned Opcode, Type *Val,
unsigned Index) const; unsigned Index) const LLVM_OVERRIDE;
virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src, virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src,
unsigned Alignment, unsigned Alignment,
unsigned AddressSpace) const; unsigned AddressSpace) const LLVM_OVERRIDE;
/// @} /// @}
}; };

View File

@ -35,7 +35,7 @@ void initializeAMDGPUTTIPass(PassRegistry &);
namespace { namespace {
class AMDGPUTTI : public ImmutablePass, public TargetTransformInfo { class AMDGPUTTI LLVM_FINAL : public ImmutablePass, public TargetTransformInfo {
const AMDGPUTargetMachine *TM; const AMDGPUTargetMachine *TM;
const AMDGPUSubtarget *ST; const AMDGPUSubtarget *ST;
const AMDGPUTargetLowering *TLI; const AMDGPUTargetLowering *TLI;
@ -55,11 +55,11 @@ public:
initializeAMDGPUTTIPass(*PassRegistry::getPassRegistry()); initializeAMDGPUTTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { pushTTIStack(this); } virtual void initializePass() LLVM_OVERRIDE { pushTTIStack(this); }
virtual void finalizePass() { popTTIStack(); } virtual void finalizePass() { popTTIStack(); }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
TargetTransformInfo::getAnalysisUsage(AU); TargetTransformInfo::getAnalysisUsage(AU);
} }
@ -67,13 +67,13 @@ public:
static char ID; static char ID;
/// Provide necessary pointer adjustments for the two base classes. /// Provide necessary pointer adjustments for the two base classes.
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo *)this; return (TargetTransformInfo *)this;
return this; return this;
} }
virtual bool hasBranchDivergence() const; virtual bool hasBranchDivergence() const LLVM_OVERRIDE;
virtual void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) const; virtual void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) const;

View File

@ -32,7 +32,7 @@ void initializeX86TTIPass(PassRegistry &);
namespace { namespace {
class X86TTI : public ImmutablePass, public TargetTransformInfo { class X86TTI LLVM_FINAL : public ImmutablePass, public TargetTransformInfo {
const X86Subtarget *ST; const X86Subtarget *ST;
const X86TargetLowering *TLI; const X86TargetLowering *TLI;
@ -46,12 +46,12 @@ public:
} }
X86TTI(const X86TargetMachine *TM) X86TTI(const X86TargetMachine *TM)
: ImmutablePass(ID), ST(TM->getSubtargetImpl()), : ImmutablePass(ID), ST(TM->getSubtargetImpl()),
TLI(TM->getTargetLowering()) { TLI(TM->getTargetLowering()) {
initializeX86TTIPass(*PassRegistry::getPassRegistry()); initializeX86TTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { virtual void initializePass() LLVM_OVERRIDE {
pushTTIStack(this); pushTTIStack(this);
} }
@ -59,7 +59,7 @@ public:
popTTIStack(); popTTIStack();
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
TargetTransformInfo::getAnalysisUsage(AU); TargetTransformInfo::getAnalysisUsage(AU);
} }
@ -67,7 +67,7 @@ public:
static char ID; static char ID;
/// Provide necessary pointer adjustments for the two base classes. /// Provide necessary pointer adjustments for the two base classes.
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo*)this; return (TargetTransformInfo*)this;
return this; return this;
@ -75,35 +75,37 @@ public:
/// \name Scalar TTI Implementations /// \name Scalar TTI Implementations
/// @{ /// @{
virtual PopcntSupportKind getPopcntSupport(unsigned TyWidth) const; virtual PopcntSupportKind
getPopcntSupport(unsigned TyWidth) const LLVM_OVERRIDE;
/// @} /// @}
/// \name Vector TTI Implementations /// \name Vector TTI Implementations
/// @{ /// @{
virtual unsigned getNumberOfRegisters(bool Vector) const; virtual unsigned getNumberOfRegisters(bool Vector) const LLVM_OVERRIDE;
virtual unsigned getRegisterBitWidth(bool Vector) const; virtual unsigned getRegisterBitWidth(bool Vector) const LLVM_OVERRIDE;
virtual unsigned getMaximumUnrollFactor() const; virtual unsigned getMaximumUnrollFactor() const LLVM_OVERRIDE;
virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, virtual unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty,
OperandValueKind, OperandValueKind,
OperandValueKind) const; OperandValueKind) const LLVM_OVERRIDE;
virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, virtual unsigned getShuffleCost(ShuffleKind Kind, Type *Tp,
int Index, Type *SubTp) const; int Index, Type *SubTp) const LLVM_OVERRIDE;
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst, virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const; Type *Src) const LLVM_OVERRIDE;
virtual unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, virtual unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
Type *CondTy) const; Type *CondTy) const LLVM_OVERRIDE;
virtual unsigned getVectorInstrCost(unsigned Opcode, Type *Val, virtual unsigned getVectorInstrCost(unsigned Opcode, Type *Val,
unsigned Index) const; unsigned Index) const LLVM_OVERRIDE;
virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src, virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src,
unsigned Alignment, unsigned Alignment,
unsigned AddressSpace) const; unsigned AddressSpace) const LLVM_OVERRIDE;
virtual unsigned getAddressComputationCost(Type *PtrTy, bool IsComplex) const; virtual unsigned
getAddressComputationCost(Type *PtrTy, bool IsComplex) const LLVM_OVERRIDE;
virtual unsigned getReductionCost(unsigned Opcode, Type *Ty, virtual unsigned getReductionCost(unsigned Opcode, Type *Ty,
bool IsPairwiseForm) const; bool IsPairwiseForm) const LLVM_OVERRIDE;
/// @} /// @}
}; };

View File

@ -31,7 +31,7 @@ void initializeXCoreTTIPass(PassRegistry &);
namespace { namespace {
class XCoreTTI : public ImmutablePass, public TargetTransformInfo { class XCoreTTI LLVM_FINAL : public ImmutablePass, public TargetTransformInfo {
public: public:
XCoreTTI() : ImmutablePass(ID) { XCoreTTI() : ImmutablePass(ID) {
llvm_unreachable("This pass cannot be directly constructed"); llvm_unreachable("This pass cannot be directly constructed");
@ -42,7 +42,7 @@ public:
initializeXCoreTTIPass(*PassRegistry::getPassRegistry()); initializeXCoreTTIPass(*PassRegistry::getPassRegistry());
} }
virtual void initializePass() { virtual void initializePass() LLVM_OVERRIDE {
pushTTIStack(this); pushTTIStack(this);
} }
@ -50,19 +50,19 @@ public:
popTTIStack(); popTTIStack();
} }
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
TargetTransformInfo::getAnalysisUsage(AU); TargetTransformInfo::getAnalysisUsage(AU);
} }
static char ID; static char ID;
virtual void *getAdjustedAnalysisPointer(const void *ID) { virtual void *getAdjustedAnalysisPointer(const void *ID) LLVM_OVERRIDE {
if (ID == &TargetTransformInfo::ID) if (ID == &TargetTransformInfo::ID)
return (TargetTransformInfo*)this; return (TargetTransformInfo*)this;
return this; return this;
} }
unsigned getNumberOfRegisters(bool Vector) const { unsigned getNumberOfRegisters(bool Vector) const LLVM_OVERRIDE {
if (Vector) { if (Vector) {
return 0; return 0;
} }