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 LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
15 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
17 #include "HexagonFrameLowering.h"
18 #include "HexagonISelLowering.h"
19 #include "HexagonInstrInfo.h"
20 #include "HexagonSelectionDAGInfo.h"
21 #include "llvm/IR/DataLayout.h"
22 #include "llvm/Target/TargetMachine.h"
23 #include "llvm/Target/TargetSubtargetInfo.h"
26 #define GET_SUBTARGETINFO_HEADER
27 #include "HexagonGenSubtargetInfo.inc"
29 #define Hexagon_SMALL_DATA_THRESHOLD 8
30 #define Hexagon_SLOTS 4
34 class HexagonSubtarget : public HexagonGenSubtargetInfo {
35 virtual void anchor();
41 enum HexagonArchEnum {
45 HexagonArchEnum HexagonArchVersion;
47 std::string CPUString;
48 HexagonInstrInfo InstrInfo;
49 HexagonTargetLowering TLInfo;
50 HexagonSelectionDAGInfo TSInfo;
51 HexagonFrameLowering FrameLowering;
52 InstrItineraryData InstrItins;
55 HexagonSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
56 const TargetMachine &TM);
58 /// getInstrItins - Return the instruction itineraries based on subtarget
60 const InstrItineraryData *getInstrItineraryData() const override {
63 const HexagonInstrInfo *getInstrInfo() const override { return &InstrInfo; }
64 const HexagonRegisterInfo *getRegisterInfo() const override {
65 return &InstrInfo.getRegisterInfo();
67 const HexagonTargetLowering *getTargetLowering() const override {
70 const HexagonFrameLowering *getFrameLowering() const override {
71 return &FrameLowering;
73 const HexagonSelectionDAGInfo *getSelectionDAGInfo() const override {
77 HexagonSubtarget &initializeSubtargetDependencies(StringRef CPU,
80 /// ParseSubtargetFeatures - Parses features string setting specified
81 /// subtarget options. Definition of function is auto generated by tblgen.
82 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
84 bool useMemOps() const { return UseMemOps; }
85 bool hasV5TOps() const { return getHexagonArchVersion() >= V5; }
86 bool hasV5TOpsOnly() const { return getHexagonArchVersion() == V5; }
87 bool modeIEEERndNear() const { return ModeIEEERndNear; }
88 bool enableMachineScheduler() const override;
89 // Always use the TargetLowering default scheduler.
90 // FIXME: This will use the vliw scheduler which is probably just hurting
91 // compiler time and will be removed eventually anyway.
92 bool enableMachineSchedDefaultSched() const override { return false; }
94 const std::string &getCPUString () const { return CPUString; }
96 // Threshold for small data section
97 unsigned getSmallDataThreshold() const {
98 return Hexagon_SMALL_DATA_THRESHOLD;
100 const HexagonArchEnum &getHexagonArchVersion() const {
101 return HexagonArchVersion;
105 } // end namespace llvm