blob: ff70fb27b277aa2c0566640949e6a287faa89bc8 [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">;
Colin LeMahieu7cd08922015-11-09 04:07:48 +000033def ExtensionHVXDbl: SubtargetFeature<"hvxDbl", "UseHVXDblOps",
34 "true", "Hexagon HVX Double instructions">;
35
Tony Linthicum1213a7a2011-12-12 21:14:40 +000036//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000037// Hexagon Instruction Predicate Definitions.
38//===----------------------------------------------------------------------===//
Colin LeMahieu7c958712015-10-17 01:33:04 +000039def HasV5T : Predicate<"HST->hasV5TOps()">;
40def NoV5T : Predicate<"!HST->hasV5TOps()">;
41def HasV55T : Predicate<"HST->hasV55TOps()">,
42 AssemblerPredicate<"ArchV55">;
43def HasV60T : Predicate<"HST->hasV60TOps()">,
44 AssemblerPredicate<"ArchV60">;
45def UseMEMOP : Predicate<"HST->useMemOps()">;
46def IEEERndNearV5T : Predicate<"HST->modeIEEERndNear()">;
47def UseHVXDbl : Predicate<"HST->useHVXDblOps()">,
48 AssemblerPredicate<"ExtensionHVXDbl">;
49def UseHVXSgl : Predicate<"HST->useHVXSglOps()">;
50
51def UseHVX : Predicate<"HST->useHVXOps()">,
52 AssemblerPredicate<"ExtensionHVX">;
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000053
54//===----------------------------------------------------------------------===//
55// Classes used for relation maps.
56//===----------------------------------------------------------------------===//
Colin LeMahieu9161d472014-12-30 18:58:47 +000057
58class ImmRegShl;
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000059// PredRel - Filter class used to relate non-predicated instructions with their
60// predicated forms.
61class PredRel;
62// PredNewRel - Filter class used to relate predicated instructions with their
63// predicate-new forms.
64class PredNewRel: PredRel;
65// ImmRegRel - Filter class used to relate instructions having reg-reg form
66// with their reg-imm counterparts.
67class ImmRegRel;
68// NewValueRel - Filter class used to relate regular store instructions with
69// their new-value store form.
70class NewValueRel: PredNewRel;
71// NewValueRel - Filter class used to relate load/store instructions having
72// different addressing modes with each other.
73class AddrModeRel: NewValueRel;
74
75//===----------------------------------------------------------------------===//
76// Generate mapping table to relate non-predicate instructions with their
77// predicated formats - true and false.
78//
79
80def getPredOpcode : InstrMapping {
81 let FilterClass = "PredRel";
82 // Instructions with the same BaseOpcode and isNVStore values form a row.
Colin LeMahieu7c958712015-10-17 01:33:04 +000083 let RowFields = ["BaseOpcode", "isNVStore", "PNewValue", "isNT"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000084 // Instructions with the same predicate sense form a column.
85 let ColFields = ["PredSense"];
86 // The key column is the unpredicated instructions.
87 let KeyCol = [""];
88 // Value columns are PredSense=true and PredSense=false
89 let ValueCols = [["true"], ["false"]];
90}
91
92//===----------------------------------------------------------------------===//
Jyotsna Verma84c47102013-05-06 18:49:23 +000093// Generate mapping table to relate predicate-true instructions with their
94// predicate-false forms
95//
96def getFalsePredOpcode : InstrMapping {
97 let FilterClass = "PredRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +000098 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
Jyotsna Verma84c47102013-05-06 18:49:23 +000099 let ColFields = ["PredSense"];
100 let KeyCol = ["true"];
101 let ValueCols = [["false"]];
102}
103
104//===----------------------------------------------------------------------===//
105// Generate mapping table to relate predicate-false instructions with their
106// predicate-true forms
107//
108def getTruePredOpcode : InstrMapping {
109 let FilterClass = "PredRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +0000110 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
Jyotsna Verma84c47102013-05-06 18:49:23 +0000111 let ColFields = ["PredSense"];
112 let KeyCol = ["false"];
113 let ValueCols = [["true"]];
114}
115
116//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000117// Generate mapping table to relate predicated instructions with their .new
118// format.
119//
120def getPredNewOpcode : InstrMapping {
121 let FilterClass = "PredNewRel";
Jyotsna Verma5ed51812013-05-01 21:37:34 +0000122 let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000123 let ColFields = ["PNewValue"];
124 let KeyCol = [""];
125 let ValueCols = [["new"]];
126}
127
128//===----------------------------------------------------------------------===//
Jyotsna Verma438cec52013-05-10 20:58:11 +0000129// Generate mapping table to relate .new predicated instructions with their old
130// format.
131//
132def getPredOldOpcode : InstrMapping {
133 let FilterClass = "PredNewRel";
134 let RowFields = ["BaseOpcode", "PredSense", "isNVStore"];
135 let ColFields = ["PNewValue"];
136 let KeyCol = ["new"];
137 let ValueCols = [[""]];
138}
139
140//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000141// Generate mapping table to relate store instructions with their new-value
142// format.
143//
144def getNewValueOpcode : InstrMapping {
145 let FilterClass = "NewValueRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +0000146 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000147 let ColFields = ["NValueST"];
148 let KeyCol = ["false"];
149 let ValueCols = [["true"]];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000150}
151
Jyotsna Verma438cec52013-05-10 20:58:11 +0000152//===----------------------------------------------------------------------===//
153// Generate mapping table to relate new-value store instructions with their old
154// format.
155//
156def getNonNVStore : InstrMapping {
157 let FilterClass = "NewValueRel";
Colin LeMahieu7c958712015-10-17 01:33:04 +0000158 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
Jyotsna Verma438cec52013-05-10 20:58:11 +0000159 let ColFields = ["NValueST"];
160 let KeyCol = ["true"];
161 let ValueCols = [["false"]];
162}
163
Krzysztof Parzyszek02579052015-10-20 19:21:05 +0000164def getBaseWithImmOffset : InstrMapping {
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000165 let FilterClass = "AddrModeRel";
166 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
Krzysztof Parzyszek05da79d2015-10-20 19:04:53 +0000167 "isFloat"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000168 let ColFields = ["addrMode"];
169 let KeyCol = ["Absolute"];
170 let ValueCols = [["BaseImmOffset"]];
171}
172
173def getBaseWithRegOffset : InstrMapping {
174 let FilterClass = "AddrModeRel";
175 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
176 let ColFields = ["addrMode"];
177 let KeyCol = ["BaseImmOffset"];
178 let ValueCols = [["BaseRegOffset"]];
179}
180
181def getRegForm : InstrMapping {
182 let FilterClass = "ImmRegRel";
183 let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
184 let ColFields = ["InputType"];
185 let KeyCol = ["imm"];
186 let ValueCols = [["reg"]];
187}
188
189//===----------------------------------------------------------------------===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000190// Register File, Calling Conv, Instruction Descriptions
191//===----------------------------------------------------------------------===//
192include "HexagonSchedule.td"
193include "HexagonRegisterInfo.td"
194include "HexagonCallingConv.td"
195include "HexagonInstrInfo.td"
196include "HexagonIntrinsics.td"
197include "HexagonIntrinsicsDerived.td"
198
Evandro Menezes5cee6212012-04-12 17:55:53 +0000199def HexagonInstrInfo : InstrInfo;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000200
201//===----------------------------------------------------------------------===//
202// Hexagon processors supported.
203//===----------------------------------------------------------------------===//
204
Andrew Trick87255e32012-07-07 04:00:00 +0000205class Proc<string Name, SchedMachineModel Model,
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000206 list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000207 : ProcessorModel<Name, Model, Features>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000208
Colin LeMahieu4fd203d2015-02-09 21:56:37 +0000209def : Proc<"hexagonv4", HexagonModelV4,
210 [ArchV4]>;
211def : Proc<"hexagonv5", HexagonModelV4,
212 [ArchV4, ArchV5]>;
Sirish Pande69295b82012-05-10 20:20:25 +0000213
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000214//===----------------------------------------------------------------------===//
215// Declare the target which we are implementing
216//===----------------------------------------------------------------------===//
217
Colin LeMahieu7cd08922015-11-09 04:07:48 +0000218def HexagonAsmParserVariant : AsmParserVariant {
219 int Variant = 0;
220 string TokenizingCharacters = "#()=:.<>!+*";
221}
222
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000223def Hexagon : Target {
224 // Pull in Instruction Info:
225 let InstructionSet = HexagonInstrInfo;
Colin LeMahieu7cd08922015-11-09 04:07:48 +0000226 let AssemblyParserVariants = [HexagonAsmParserVariant];
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000227}