blob: 6de85df7f05243f99c780bf9e5c4e02038128056 [file] [log] [blame]
Tony Linthicumb4b54152011-12-12 21:14:40 +00001//==-- HexagonSubtarget.h - Define Subtarget for the Hexagon ----*- C++ -*-==//
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//===----------------------------------------------------------------------===//
9//
10// This file declares the Hexagon specific subclass of TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef Hexagon_SUBTARGET_H
15#define Hexagon_SUBTARGET_H
16
17#include "llvm/Target/TargetSubtargetInfo.h"
18#include "llvm/Target/TargetMachine.h"
19#include <string>
20
21#define GET_SUBTARGETINFO_HEADER
22#include "HexagonGenSubtargetInfo.inc"
23
24#define Hexagon_SMALL_DATA_THRESHOLD 8
25
26namespace llvm {
27
28class HexagonSubtarget : public HexagonGenSubtargetInfo {
29
30 bool UseMemOps;
31
32public:
33 enum HexagonArchEnum {
34 V1, V2, V3, V4
35 };
36
37 HexagonArchEnum HexagonArchVersion;
38 std::string CPUString;
39 InstrItineraryData InstrItins;
40
41public:
42 HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS);
43
44 /// getInstrItins - Return the instruction itineraies based on subtarget
45 /// selection.
46 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
47
48
49 /// ParseSubtargetFeatures - Parses features string setting specified
50 /// subtarget options. Definition of function is auto generated by tblgen.
51 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
52
53 bool hasV2TOps () const { return HexagonArchVersion >= V2; }
54 bool hasV2TOpsOnly () const { return HexagonArchVersion == V2; }
55 bool hasV3TOps () const { return HexagonArchVersion >= V3; }
56 bool hasV3TOpsOnly () const { return HexagonArchVersion == V3; }
57 bool hasV4TOps () const { return HexagonArchVersion >= V4; }
58 bool useMemOps () const { return HexagonArchVersion >= V4 && UseMemOps; }
59
60 bool isSubtargetV2() const { return HexagonArchVersion == V2;}
61 const std::string &getCPUString () const { return CPUString; }
62
63 // Threshold for small data section
64 unsigned getSmallDataThreshold() const {
65 return Hexagon_SMALL_DATA_THRESHOLD;
66 }
67 const HexagonArchEnum &getHexagonArchVersion() const {
68 return HexagonArchVersion;
69 }
70};
71
72} // end namespace llvm
73
74#endif