]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303571, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Hexagon / HexagonTargetTransformInfo.h
1 //===-- HexagonTargetTransformInfo.cpp - Hexagon specific TTI pass --------===//
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 /// \file
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.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETTRANSFORMINFO_H
17 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETTRANSFORMINFO_H
18
19 #include "Hexagon.h"
20 #include "HexagonTargetMachine.h"
21 #include "llvm/Analysis/TargetTransformInfo.h"
22 #include "llvm/CodeGen/BasicTTIImpl.h"
23 #include "llvm/Target/TargetLowering.h"
24
25 namespace llvm {
26
27 class HexagonTTIImpl : public BasicTTIImplBase<HexagonTTIImpl> {
28   typedef BasicTTIImplBase<HexagonTTIImpl> BaseT;
29   typedef TargetTransformInfo TTI;
30   friend BaseT;
31
32   const HexagonSubtarget *ST;
33   const HexagonTargetLowering *TLI;
34
35   const HexagonSubtarget *getST() const { return ST; }
36   const HexagonTargetLowering *getTLI() const { return TLI; }
37
38 public:
39   explicit HexagonTTIImpl(const HexagonTargetMachine *TM, const Function &F)
40       : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
41         TLI(ST->getTargetLowering()) {}
42
43   /// \name Scalar TTI Implementations
44   /// @{
45
46   TTI::PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const;
47
48   // The Hexagon target can unroll loops with run-time trip counts.
49   void getUnrollingPreferences(Loop *L, TTI::UnrollingPreferences &UP);
50
51   // L1 cache prefetch.
52   unsigned getPrefetchDistance() const;
53   unsigned getCacheLineSize() const;
54
55   /// @}
56
57   /// \name Vector TTI Implementations
58   /// @{
59
60   unsigned getNumberOfRegisters(bool vector) const;
61
62   /// @}
63
64   int getUserCost(const User *U);
65 };
66
67 } // end namespace llvm
68
69 #endif