1 //===-- HexagonSubtarget.h - Define Subtarget for the Hexagon ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the Hexagon specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef Hexagon_SUBTARGET_H
15 #define Hexagon_SUBTARGET_H
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetSubtargetInfo.h"
21 #define GET_SUBTARGETINFO_HEADER
22 #include "HexagonGenSubtargetInfo.inc"
24 #define Hexagon_SMALL_DATA_THRESHOLD 8
25 #define Hexagon_SLOTS 4
29 class HexagonSubtarget : public HexagonGenSubtargetInfo {
35 enum HexagonArchEnum {
39 HexagonArchEnum HexagonArchVersion;
40 std::string CPUString;
41 InstrItineraryData InstrItins;
44 HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS);
46 /// getInstrItins - Return the instruction itineraies based on subtarget
48 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
51 /// ParseSubtargetFeatures - Parses features string setting specified
52 /// subtarget options. Definition of function is auto generated by tblgen.
53 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
55 bool hasV2TOps () const { return HexagonArchVersion >= V2; }
56 bool hasV2TOpsOnly () const { return HexagonArchVersion == V2; }
57 bool hasV3TOps () const { return HexagonArchVersion >= V3; }
58 bool hasV3TOpsOnly () const { return HexagonArchVersion == V3; }
59 bool hasV4TOps () const { return HexagonArchVersion >= V4; }
60 bool hasV4TOpsOnly () const { return HexagonArchVersion == V4; }
61 bool useMemOps () const { return HexagonArchVersion >= V4 && UseMemOps; }
62 bool hasV5TOps () const { return HexagonArchVersion >= V5; }
63 bool hasV5TOpsOnly () const { return HexagonArchVersion == V5; }
64 bool modeIEEERndNear () const { return ModeIEEERndNear; }
66 bool isSubtargetV2() const { return HexagonArchVersion == V2;}
67 const std::string &getCPUString () const { return CPUString; }
69 // Threshold for small data section
70 unsigned getSmallDataThreshold() const {
71 return Hexagon_SMALL_DATA_THRESHOLD;
73 const HexagonArchEnum &getHexagonArchVersion() const {
74 return HexagonArchVersion;
78 } // end namespace llvm