blob: af1c56b8b1420939b1f5253e4119102f948dd317 [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//===----------------------------------------------------------------------===//
53// PredRel - Filter class used to relate non-predicated instructions with their
54// predicated forms.
55class PredRel;
56// PredNewRel - Filter class used to relate predicated instructions with their
57// predicate-new forms.
58class PredNewRel: PredRel;
59// ImmRegRel - Filter class used to relate instructions having reg-reg form
60// with their reg-imm counterparts.
61class ImmRegRel;
62// NewValueRel - Filter class used to relate regular store instructions with
63// their new-value store form.
64class NewValueRel: PredNewRel;
65// NewValueRel - Filter class used to relate load/store instructions having
66// different addressing modes with each other.
67class AddrModeRel: NewValueRel;
68
69//===----------------------------------------------------------------------===//
70// Generate mapping table to relate non-predicate instructions with their
71// predicated formats - true and false.
72//
73
74def 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 predicated instructions with their .new
88// format.
89//
90def getPredNewOpcode : InstrMapping {
91 let FilterClass = "PredNewRel";
Jyotsna Verma5ed51812013-05-01 21:37:34 +000092 let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
Jyotsna Vermaefe4f552012-12-04 04:29:16 +000093 let ColFields = ["PNewValue"];
94 let KeyCol = [""];
95 let ValueCols = [["new"]];
96}
97
98//===----------------------------------------------------------------------===//
99// Generate mapping table to relate store instructions with their new-value
100// format.
101//
102def getNewValueOpcode : InstrMapping {
103 let FilterClass = "NewValueRel";
104 let RowFields = ["BaseOpcode", "PredSense", "PNewValue"];
105 let ColFields = ["isNVStore"];
106 let KeyCol = ["0"];
107 let ValueCols = [["1"]];
108}
109
110def getBasedWithImmOffset : InstrMapping {
111 let FilterClass = "AddrModeRel";
112 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
113 "isMEMri", "isFloat"];
114 let ColFields = ["addrMode"];
115 let KeyCol = ["Absolute"];
116 let ValueCols = [["BaseImmOffset"]];
117}
118
119def getBaseWithRegOffset : InstrMapping {
120 let FilterClass = "AddrModeRel";
121 let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
122 let ColFields = ["addrMode"];
123 let KeyCol = ["BaseImmOffset"];
124 let ValueCols = [["BaseRegOffset"]];
125}
126
127def getRegForm : InstrMapping {
128 let FilterClass = "ImmRegRel";
129 let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
130 let ColFields = ["InputType"];
131 let KeyCol = ["imm"];
132 let ValueCols = [["reg"]];
133}
134
135//===----------------------------------------------------------------------===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000136// Register File, Calling Conv, Instruction Descriptions
137//===----------------------------------------------------------------------===//
138include "HexagonSchedule.td"
139include "HexagonRegisterInfo.td"
140include "HexagonCallingConv.td"
141include "HexagonInstrInfo.td"
142include "HexagonIntrinsics.td"
143include "HexagonIntrinsicsDerived.td"
144
Evandro Menezes5cee6212012-04-12 17:55:53 +0000145def HexagonInstrInfo : InstrInfo;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000146
147//===----------------------------------------------------------------------===//
148// Hexagon processors supported.
149//===----------------------------------------------------------------------===//
150
Andrew Trick87255e32012-07-07 04:00:00 +0000151class Proc<string Name, SchedMachineModel Model,
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000152 list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000153 : ProcessorModel<Name, Model, Features>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000154
Andrew Trick87255e32012-07-07 04:00:00 +0000155def : Proc<"hexagonv2", HexagonModel, [ArchV2]>;
156def : Proc<"hexagonv3", HexagonModel, [ArchV2, ArchV3]>;
157def : Proc<"hexagonv4", HexagonModelV4, [ArchV2, ArchV3, ArchV4]>;
158def : Proc<"hexagonv5", HexagonModelV4, [ArchV2, ArchV3, ArchV4, ArchV5]>;
Sirish Pande69295b82012-05-10 20:20:25 +0000159
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000160
Evandro Menezes5cee6212012-04-12 17:55:53 +0000161// Hexagon Uses the MC printer for assembler output, so make sure the TableGen
162// AsmWriter bits get associated with the correct class.
163def HexagonAsmWriter : AsmWriter {
164 string AsmWriterClassName = "InstPrinter";
165 bit isMCAsmWriter = 1;
166}
167
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000168//===----------------------------------------------------------------------===//
169// Declare the target which we are implementing
170//===----------------------------------------------------------------------===//
171
172def Hexagon : Target {
173 // Pull in Instruction Info:
174 let InstructionSet = HexagonInstrInfo;
Evandro Menezes5cee6212012-04-12 17:55:53 +0000175
176 let AssemblyWriters = [HexagonAsmWriter];
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000177}