LLVM  4.0.0
HexagonTargetTransformInfo.h
Go to the documentation of this file.
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"
24 
25 namespace llvm {
26 
27 class HexagonTTIImpl : public BasicTTIImplBase<HexagonTTIImpl> {
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
MachineLoop * L
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:40
HexagonTTIImpl(const HexagonTargetMachine *TM, const Function &F)
#define F(x, y, z)
Definition: MD5.cpp:51
PopcntSupportKind
Flags indicating the kind of support for population count.
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
unsigned getNumberOfRegisters(bool vector) const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
void getUnrollingPreferences(Loop *L, TTI::UnrollingPreferences &UP)
const DataLayout & getDataLayout() const
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:368
static const Function * getParent(const Value *V)
TTI::PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const
This pass exposes codegen information to IR-level passes.
This file describes how to lower LLVM code to machine code.