blob: 77c21bda30f743b8bfa1cdddb073449fdd9fe950 [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
24// Hexagon Archtectures
25def ArchV2 : SubtargetFeature<"v2", "HexagonArchVersion", "V2",
26 "Hexagon v2">;
27def ArchV3 : SubtargetFeature<"v3", "HexagonArchVersion", "V3",
28 "Hexagon v3">;
29def ArchV4 : SubtargetFeature<"v4", "HexagonArchVersion", "V4",
30 "Hexagon v4">;
Sirish Pande69295b82012-05-10 20:20:25 +000031def ArchV5 : SubtargetFeature<"v5", "HexagonArchVersion", "V5",
32 "Hexagon v5">;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000033
34//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000035// Hexagon Instruction Predicate Definitions.
36//===----------------------------------------------------------------------===//
37def HasV2T : Predicate<"Subtarget.hasV2TOps()">;
38def HasV2TOnly : Predicate<"Subtarget.hasV2TOpsOnly()">;
39def NoV2T : Predicate<"!Subtarget.hasV2TOps()">;
40def HasV3T : Predicate<"Subtarget.hasV3TOps()">;
41def HasV3TOnly : Predicate<"Subtarget.hasV3TOpsOnly()">;
42def NoV3T : Predicate<"!Subtarget.hasV3TOps()">;
43def HasV4T : Predicate<"Subtarget.hasV4TOps()">;
44def NoV4T : Predicate<"!Subtarget.hasV4TOps()">;
45def HasV5T : Predicate<"Subtarget.hasV5TOps()">;
46def NoV5T : Predicate<"!Subtarget.hasV5TOps()">;
47def UseMEMOP : Predicate<"Subtarget.useMemOps()">;
48def IEEERndNearV5T : Predicate<"Subtarget.modeIEEERndNear()">;
49
50//===----------------------------------------------------------------------===//
51// Classes used for relation maps.
52//===----------------------------------------------------------------------===//
Colin LeMahieu9161d472014-12-30 18:58:47 +000053
54class ImmRegShl;
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000055// PredRel - Filter class used to relate non-predicated instructions with their
56// predicated forms.
57class PredRel;
58// PredNewRel - Filter class used to relate predicated instructions with their
59// predicate-new forms.
60class PredNewRel: PredRel;
61// ImmRegRel - Filter class used to relate instructions having reg-reg form
62// with their reg-imm counterparts.
63class ImmRegRel;
64// NewValueRel - Filter class used to relate regular store instructions with
65// their new-value store form.
66class NewValueRel: PredNewRel;
67// NewValueRel - Filter class used to relate load/store instructions having
68// different addressing modes with each other.
69class AddrModeRel: NewValueRel;
70
71//===----------------------------------------------------------------------===//
72// Generate mapping table to relate non-predicate instructions with their
73// predicated formats - true and false.
74//
75
76def getPredOpcode : InstrMapping {
77 let FilterClass = "PredRel";
78 // Instructions with the same BaseOpcode and isNVStore values form a row.
79 let RowFields = ["BaseOpcode", "isNVStore", "PNewValue"];
80 // Instructions with the same predicate sense form a column.
81 let ColFields = ["PredSense"];
82 // The key column is the unpredicated instructions.
83 let KeyCol = [""];
84 // Value columns are PredSense=true and PredSense=false
85 let ValueCols = [["true"], ["false"]];
86}
87
88//===----------------------------------------------------------------------===//
Jyotsna Verma84c47102013-05-06 18:49:23 +000089// Generate mapping table to relate predicate-true instructions with their
90// predicate-false forms
91//
92def getFalsePredOpcode : InstrMapping {
93 let FilterClass = "PredRel";
94 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken"];
95 let ColFields = ["PredSense"];
96 let KeyCol = ["true"];
97 let ValueCols = [["false"]];
98}
99
100//===----------------------------------------------------------------------===//
101// Generate mapping table to relate predicate-false instructions with their
102// predicate-true forms
103//
104def getTruePredOpcode : InstrMapping {
105 let FilterClass = "PredRel";
106 let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken"];
107 let ColFields = ["PredSense"];
108 let KeyCol = ["false"];
109 let ValueCols = [["true"]];
110}
111
112//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000113// Generate mapping table to relate predicated instructions with their .new
114// format.
115//
116def getPredNewOpcode : InstrMapping {
117 let FilterClass = "PredNewRel";
Jyotsna Verma5ed51812013-05-01 21:37:34 +0000118 let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000119 let ColFields = ["PNewValue"];
120 let KeyCol = [""];
121 let ValueCols = [["new"]];
122}
123
124//===----------------------------------------------------------------------===//
Jyotsna Verma438cec52013-05-10 20:58:11 +0000125// Generate mapping table to relate .new predicated instructions with their old
126// format.
127//
128def getPredOldOpcode : InstrMapping {
129 let FilterClass = "PredNewRel";
130 let RowFields = ["BaseOpcode", "PredSense", "isNVStore"];
131 let ColFields = ["PNewValue"];
132 let KeyCol = ["new"];
133 let ValueCols = [[""]];
134}
135
136//===----------------------------------------------------------------------===//
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000137// Generate mapping table to relate store instructions with their new-value
138// format.
139//
140def getNewValueOpcode : InstrMapping {
141 let FilterClass = "NewValueRel";
142 let RowFields = ["BaseOpcode", "PredSense", "PNewValue"];
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000143 let ColFields = ["NValueST"];
144 let KeyCol = ["false"];
145 let ValueCols = [["true"]];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000146}
147
Jyotsna Verma438cec52013-05-10 20:58:11 +0000148//===----------------------------------------------------------------------===//
149// Generate mapping table to relate new-value store instructions with their old
150// format.
151//
152def getNonNVStore : InstrMapping {
153 let FilterClass = "NewValueRel";
154 let RowFields = ["BaseOpcode", "PredSense", "PNewValue"];
155 let ColFields = ["NValueST"];
156 let KeyCol = ["true"];
157 let ValueCols = [["false"]];
158}
159
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000160def getBasedWithImmOffset : InstrMapping {
161 let FilterClass = "AddrModeRel";
162 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
163 "isMEMri", "isFloat"];
164 let ColFields = ["addrMode"];
165 let KeyCol = ["Absolute"];
166 let ValueCols = [["BaseImmOffset"]];
167}
168
169def getBaseWithRegOffset : InstrMapping {
170 let FilterClass = "AddrModeRel";
171 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
172 let ColFields = ["addrMode"];
173 let KeyCol = ["BaseImmOffset"];
174 let ValueCols = [["BaseRegOffset"]];
175}
176
177def getRegForm : InstrMapping {
178 let FilterClass = "ImmRegRel";
179 let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
180 let ColFields = ["InputType"];
181 let KeyCol = ["imm"];
182 let ValueCols = [["reg"]];
183}
184
Colin LeMahieu9161d472014-12-30 18:58:47 +0000185def getRegShlForm : InstrMapping {
186 let FilterClass = "ImmRegShl";
187 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
188 let ColFields = ["InputType"];
189 let KeyCol = ["imm"];
190 let ValueCols = [["reg"]];
191}
192
Jyotsna Vermaefe4f552012-12-04 04:29:16 +0000193//===----------------------------------------------------------------------===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000194// Register File, Calling Conv, Instruction Descriptions
195//===----------------------------------------------------------------------===//
196include "HexagonSchedule.td"
197include "HexagonRegisterInfo.td"
198include "HexagonCallingConv.td"
199include "HexagonInstrInfo.td"
200include "HexagonIntrinsics.td"
201include "HexagonIntrinsicsDerived.td"
202
Evandro Menezes5cee6212012-04-12 17:55:53 +0000203def HexagonInstrInfo : InstrInfo;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000204
205//===----------------------------------------------------------------------===//
206// Hexagon processors supported.
207//===----------------------------------------------------------------------===//
208
Andrew Trick87255e32012-07-07 04:00:00 +0000209class Proc<string Name, SchedMachineModel Model,
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000210 list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000211 : ProcessorModel<Name, Model, Features>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000212
Andrew Trick87255e32012-07-07 04:00:00 +0000213def : Proc<"hexagonv4", HexagonModelV4, [ArchV2, ArchV3, ArchV4]>;
214def : Proc<"hexagonv5", HexagonModelV4, [ArchV2, ArchV3, ArchV4, ArchV5]>;
Sirish Pande69295b82012-05-10 20:20:25 +0000215
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000216//===----------------------------------------------------------------------===//
217// Declare the target which we are implementing
218//===----------------------------------------------------------------------===//
219
220def Hexagon : Target {
221 // Pull in Instruction Info:
222 let InstructionSet = HexagonInstrInfo;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000223}