Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 1 | //===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H |
| 11 | #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H |
| 12 | |
| 13 | #include "SystemZTargetMachine.h" |
| 14 | #include "llvm/Analysis/TargetTransformInfo.h" |
| 15 | #include "llvm/CodeGen/BasicTTIImpl.h" |
| 16 | |
| 17 | namespace llvm { |
| 18 | |
| 19 | class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> { |
| 20 | typedef BasicTTIImplBase<SystemZTTIImpl> BaseT; |
| 21 | typedef TargetTransformInfo TTI; |
| 22 | friend BaseT; |
| 23 | |
| 24 | const SystemZSubtarget *ST; |
| 25 | const SystemZTargetLowering *TLI; |
| 26 | |
| 27 | const SystemZSubtarget *getST() const { return ST; } |
| 28 | const SystemZTargetLowering *getTLI() const { return TLI; } |
| 29 | |
Jonas Paulsson | fccc7d6 | 2017-04-12 11:49:08 +0000 | [diff] [blame] | 30 | unsigned const LIBCALL_COST = 30; |
| 31 | |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 32 | public: |
Eric Christopher | a4e5d3c | 2015-09-16 23:38:13 +0000 | [diff] [blame] | 33 | explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F) |
Mehdi Amini | 5010ebf | 2015-07-09 02:08:42 +0000 | [diff] [blame] | 34 | : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)), |
| 35 | TLI(ST->getTargetLowering()) {} |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 36 | |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 37 | /// \name Scalar TTI Implementations |
| 38 | /// @{ |
| 39 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 40 | int getIntImmCost(const APInt &Imm, Type *Ty); |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 41 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 42 | int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty); |
| 43 | int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, |
| 44 | Type *Ty); |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 45 | |
Ulrich Weigand | b401218 | 2015-03-31 12:56:33 +0000 | [diff] [blame] | 46 | TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth); |
| 47 | |
Jonas Paulsson | 58c5a7f | 2016-09-28 09:41:38 +0000 | [diff] [blame] | 48 | void getUnrollingPreferences(Loop *L, TTI::UnrollingPreferences &UP); |
| 49 | |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 50 | /// @} |
Ulrich Weigand | ce4c109 | 2015-05-05 19:25:42 +0000 | [diff] [blame] | 51 | |
| 52 | /// \name Vector TTI Implementations |
| 53 | /// @{ |
| 54 | |
| 55 | unsigned getNumberOfRegisters(bool Vector); |
| 56 | unsigned getRegisterBitWidth(bool Vector); |
| 57 | |
Jonas Paulsson | 8624b7e | 2017-05-24 13:42:56 +0000 | [diff] [blame^] | 58 | bool prefersVectorizedAddressing() { return false; } |
Jonas Paulsson | da74ed4 | 2017-04-12 12:41:37 +0000 | [diff] [blame] | 59 | bool supportsEfficientVectorElementLoadStore() { return true; } |
Jonas Paulsson | fccc7d6 | 2017-04-12 11:49:08 +0000 | [diff] [blame] | 60 | bool enableInterleavedAccessVectorization() { return true; } |
| 61 | |
| 62 | int getArithmeticInstrCost( |
| 63 | unsigned Opcode, Type *Ty, |
| 64 | TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue, |
| 65 | TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue, |
| 66 | TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None, |
| 67 | TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None, |
| 68 | ArrayRef<const Value *> Args = ArrayRef<const Value *>()); |
| 69 | int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp); |
| 70 | unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy); |
| 71 | unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy); |
| 72 | int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, |
| 73 | const Instruction *I = nullptr); |
| 74 | int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, |
| 75 | const Instruction *I = nullptr); |
| 76 | int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index); |
| 77 | int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, |
| 78 | unsigned AddressSpace, const Instruction *I = nullptr); |
| 79 | |
| 80 | int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, |
| 81 | unsigned Factor, |
| 82 | ArrayRef<unsigned> Indices, |
| 83 | unsigned Alignment, |
| 84 | unsigned AddressSpace); |
Ulrich Weigand | ce4c109 | 2015-05-05 19:25:42 +0000 | [diff] [blame] | 85 | /// @} |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | } // end namespace llvm |
| 89 | |
| 90 | #endif |