1 //===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
11 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
13 #include "SystemZTargetMachine.h"
14 #include "llvm/Analysis/TargetTransformInfo.h"
15 #include "llvm/CodeGen/BasicTTIImpl.h"
19 class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
20 typedef BasicTTIImplBase<SystemZTTIImpl> BaseT;
21 typedef TargetTransformInfo TTI;
24 const SystemZSubtarget *ST;
25 const SystemZTargetLowering *TLI;
27 const SystemZSubtarget *getST() const { return ST; }
28 const SystemZTargetLowering *getTLI() const { return TLI; }
30 unsigned const LIBCALL_COST = 30;
33 explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
34 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
35 TLI(ST->getTargetLowering()) {}
37 /// \name Scalar TTI Implementations
40 int getIntImmCost(const APInt &Imm, Type *Ty);
42 int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
43 int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
46 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
48 void getUnrollingPreferences(Loop *L, TTI::UnrollingPreferences &UP);
52 /// \name Vector TTI Implementations
55 unsigned getNumberOfRegisters(bool Vector);
56 unsigned getRegisterBitWidth(bool Vector);
58 bool supportsEfficientVectorElementLoadStore() { return true; }
59 bool enableInterleavedAccessVectorization() { return true; }
61 int getArithmeticInstrCost(
62 unsigned Opcode, Type *Ty,
63 TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
64 TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
65 TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
66 TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
67 ArrayRef<const Value *> Args = ArrayRef<const Value *>());
68 int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
69 unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
70 unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
71 int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
72 const Instruction *I = nullptr);
73 int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
74 const Instruction *I = nullptr);
75 int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
76 int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
77 unsigned AddressSpace, const Instruction *I = nullptr);
79 int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
81 ArrayRef<unsigned> Indices,
83 unsigned AddressSpace);
87 } // end namespace llvm