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 #include "HexagonTargetTransformInfo.h"
17 #include "llvm/Support/Debug.h"
18 
19 using namespace llvm;
20 
21 #define DEBUG_TYPE "hexagontti"
22 
23 TargetTransformInfo::PopcntSupportKind
getPopcntSupport(unsigned IntTyWidthInBit) const24 HexagonTTIImpl::getPopcntSupport(unsigned IntTyWidthInBit) const {
25   // Return Fast Hardware support as every input  < 64 bits will be promoted
26   // to 64 bits.
27   return TargetTransformInfo::PSK_FastHardware;
28 }
29 
30 // The Hexagon target can unroll loops with run-time trip counts.
getUnrollingPreferences(Loop * L,TTI::UnrollingPreferences & UP)31 void HexagonTTIImpl::getUnrollingPreferences(Loop *L,
32                                              TTI::UnrollingPreferences &UP) {
33   UP.Runtime = UP.Partial = true;
34 }
35 
getNumberOfRegisters(bool vector) const36 unsigned HexagonTTIImpl::getNumberOfRegisters(bool vector) const {
37   return vector ? 0 : 32;
38 }
39