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 Archtectures
25 def ArchV2 : SubtargetFeature<"v2", "HexagonArchVersion", "V2",
27 def ArchV3 : SubtargetFeature<"v3", "HexagonArchVersion", "V3",
29 def ArchV4 : SubtargetFeature<"v4", "HexagonArchVersion", "V4",
31 def ArchV5 : SubtargetFeature<"v5", "HexagonArchVersion", "V5",
34 //===----------------------------------------------------------------------===//
35 // Hexagon Instruction Predicate Definitions.
36 //===----------------------------------------------------------------------===//
37 def HasV2T : Predicate<"Subtarget.hasV2TOps()">;
38 def HasV2TOnly : Predicate<"Subtarget.hasV2TOpsOnly()">;
39 def NoV2T : Predicate<"!Subtarget.hasV2TOps()">;
40 def HasV3T : Predicate<"Subtarget.hasV3TOps()">;
41 def HasV3TOnly : Predicate<"Subtarget.hasV3TOpsOnly()">;
42 def NoV3T : Predicate<"!Subtarget.hasV3TOps()">;
43 def HasV4T : Predicate<"Subtarget.hasV4TOps()">;
44 def NoV4T : Predicate<"!Subtarget.hasV4TOps()">;
45 def HasV5T : Predicate<"Subtarget.hasV5TOps()">;
46 def NoV5T : Predicate<"!Subtarget.hasV5TOps()">;
47 def UseMEMOP : Predicate<"Subtarget.useMemOps()">;
48 def IEEERndNearV5T : Predicate<"Subtarget.modeIEEERndNear()">;
50 //===----------------------------------------------------------------------===//
51 // Classes used for relation maps.
52 //===----------------------------------------------------------------------===//
55 // PredRel - Filter class used to relate non-predicated instructions with their
58 // PredNewRel - Filter class used to relate predicated instructions with their
59 // predicate-new forms.
60 class PredNewRel: PredRel;
61 // ImmRegRel - Filter class used to relate instructions having reg-reg form
62 // with their reg-imm counterparts.
64 // NewValueRel - Filter class used to relate regular store instructions with
65 // their new-value store form.
66 class NewValueRel: PredNewRel;
67 // NewValueRel - Filter class used to relate load/store instructions having
68 // different addressing modes with each other.
69 class AddrModeRel: NewValueRel;
71 //===----------------------------------------------------------------------===//
72 // Generate mapping table to relate non-predicate instructions with their
73 // predicated formats - true and false.
76 def 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.
84 // Value columns are PredSense=true and PredSense=false
85 let ValueCols = [["true"], ["false"]];
88 //===----------------------------------------------------------------------===//
89 // Generate mapping table to relate predicate-true instructions with their
90 // predicate-false forms
92 def 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"]];
100 //===----------------------------------------------------------------------===//
101 // Generate mapping table to relate predicate-false instructions with their
102 // predicate-true forms
104 def 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"]];
112 //===----------------------------------------------------------------------===//
113 // Generate mapping table to relate predicated instructions with their .new
116 def getPredNewOpcode : InstrMapping {
117 let FilterClass = "PredNewRel";
118 let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
119 let ColFields = ["PNewValue"];
121 let ValueCols = [["new"]];
124 //===----------------------------------------------------------------------===//
125 // Generate mapping table to relate .new predicated instructions with their old
128 def getPredOldOpcode : InstrMapping {
129 let FilterClass = "PredNewRel";
130 let RowFields = ["BaseOpcode", "PredSense", "isNVStore"];
131 let ColFields = ["PNewValue"];
132 let KeyCol = ["new"];
133 let ValueCols = [[""]];
136 //===----------------------------------------------------------------------===//
137 // Generate mapping table to relate store instructions with their new-value
140 def getNewValueOpcode : InstrMapping {
141 let FilterClass = "NewValueRel";
142 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode"];
143 let ColFields = ["NValueST"];
144 let KeyCol = ["false"];
145 let ValueCols = [["true"]];
148 //===----------------------------------------------------------------------===//
149 // Generate mapping table to relate new-value store instructions with their old
152 def getNonNVStore : InstrMapping {
153 let FilterClass = "NewValueRel";
154 let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode"];
155 let ColFields = ["NValueST"];
156 let KeyCol = ["true"];
157 let ValueCols = [["false"]];
160 def 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"]];
169 def 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"]];
177 def getRegForm : InstrMapping {
178 let FilterClass = "ImmRegRel";
179 let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
180 let ColFields = ["InputType"];
181 let KeyCol = ["imm"];
182 let ValueCols = [["reg"]];
185 def 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"]];
193 //===----------------------------------------------------------------------===//
194 // Register File, Calling Conv, Instruction Descriptions
195 //===----------------------------------------------------------------------===//
196 include "HexagonSchedule.td"
197 include "HexagonRegisterInfo.td"
198 include "HexagonCallingConv.td"
199 include "HexagonInstrInfo.td"
200 include "HexagonIntrinsics.td"
201 include "HexagonIntrinsicsDerived.td"
203 def HexagonInstrInfo : InstrInfo;
205 //===----------------------------------------------------------------------===//
206 // Hexagon processors supported.
207 //===----------------------------------------------------------------------===//
209 class Proc<string Name, SchedMachineModel Model,
210 list<SubtargetFeature> Features>
211 : ProcessorModel<Name, Model, Features>;
213 def : Proc<"hexagonv4", HexagonModelV4, [ArchV2, ArchV3, ArchV4]>;
214 def : Proc<"hexagonv5", HexagonModelV4, [ArchV2, ArchV3, ArchV4, ArchV5]>;
216 //===----------------------------------------------------------------------===//
217 // Declare the target which we are implementing
218 //===----------------------------------------------------------------------===//
220 def Hexagon : Target {
221 // Pull in Instruction Info:
222 let InstructionSet = HexagonInstrInfo;