]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/lib/Target/Hexagon/Hexagon.td
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / lib / Target / Hexagon / Hexagon.td
1 //===-- Hexagon.td - Describe the Hexagon Target Machine --*- tablegen -*--===//
2 //
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 //
10 // This is the top level entry point for the Hexagon target.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // Target-independent interfaces which we are implementing
16 //===----------------------------------------------------------------------===//
17
18 include "llvm/Target/Target.td"
19
20 //===----------------------------------------------------------------------===//
21 // Hexagon Subtarget features.
22 //===----------------------------------------------------------------------===//
23
24 // Hexagon Archtectures
25 def ArchV2       : SubtargetFeature<"v2", "HexagonArchVersion", "V2",
26                                     "Hexagon v2">;
27 def ArchV3       : SubtargetFeature<"v3", "HexagonArchVersion", "V3",
28                                     "Hexagon v3">;
29 def ArchV4       : SubtargetFeature<"v4", "HexagonArchVersion", "V4",
30                                     "Hexagon v4">;
31 def ArchV5       : SubtargetFeature<"v5", "HexagonArchVersion", "V5",
32                                     "Hexagon v5">;
33
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()">;
49
50 //===----------------------------------------------------------------------===//
51 // Classes used for relation maps.
52 //===----------------------------------------------------------------------===//
53 // PredRel - Filter class used to relate non-predicated instructions with their
54 // predicated forms.
55 class PredRel;
56 // PredNewRel - Filter class used to relate predicated instructions with their
57 // predicate-new forms.
58 class PredNewRel: PredRel;
59 // ImmRegRel - Filter class used to relate instructions having reg-reg form
60 // with their reg-imm counterparts.
61 class ImmRegRel;
62 // NewValueRel - Filter class used to relate regular store instructions with
63 // their new-value store form.
64 class NewValueRel: PredNewRel;
65 // NewValueRel - Filter class used to relate load/store instructions having
66 // different addressing modes with each other.
67 class AddrModeRel: NewValueRel;
68
69 //===----------------------------------------------------------------------===//
70 // Generate mapping table to relate non-predicate instructions with their
71 // predicated formats - true and false.
72 //
73
74 def getPredOpcode : InstrMapping {
75   let FilterClass = "PredRel";
76   // Instructions with the same BaseOpcode and isNVStore values form a row.
77   let RowFields = ["BaseOpcode", "isNVStore", "PNewValue"];
78   // Instructions with the same predicate sense form a column.
79   let ColFields = ["PredSense"];
80   // The key column is the unpredicated instructions.
81   let KeyCol = [""];
82   // Value columns are PredSense=true and PredSense=false
83   let ValueCols = [["true"], ["false"]];
84 }
85
86 //===----------------------------------------------------------------------===//
87 // Generate mapping table to relate predicate-true instructions with their
88 // predicate-false forms
89 //
90 def getFalsePredOpcode : InstrMapping {
91   let FilterClass = "PredRel";
92   let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken"];
93   let ColFields = ["PredSense"];
94   let KeyCol = ["true"];
95   let ValueCols = [["false"]];
96 }
97
98 //===----------------------------------------------------------------------===//
99 // Generate mapping table to relate predicate-false instructions with their
100 // predicate-true forms
101 //
102 def getTruePredOpcode : InstrMapping {
103   let FilterClass = "PredRel";
104   let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken"];
105   let ColFields = ["PredSense"];
106   let KeyCol = ["false"];
107   let ValueCols = [["true"]];
108 }
109
110 //===----------------------------------------------------------------------===//
111 // Generate mapping table to relate predicated instructions with their .new
112 // format.
113 //
114 def getPredNewOpcode : InstrMapping {
115   let FilterClass = "PredNewRel";
116   let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
117   let ColFields = ["PNewValue"];
118   let KeyCol = [""];
119   let ValueCols = [["new"]];
120 }
121
122 //===----------------------------------------------------------------------===//
123 // Generate mapping table to relate store instructions with their new-value
124 // format.
125 //
126 def getNewValueOpcode : InstrMapping {
127   let FilterClass = "NewValueRel";
128   let RowFields = ["BaseOpcode", "PredSense", "PNewValue"];
129   let ColFields = ["isNVStore"];
130   let KeyCol = ["0"];
131   let ValueCols = [["1"]];
132 }
133
134 def getBasedWithImmOffset : InstrMapping {
135   let FilterClass = "AddrModeRel";
136   let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
137                    "isMEMri", "isFloat"];
138   let ColFields = ["addrMode"];
139   let KeyCol = ["Absolute"];
140   let ValueCols = [["BaseImmOffset"]];
141 }
142
143 def getBaseWithRegOffset : InstrMapping {
144   let FilterClass = "AddrModeRel";
145   let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
146   let ColFields = ["addrMode"];
147   let KeyCol = ["BaseImmOffset"];
148   let ValueCols = [["BaseRegOffset"]];
149 }
150
151 def getRegForm : InstrMapping {
152   let FilterClass = "ImmRegRel";
153   let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
154   let ColFields = ["InputType"];
155   let KeyCol = ["imm"];
156   let ValueCols = [["reg"]];
157 }
158
159 //===----------------------------------------------------------------------===//
160 // Register File, Calling Conv, Instruction Descriptions
161 //===----------------------------------------------------------------------===//
162 include "HexagonSchedule.td"
163 include "HexagonRegisterInfo.td"
164 include "HexagonCallingConv.td"
165 include "HexagonInstrInfo.td"
166 include "HexagonIntrinsics.td"
167 include "HexagonIntrinsicsDerived.td"
168
169 def HexagonInstrInfo : InstrInfo;
170
171 //===----------------------------------------------------------------------===//
172 // Hexagon processors supported.
173 //===----------------------------------------------------------------------===//
174
175 class Proc<string Name, SchedMachineModel Model,
176            list<SubtargetFeature> Features>
177  : ProcessorModel<Name, Model, Features>;
178
179 def : Proc<"hexagonv2", HexagonModel,   [ArchV2]>;
180 def : Proc<"hexagonv3", HexagonModel,   [ArchV2, ArchV3]>;
181 def : Proc<"hexagonv4", HexagonModelV4, [ArchV2, ArchV3, ArchV4]>;
182 def : Proc<"hexagonv5", HexagonModelV4, [ArchV2, ArchV3, ArchV4, ArchV5]>;
183
184
185 // Hexagon Uses the MC printer for assembler output, so make sure the TableGen
186 // AsmWriter bits get associated with the correct class.
187 def HexagonAsmWriter : AsmWriter {
188   string AsmWriterClassName  = "InstPrinter";
189   bit isMCAsmWriter = 1;
190 }
191
192 //===----------------------------------------------------------------------===//
193 // Declare the target which we are implementing
194 //===----------------------------------------------------------------------===//
195
196 def Hexagon : Target {
197   // Pull in Instruction Info:
198   let InstructionSet = HexagonInstrInfo;
199
200   let AssemblyWriters = [HexagonAsmWriter];
201 }