1 //===-- HexagonTargetTransformInfo.cpp - Hexagon specific TTI pass --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
9 /// This file implements a TargetTransformInfo analysis pass specific to the
10 /// Hexagon target machine. It uses the target's detailed information to provide
11 /// more precise answers to certain TTI queries, while letting the target
12 /// independent and default TTI implementations handle the rest.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETTRANSFORMINFO_H
17 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETTRANSFORMINFO_H
20 #include "HexagonTargetMachine.h"
21 #include "llvm/Analysis/TargetTransformInfo.h"
22 #include "llvm/CodeGen/BasicTTIImpl.h"
23 #include "llvm/Target/TargetLowering.h"
27 class HexagonTTIImpl : public BasicTTIImplBase<HexagonTTIImpl> {
28 typedef BasicTTIImplBase<HexagonTTIImpl> BaseT;
29 typedef TargetTransformInfo TTI;
32 const HexagonSubtarget *ST;
33 const HexagonTargetLowering *TLI;
35 const HexagonSubtarget *getST() const { return ST; }
36 const HexagonTargetLowering *getTLI() const { return TLI; }
39 explicit HexagonTTIImpl(const HexagonTargetMachine *TM, Function &F)
40 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
41 TLI(ST->getTargetLowering()) {}
43 // Provide value semantics. MSVC requires that we spell all of these out.
44 HexagonTTIImpl(const HexagonTTIImpl &Arg)
45 : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {}
46 HexagonTTIImpl(HexagonTTIImpl &&Arg)
47 : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
48 TLI(std::move(Arg.TLI)) {}
50 /// \name Scalar TTI Implementations
53 TTI::PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const;
55 // The Hexagon target can unroll loops with run-time trip counts.
56 void getUnrollingPreferences(Loop *L, TTI::UnrollingPreferences &UP);
60 /// \name Vector TTI Implementations
63 unsigned getNumberOfRegisters(bool vector) const;
68 } // end namespace llvm