xref: /aosp_15_r20/external/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker 
10*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
11*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
12*9880d681SAndroid Build Coastguard Worker 
13*9880d681SAndroid Build Coastguard Worker #include "SystemZTargetMachine.h"
14*9880d681SAndroid Build Coastguard Worker #include "llvm/Analysis/TargetTransformInfo.h"
15*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/BasicTTIImpl.h"
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker namespace llvm {
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
20*9880d681SAndroid Build Coastguard Worker   typedef BasicTTIImplBase<SystemZTTIImpl> BaseT;
21*9880d681SAndroid Build Coastguard Worker   typedef TargetTransformInfo TTI;
22*9880d681SAndroid Build Coastguard Worker   friend BaseT;
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker   const SystemZSubtarget *ST;
25*9880d681SAndroid Build Coastguard Worker   const SystemZTargetLowering *TLI;
26*9880d681SAndroid Build Coastguard Worker 
getST()27*9880d681SAndroid Build Coastguard Worker   const SystemZSubtarget *getST() const { return ST; }
getTLI()28*9880d681SAndroid Build Coastguard Worker   const SystemZTargetLowering *getTLI() const { return TLI; }
29*9880d681SAndroid Build Coastguard Worker 
30*9880d681SAndroid Build Coastguard Worker public:
SystemZTTIImpl(const SystemZTargetMachine * TM,const Function & F)31*9880d681SAndroid Build Coastguard Worker   explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
32*9880d681SAndroid Build Coastguard Worker       : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
33*9880d681SAndroid Build Coastguard Worker         TLI(ST->getTargetLowering()) {}
34*9880d681SAndroid Build Coastguard Worker 
35*9880d681SAndroid Build Coastguard Worker   // Provide value semantics. MSVC requires that we spell all of these out.
SystemZTTIImpl(const SystemZTTIImpl & Arg)36*9880d681SAndroid Build Coastguard Worker   SystemZTTIImpl(const SystemZTTIImpl &Arg)
37*9880d681SAndroid Build Coastguard Worker       : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {}
SystemZTTIImpl(SystemZTTIImpl && Arg)38*9880d681SAndroid Build Coastguard Worker   SystemZTTIImpl(SystemZTTIImpl &&Arg)
39*9880d681SAndroid Build Coastguard Worker       : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
40*9880d681SAndroid Build Coastguard Worker         TLI(std::move(Arg.TLI)) {}
41*9880d681SAndroid Build Coastguard Worker 
42*9880d681SAndroid Build Coastguard Worker   /// \name Scalar TTI Implementations
43*9880d681SAndroid Build Coastguard Worker   /// @{
44*9880d681SAndroid Build Coastguard Worker 
45*9880d681SAndroid Build Coastguard Worker   int getIntImmCost(const APInt &Imm, Type *Ty);
46*9880d681SAndroid Build Coastguard Worker 
47*9880d681SAndroid Build Coastguard Worker   int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
48*9880d681SAndroid Build Coastguard Worker   int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
49*9880d681SAndroid Build Coastguard Worker                     Type *Ty);
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker   TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
52*9880d681SAndroid Build Coastguard Worker 
53*9880d681SAndroid Build Coastguard Worker   /// @}
54*9880d681SAndroid Build Coastguard Worker 
55*9880d681SAndroid Build Coastguard Worker   /// \name Vector TTI Implementations
56*9880d681SAndroid Build Coastguard Worker   /// @{
57*9880d681SAndroid Build Coastguard Worker 
58*9880d681SAndroid Build Coastguard Worker   unsigned getNumberOfRegisters(bool Vector);
59*9880d681SAndroid Build Coastguard Worker   unsigned getRegisterBitWidth(bool Vector);
60*9880d681SAndroid Build Coastguard Worker 
61*9880d681SAndroid Build Coastguard Worker   /// @}
62*9880d681SAndroid Build Coastguard Worker };
63*9880d681SAndroid Build Coastguard Worker 
64*9880d681SAndroid Build Coastguard Worker } // end namespace llvm
65*9880d681SAndroid Build Coastguard Worker 
66*9880d681SAndroid Build Coastguard Worker #endif
67