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 17namespace llvm { 18 19class 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 30public: 31 explicit SystemZTTIImpl(const SystemZTargetMachine *TM, Function &F) 32 : BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {} 33 34 // Provide value semantics. MSVC requires that we spell all of these out. 35 SystemZTTIImpl(const SystemZTTIImpl &Arg) 36 : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {} 37 SystemZTTIImpl(SystemZTTIImpl &&Arg) 38 : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)), 39 TLI(std::move(Arg.TLI)) {} 40 SystemZTTIImpl &operator=(const SystemZTTIImpl &RHS) { 41 BaseT::operator=(static_cast<const BaseT &>(RHS)); 42 ST = RHS.ST; 43 TLI = RHS.TLI; 44 return *this; 45 } 46 SystemZTTIImpl &operator=(SystemZTTIImpl &&RHS) { 47 BaseT::operator=(std::move(static_cast<BaseT &>(RHS))); 48 ST = std::move(RHS.ST); 49 TLI = std::move(RHS.TLI); 50 return *this; 51 } 52 53 /// \name Scalar TTI Implementations 54 /// @{ 55 56 unsigned getIntImmCost(const APInt &Imm, Type *Ty); 57 58 unsigned getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, 59 Type *Ty); 60 unsigned getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, 61 Type *Ty); 62 63 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth); 64 65 /// @} 66}; 67 68} // end namespace llvm 69 70#endif 71