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 | |
| 30 | public: |
Eric Christopher | a4e5d3c | 2015-09-16 23:38:13 +0000 | [diff] [blame] | 31 | explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F) |
Mehdi Amini | 5010ebf | 2015-07-09 02:08:42 +0000 | [diff] [blame] | 32 | : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)), |
| 33 | TLI(ST->getTargetLowering()) {} |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 34 | |
| 35 | // Provide value semantics. MSVC requires that we spell all of these out. |
| 36 | SystemZTTIImpl(const SystemZTTIImpl &Arg) |
| 37 | : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {} |
| 38 | SystemZTTIImpl(SystemZTTIImpl &&Arg) |
| 39 | : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)), |
| 40 | TLI(std::move(Arg.TLI)) {} |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 41 | |
| 42 | /// \name Scalar TTI Implementations |
| 43 | /// @{ |
| 44 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 45 | int getIntImmCost(const APInt &Imm, Type *Ty); |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 46 | |
Chandler Carruth | 93205eb | 2015-08-05 18:08:10 +0000 | [diff] [blame] | 47 | int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty); |
| 48 | int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, |
| 49 | Type *Ty); |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 50 | |
Ulrich Weigand | b401218 | 2015-03-31 12:56:33 +0000 | [diff] [blame] | 51 | TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth); |
| 52 | |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 53 | /// @} |
Ulrich Weigand | ce4c109 | 2015-05-05 19:25:42 +0000 | [diff] [blame] | 54 | |
| 55 | /// \name Vector TTI Implementations |
| 56 | /// @{ |
| 57 | |
| 58 | unsigned getNumberOfRegisters(bool Vector); |
| 59 | unsigned getRegisterBitWidth(bool Vector); |
| 60 | |
| 61 | /// @} |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // end namespace llvm |
| 65 | |
| 66 | #endif |