1 //===-- Hexagon.td - Describe the Hexagon Target Machine --*- tablegen -*--===//
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 is the top level entry point for the Hexagon target.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // Target-independent interfaces which we are implementing
16 //===----------------------------------------------------------------------===//
18 include "llvm/Target/Target.td"
20 //===----------------------------------------------------------------------===//
21 // Hexagon Subtarget features.
22 //===----------------------------------------------------------------------===//
24 // Hexagon Architectures
25 def ArchV4: SubtargetFeature<"v4", "HexagonArchVersion", "V4", "Hexagon V4">;
26 def ArchV5: SubtargetFeature<"v5", "HexagonArchVersion", "V5", "Hexagon V5">;
27 def ArchV55: SubtargetFeature<"v55", "HexagonArchVersion", "V55", "Hexagon V55">;
28 def ArchV60: SubtargetFeature<"v60", "HexagonArchVersion", "V60", "Hexagon V60">;
30 // Hexagon ISA Extensions
31 def ExtensionHVX: SubtargetFeature<"hvx", "UseHVXOps",
32 "true", "Hexagon HVX instructions">;
33 //===----------------------------------------------------------------------===//
34 // Hexagon Instruction Predicate Definitions.
35 //===----------------------------------------------------------------------===//
36 def HasV5T : Predicate<"HST->hasV5TOps()">;
37 def NoV5T : Predicate<"!HST->hasV5TOps()">;
38 def HasV55T : Predicate<"HST->hasV55TOps()">,
39 AssemblerPredicate<"ArchV55">;
40 def HasV60T : Predicate<"HST->hasV60TOps()">,
41 AssemblerPredicate<"ArchV60">;
42 def UseMEMOP : Predicate<"HST->useMemOps()">;
43 def IEEERndNearV5T : Predicate<"HST->modeIEEERndNear()">;
44 def UseHVXDbl : Predicate<"HST->useHVXDblOps()">,
45 AssemblerPredicate<"ExtensionHVXDbl">;
46 def UseHVXSgl : Predicate<"HST->useHVXSglOps()">;
48 def UseHVX : Predicate<"HST->useHVXOps()">,
49 AssemblerPredicate<"ExtensionHVX">;
51 //===----------------------------------------------------------------------===//
52 // Classes used for relation maps.
53 //===----------------------------------------------------------------------===//
56 // PredRel - Filter class used to relate non-predicated instructions with their
59 // PredNewRel - Filter class used to relate predicated instructions with their
60 // predicate-new forms.
61 class PredNewRel: PredRel;
62 // ImmRegRel - Filter class used to relate instructions having reg-reg form
63 // with their reg-imm counterparts.
65 // NewValueRel - Filter class used to relate regular store instructions with
66 // their new-value store form.
67 class NewValueRel: PredNewRel;
68 // NewValueRel - Filter class used to relate load/store instructions having
69 // different addressing modes with each other.
70 class AddrModeRel: NewValueRel;
72 //===----------------------------------------------------------------------===//
73 // Generate mapping table to relate non-predicate instructions with their
74 // predicated formats - true and false.
77 def getPredOpcode : InstrMapping {
78 let FilterClass = "PredRel";
79 // Instructions with the same BaseOpcode and isNVStore values form a row.
80 let RowFields = ["BaseOpcode", "isNVStore", "PNewValue", "isNT"];
81 // Instructions with the same predicate sense form a column.
82 let ColFields = ["PredSense"];
83 // The key column is the unpredicated instructions.
85 // Value columns are PredSense=true and PredSense=false
86 let ValueCols = [["true"], ["false"]];
89 //===----------------------------------------------------------------------===//
90 // Generate mapping table to relate predicate-true instructions with their
91 // predicate-false forms
93 def getFalsePredOpcode : InstrMapping {
94 let FilterClass = "PredRel";
95 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
96 let ColFields = ["PredSense"];
97 let KeyCol = ["true"];
98 let ValueCols = [["false"]];
101 //===----------------------------------------------------------------------===//
102 // Generate mapping table to relate predicate-false instructions with their
103 // predicate-true forms
105 def getTruePredOpcode : InstrMapping {
106 let FilterClass = "PredRel";
107 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
108 let ColFields = ["PredSense"];
109 let KeyCol = ["false"];
110 let ValueCols = [["true"]];
113 //===----------------------------------------------------------------------===//
114 // Generate mapping table to relate predicated instructions with their .new
117 def getPredNewOpcode : InstrMapping {
118 let FilterClass = "PredNewRel";
119 let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
120 let ColFields = ["PNewValue"];
122 let ValueCols = [["new"]];
125 //===----------------------------------------------------------------------===//
126 // Generate mapping table to relate .new predicated instructions with their old
129 def getPredOldOpcode : InstrMapping {
130 let FilterClass = "PredNewRel";
131 let RowFields = ["BaseOpcode", "PredSense", "isNVStore"];
132 let ColFields = ["PNewValue"];
133 let KeyCol = ["new"];
134 let ValueCols = [[""]];
137 //===----------------------------------------------------------------------===//
138 // Generate mapping table to relate store instructions with their new-value
141 def getNewValueOpcode : InstrMapping {
142 let FilterClass = "NewValueRel";
143 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
144 let ColFields = ["NValueST"];
145 let KeyCol = ["false"];
146 let ValueCols = [["true"]];
149 //===----------------------------------------------------------------------===//
150 // Generate mapping table to relate new-value store instructions with their old
153 def getNonNVStore : InstrMapping {
154 let FilterClass = "NewValueRel";
155 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
156 let ColFields = ["NValueST"];
157 let KeyCol = ["true"];
158 let ValueCols = [["false"]];
161 def getBasedWithImmOffset : InstrMapping {
162 let FilterClass = "AddrModeRel";
163 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
165 let ColFields = ["addrMode"];
166 let KeyCol = ["Absolute"];
167 let ValueCols = [["BaseImmOffset"]];
170 def getBaseWithRegOffset : InstrMapping {
171 let FilterClass = "AddrModeRel";
172 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
173 let ColFields = ["addrMode"];
174 let KeyCol = ["BaseImmOffset"];
175 let ValueCols = [["BaseRegOffset"]];
178 def getRegForm : InstrMapping {
179 let FilterClass = "ImmRegRel";
180 let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
181 let ColFields = ["InputType"];
182 let KeyCol = ["imm"];
183 let ValueCols = [["reg"]];
186 //===----------------------------------------------------------------------===//
187 // Register File, Calling Conv, Instruction Descriptions
188 //===----------------------------------------------------------------------===//
189 include "HexagonSchedule.td"
190 include "HexagonRegisterInfo.td"
191 include "HexagonCallingConv.td"
192 include "HexagonInstrInfo.td"
193 include "HexagonIntrinsics.td"
194 include "HexagonIntrinsicsDerived.td"
196 def HexagonInstrInfo : InstrInfo;
198 //===----------------------------------------------------------------------===//
199 // Hexagon processors supported.
200 //===----------------------------------------------------------------------===//
202 class Proc<string Name, SchedMachineModel Model,
203 list<SubtargetFeature> Features>
204 : ProcessorModel<Name, Model, Features>;
206 def : Proc<"hexagonv4", HexagonModelV4,
208 def : Proc<"hexagonv5", HexagonModelV4,
211 //===----------------------------------------------------------------------===//
212 // Declare the target which we are implementing
213 //===----------------------------------------------------------------------===//
215 def Hexagon : Target {
216 // Pull in Instruction Info:
217 let InstructionSet = HexagonInstrInfo;