blob: ca283ed8f34f54b17b25ff928f8cac3786a1e008 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- Hexagon.td - Describe the Hexagon Target Machine --*- tablegen -*--===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +00002//
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//
Jia Liub22310f2012-02-18 12:03:15 +000010// This is the top level entry point for the Hexagon target.
Tony Linthicum1213a7a2011-12-12 21:14:40 +000011//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// Target-independent interfaces which we are implementing
16//===----------------------------------------------------------------------===//
17
18include "llvm/Target/Target.td"
19
20//===----------------------------------------------------------------------===//
21// Hexagon Subtarget features.
Jia Liub22310f2012-02-18 12:03:15 +000022//===----------------------------------------------------------------------===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +000023
Colin LeMahieu4fd203d2015-02-09 21:56:37 +000024// Hexagon Architectures
25def ArchV4: SubtargetFeature<"v4", "HexagonArchVersion", "V4", "Hexagon V4">;
26def ArchV5: SubtargetFeature<"v5", "HexagonArchVersion", "V5", "Hexagon V5">;
Colin LeMahieu7c958712015-10-17 01:33:04 +000027def ArchV55: SubtargetFeature<"v55", "HexagonArchVersion", "V55", "Hexagon V55">;
28def ArchV60: SubtargetFeature<"v60", "HexagonArchVersion", "V60", "Hexagon V60">;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000029
Colin LeMahieu7c958712015-10-17 01:33:04 +000030// Hexagon ISA Extensions
31def ExtensionHVX: SubtargetFeature<"hvx", "UseHVXOps",
32 "true", "Hexagon HVX instructions">;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000033//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000034// Hexagon Instruction Predicate Definitions.
35//===----------------------------------------------------------------------===//
Colin LeMahieu7c958712015-10-17 01:33:04 +000036def HasV5T : Predicate<"HST->hasV5TOps()">;
37def NoV5T : Predicate<"!HST->hasV5TOps()">;
38def HasV55T : Predicate<"HST->hasV55TOps()">,
39 AssemblerPredicate<"ArchV55">;
40def HasV60T : Predicate<"HST->hasV60TOps()">,
41 AssemblerPredicate<"ArchV60">;
42def UseMEMOP : Predicate<"HST->useMemOps()">;
43def IEEERndNearV5T : Predicate<"HST->modeIEEERndNear()">;
44def UseHVXDbl : Predicate<"HST->useHVXDblOps()">,
45 AssemblerPredicate<"ExtensionHVXDbl">;
46def UseHVXSgl : Predicate<"HST->useHVXSglOps()">;
47
48def UseHVX : Predicate<"HST->useHVXOps()">,
49 AssemblerPredicate<"ExtensionHVX">;
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000050
51//===----------------------------------------------------------------------===//
52// Classes used for relation maps.
53//===----------------------------------------------------------------------===//
Colin LeMahieu9161d472014-12-30 18:58:47 +000054
55class ImmRegShl;
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000056// PredRel - Filter class used to relate non-predicated instructions with their
57// predicated forms.
58class PredRel;
59// PredNewRel - Filter class used to relate predicated instructions with their
60// predicate-new forms.
61class PredNewRel: PredRel;
62// ImmRegRel - Filter class used to relate instructions having reg-reg form
63// with their reg-imm counterparts.
64class ImmRegRel;
65// NewValueRel - Filter class used to relate regular store instructions with
66// their new-value store form.
67class NewValueRel: PredNewRel;
68// NewValueRel - Filter class used to relate load/store instructions having
69// different addressing modes with each other.
70class AddrModeRel: NewValueRel;
71
72//===----------------------------------------------------------------------===//
73// Generate mapping table to relate non-predicate instructions with their
74// predicated formats - true and false.
75//
76
77def getPredOpcode : InstrMapping {
78 let FilterClass = "PredRel";
79 // Instructions with the same BaseOpcode and isNVStore values form a row.
Colin LeMahieu7c958712015-10-17 01:33:04 +000080 let RowFields = ["BaseOpcode", "isNVStore", "PNewValue", "isNT"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000081 // Instructions with the same predicate sense form a column.
82 let ColFields = ["PredSense"];
83 // The key column is the unpredicated instructions.
84 let KeyCol = [""];
85 // Value columns are PredSense=true and PredSense=false
86 let ValueCols = [["true"], ["false"]];
87}
88
89//===----------------------------------------------------------------------===//
Jyotsna Verma84c47102013-05-06 18:49:23 +000090// Generate mapping table to relate predicate-true instructions with their
91// predicate-false forms
92//
93def getFalsePredOpcode : InstrMapping {
94 let FilterClass = "PredRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +000095 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
Jyotsna Verma84c47102013-05-06 18:49:23 +000096 let ColFields = ["PredSense"];
97 let KeyCol = ["true"];
98 let ValueCols = [["false"]];
99}
100
101//===----------------------------------------------------------------------===//
102// Generate mapping table to relate predicate-false instructions with their
103// predicate-true forms
104//
105def getTruePredOpcode : InstrMapping {
106 let FilterClass = "PredRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +0000107 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
Jyotsna Verma84c47102013-05-06 18:49:23 +0000108 let ColFields = ["PredSense"];
109 let KeyCol = ["false"];
110 let ValueCols = [["true"]];
111}
112
113//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000114// Generate mapping table to relate predicated instructions with their .new
115// format.
116//
117def getPredNewOpcode : InstrMapping {
118 let FilterClass = "PredNewRel";
Jyotsna Verma5ed51812013-05-01 21:37:34 +0000119 let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000120 let ColFields = ["PNewValue"];
121 let KeyCol = [""];
122 let ValueCols = [["new"]];
123}
124
125//===----------------------------------------------------------------------===//
Jyotsna Verma438cec52013-05-10 20:58:11 +0000126// Generate mapping table to relate .new predicated instructions with their old
127// format.
128//
129def getPredOldOpcode : InstrMapping {
130 let FilterClass = "PredNewRel";
131 let RowFields = ["BaseOpcode", "PredSense", "isNVStore"];
132 let ColFields = ["PNewValue"];
133 let KeyCol = ["new"];
134 let ValueCols = [[""]];
135}
136
137//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000138// Generate mapping table to relate store instructions with their new-value
139// format.
140//
141def getNewValueOpcode : InstrMapping {
142 let FilterClass = "NewValueRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +0000143 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000144 let ColFields = ["NValueST"];
145 let KeyCol = ["false"];
146 let ValueCols = [["true"]];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000147}
148
Jyotsna Verma438cec52013-05-10 20:58:11 +0000149//===----------------------------------------------------------------------===//
150// Generate mapping table to relate new-value store instructions with their old
151// format.
152//
153def getNonNVStore : InstrMapping {
154 let FilterClass = "NewValueRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +0000155 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
Jyotsna Verma438cec52013-05-10 20:58:11 +0000156 let ColFields = ["NValueST"];
157 let KeyCol = ["true"];
158 let ValueCols = [["false"]];
159}
160
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000161def getBasedWithImmOffset : InstrMapping {
162 let FilterClass = "AddrModeRel";
163 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
Krzysztof Parzyszek05da79d2015-10-20 19:04:53 +0000164 "isFloat"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000165 let ColFields = ["addrMode"];
166 let KeyCol = ["Absolute"];
167 let ValueCols = [["BaseImmOffset"]];
168}
169
170def 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"]];
176}
177
178def getRegForm : InstrMapping {
179 let FilterClass = "ImmRegRel";
180 let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
181 let ColFields = ["InputType"];
182 let KeyCol = ["imm"];
183 let ValueCols = [["reg"]];
184}
185
186//===----------------------------------------------------------------------===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000187// Register File, Calling Conv, Instruction Descriptions
188//===----------------------------------------------------------------------===//
189include "HexagonSchedule.td"
190include "HexagonRegisterInfo.td"
191include "HexagonCallingConv.td"
192include "HexagonInstrInfo.td"
193include "HexagonIntrinsics.td"
194include "HexagonIntrinsicsDerived.td"
195
Evandro Menezes5cee6212012-04-12 17:55:53 +0000196def HexagonInstrInfo : InstrInfo;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000197
198//===----------------------------------------------------------------------===//
199// Hexagon processors supported.
200//===----------------------------------------------------------------------===//
201
Andrew Trick87255e32012-07-07 04:00:00 +0000202class Proc<string Name, SchedMachineModel Model,
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000203 list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000204 : ProcessorModel<Name, Model, Features>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000205
Colin LeMahieu4fd203d2015-02-09 21:56:37 +0000206def : Proc<"hexagonv4", HexagonModelV4,
207 [ArchV4]>;
208def : Proc<"hexagonv5", HexagonModelV4,
209 [ArchV4, ArchV5]>;
Sirish Pande69295b82012-05-10 20:20:25 +0000210
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000211//===----------------------------------------------------------------------===//
212// Declare the target which we are implementing
213//===----------------------------------------------------------------------===//
214
215def Hexagon : Target {
216 // Pull in Instruction Info:
217 let InstructionSet = HexagonInstrInfo;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000218}