summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-04-13 20:46:50 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-04-13 20:46:50 +0000
commit4bdf1aa416b023d65fe2eb3ba5740f928be1842b (patch)
tree09bac398ae7ce302010efef732f6e9aab0ea102c /llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
parent13e186c088e59797435edd25c139b36060be803d (diff)
downloadbcm5719-llvm-4bdf1aa416b023d65fe2eb3ba5740f928be1842b.tar.gz
bcm5719-llvm-4bdf1aa416b023d65fe2eb3ba5740f928be1842b.zip
[Hexagon] Initial instruction cost model for auto-vectorization
llvm-svn: 330065
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h118
1 files changed, 35 insertions, 83 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h b/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
index 61ffdf64f9f..99de5c017e2 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
+++ b/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
@@ -37,16 +37,19 @@ class HexagonTTIImpl : public BasicTTIImplBase<HexagonTTIImpl> {
friend BaseT;
- const HexagonSubtarget *ST;
- const HexagonTargetLowering *TLI;
+ const HexagonSubtarget &ST;
+ const HexagonTargetLowering &TLI;
- const HexagonSubtarget *getST() const { return ST; }
- const HexagonTargetLowering *getTLI() const { return TLI; }
+ const HexagonSubtarget *getST() const { return &ST; }
+ const HexagonTargetLowering *getTLI() const { return &TLI; }
+
+ bool useHVX() const;
+ bool isTypeForHVX(Type *VecTy) const;
public:
explicit HexagonTTIImpl(const HexagonTargetMachine *TM, const Function &F)
- : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
- TLI(ST->getTargetLowering()) {}
+ : BaseT(TM, F.getParent()->getDataLayout()),
+ ST(*TM->getSubtargetImpl(F)), TLI(*ST.getTargetLowering()) {}
/// \name Scalar TTI Implementations
/// @{
@@ -73,110 +76,59 @@ public:
unsigned getMaxInterleaveFactor(unsigned VF);
unsigned getRegisterBitWidth(bool Vector) const;
unsigned getMinVectorRegisterBitWidth() const;
- bool shouldMaximizeVectorBandwidth(bool OptSize) const { return true; }
unsigned getMinimumVF(unsigned ElemWidth) const;
+ bool shouldMaximizeVectorBandwidth(bool OptSize) const {
+ return true;
+ }
bool supportsEfficientVectorElementLoadStore() {
return false;
}
-
- unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
- return 0;
- }
-
- unsigned getOperandsScalarizationOverhead(ArrayRef<const Value*> Args,
- unsigned VF) {
- return 0;
- }
-
- unsigned getCallInstrCost(Function *F, Type *RetTy, ArrayRef<Type*> Tys) {
- return 1;
- }
-
- unsigned getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
- ArrayRef<Value*> Args, FastMathFlags FMF, unsigned VF) {
- return BaseT::getIntrinsicInstrCost(ID, RetTy, Args, FMF, VF);
- }
- unsigned getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
- ArrayRef<Type*> Tys, FastMathFlags FMF,
- unsigned ScalarizationCostPassed = UINT_MAX) {
- return 1;
- }
-
bool hasBranchDivergence() {
return false;
}
-
bool enableAggressiveInterleaving(bool LoopHasReductions) {
return false;
}
-
- unsigned getCFInstrCost(unsigned Opcode) {
- return 1;
- }
-
- unsigned getAddressComputationCost(Type *Tp, ScalarEvolution *,
- const SCEV *) {
- return 0;
+ bool prefersVectorizedAddressing() {
+ return false;
}
+ unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract);
+ unsigned getOperandsScalarizationOverhead(ArrayRef<const Value*> Args,
+ unsigned VF);
+ unsigned getCallInstrCost(Function *F, Type *RetTy, ArrayRef<Type*> Tys);
+ unsigned getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
+ ArrayRef<Value*> Args, FastMathFlags FMF, unsigned VF);
+ unsigned getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
+ ArrayRef<Type*> Tys, FastMathFlags FMF,
+ unsigned ScalarizationCostPassed = UINT_MAX);
+ unsigned getAddressComputationCost(Type *Tp, ScalarEvolution *SE,
+ const SCEV *S);
unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
unsigned AddressSpace, const Instruction *I = nullptr);
-
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
- unsigned AddressSpace) {
- return 1;
- }
-
+ unsigned AddressSpace);
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
- Type *SubTp) {
- return 1;
- }
-
+ Type *SubTp);
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy, Value *Ptr,
- bool VariableMask,
- unsigned Alignment) {
- return 1;
- }
-
+ bool VariableMask, unsigned Alignment);
unsigned getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
- unsigned Factor,
- ArrayRef<unsigned> Indices,
- unsigned Alignment,
- unsigned AddressSpace) {
- return BaseT::getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
- Alignment, AddressSpace);
- }
-
- unsigned getNumberOfParts(Type *Tp) {
- return BaseT::getNumberOfParts(Tp);
- }
-
- bool prefersVectorizedAddressing() {
- return true;
- }
-
+ unsigned Factor, ArrayRef<unsigned> Indices, unsigned Alignment,
+ unsigned AddressSpace);
unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
- const Instruction *I) {
- return BaseT::getCmpSelInstrCost(Opcode, ValTy, CondTy, I);
- }
-
+ const Instruction *I);
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty,
TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
- ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
- return BaseT::getArithmeticInstrCost(Opcode, Ty, Opd1Info, Opd2Info,
- Opd1PropInfo, Opd2PropInfo, Args);
- }
-
+ ArrayRef<const Value *> Args = ArrayRef<const Value *>());
unsigned getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
- const Instruction *I = nullptr) {
- return 1;
- }
+ const Instruction *I = nullptr);
+ unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
- unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index) {
+ unsigned getCFInstrCost(unsigned Opcode) {
return 1;
}
OpenPOWER on IntegriCloud