• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- BlackfinRegisterInfo.td - Blackfin Register defs ----*- 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//===----------------------------------------------------------------------===//
11//  Declarations that describe the Blackfin register file
12//===----------------------------------------------------------------------===//
13
14// Subregs are:
15// 1: .L
16// 2: .H
17// 3: .W (32 low bits of 40-bit accu)
18let Namespace = "BF" in {
19def lo16 : SubRegIndex;
20def hi16 : SubRegIndex;
21def lo32 : SubRegIndex;
22def hi32 : SubRegIndex;
23}
24
25// Registers are identified with 3-bit group and 3-bit ID numbers.
26class BlackfinReg<string n> : Register<n> {
27  field bits<3> Group;
28  field bits<3> Num;
29  let Namespace = "BF";
30}
31
32// Rc - 1-bit registers
33class Rc<bits<5> bitno, string n> : BlackfinReg<n> {
34  field bits<5> BitNum = bitno;
35}
36
37// Rs - 16-bit integer registers
38class Rs<bits<3> group, bits<3> num, bits<1> hi, string n> : BlackfinReg<n> {
39  let Group = group;
40  let Num = num;
41  field bits<1> High = hi;
42}
43
44// Ri - 32-bit integer registers with subregs
45class Ri<bits<3> group, bits<3> num, string n> : BlackfinReg<n> {
46  let Group = group;
47  let Num = num;
48}
49
50// Ra 40-bit accumulator registers
51class Ra<bits<3> num, string n, list<Register> subs> : BlackfinReg<n> {
52  let SubRegs = subs;
53  let SubRegIndices = [hi32, lo32];
54  let Group = 4;
55  let Num = num;
56}
57
58// Two halves of 32-bit register
59multiclass Rss<bits<3> group, bits<3> num, string n> {
60  def H : Rs<group, num, 1, !strconcat(n, ".h")>;
61  def L : Rs<group, num, 0, !strconcat(n, ".l")>;
62}
63
64// Rii - 32-bit integer registers with subregs
65class Rii<bits<3> group, bits<3> num, string n, list<Register> subs>
66      : BlackfinReg<n> {
67  let SubRegs = subs;
68  let SubRegIndices = [hi16, lo16];
69  let Group = group;
70  let Num = num;
71}
72
73// Status bits are all part of ASTAT
74def AZ   : Rc<0,  "az">;
75def AN   : Rc<1,  "an">;
76def CC   : Rc<5,  "cc">, DwarfRegNum<[34]>;
77def NCC  : Rc<5,  "!cc"> { let Aliases = [CC]; }
78def AQ   : Rc<6,  "aq">;
79def AC0  : Rc<12, "ac0">;
80def AC1  : Rc<13, "ac1">;
81def AV0  : Rc<16, "av0">;
82def AV0S : Rc<17, "av0s">;
83def AV1  : Rc<18, "av1">;
84def AV1S : Rc<19, "av1s">;
85def V    : Rc<24, "v">;
86def VS   : Rc<25, "vs">;
87// Skipped non-status bits: AC0_COPY, V_COPY, RND_MOD
88
89// Group 0: Integer registers
90defm R0 : Rss<0, 0, "r0">;
91def  R0 : Rii<0, 0, "r0", [R0H, R0L]>, DwarfRegNum<[0]>;
92defm R1 : Rss<0, 1, "r1">;
93def  R1 : Rii<0, 1, "r1", [R1H, R1L]>, DwarfRegNum<[1]>;
94defm R2 : Rss<0, 2, "r2">;
95def  R2 : Rii<0, 2, "r2", [R2H, R2L]>, DwarfRegNum<[2]>;
96defm R3 : Rss<0, 3, "r3">;
97def  R3 : Rii<0, 3, "r3", [R3H, R3L]>, DwarfRegNum<[3]>;
98defm R4 : Rss<0, 4, "r4">;
99def  R4 : Rii<0, 4, "r4", [R4H, R4L]>, DwarfRegNum<[4]>;
100defm R5 : Rss<0, 5, "r5">;
101def  R5 : Rii<0, 5, "r5", [R5H, R5L]>, DwarfRegNum<[5]>;
102defm R6 : Rss<0, 6, "r6">;
103def  R6 : Rii<0, 6, "r6", [R6H, R6L]>, DwarfRegNum<[6]>;
104defm R7 : Rss<0, 7, "r7">;
105def  R7 : Rii<0, 7, "r7", [R7H, R7L]>, DwarfRegNum<[7]>;
106
107// Group 1: Pointer registers
108defm P0 : Rss<1, 0, "p0">;
109def  P0 : Rii<1, 0, "p0", [P0H, P0L]>, DwarfRegNum<[8]>;
110defm P1 : Rss<1, 1, "p1">;
111def  P1 : Rii<1, 1, "p1", [P1H, P1L]>, DwarfRegNum<[9]>;
112defm P2 : Rss<1, 2, "p2">;
113def  P2 : Rii<1, 2, "p2", [P2H, P2L]>, DwarfRegNum<[10]>;
114defm P3 : Rss<1, 3, "p3">;
115def  P3 : Rii<1, 3, "p3", [P3H, P3L]>, DwarfRegNum<[11]>;
116defm P4 : Rss<1, 4, "p4">;
117def  P4 : Rii<1, 4, "p4", [P4H, P4L]>, DwarfRegNum<[12]>;
118defm P5 : Rss<1, 5, "p5">;
119def  P5 : Rii<1, 5, "p5", [P5H, P5L]>, DwarfRegNum<[13]>;
120defm SP : Rss<1, 6, "sp">;
121def  SP : Rii<1, 6, "sp", [SPH, SPL]>, DwarfRegNum<[14]>;
122defm FP : Rss<1, 7, "fp">;
123def  FP : Rii<1, 7, "fp", [FPH, FPL]>, DwarfRegNum<[15]>;
124
125// Group 2: Index registers
126defm I0 : Rss<2, 0, "i0">;
127def  I0 : Rii<2, 0, "i0", [I0H, I0L]>, DwarfRegNum<[16]>;
128defm I1 : Rss<2, 1, "i1">;
129def  I1 : Rii<2, 1, "i1", [I1H, I1L]>, DwarfRegNum<[17]>;
130defm I2 : Rss<2, 2, "i2">;
131def  I2 : Rii<2, 2, "i2", [I2H, I2L]>, DwarfRegNum<[18]>;
132defm I3 : Rss<2, 3, "i3">;
133def  I3 : Rii<2, 3, "i3", [I3H, I3L]>, DwarfRegNum<[19]>;
134defm M0 : Rss<2, 4, "m0">;
135def  M0 : Rii<2, 4, "m0", [M0H, M0L]>, DwarfRegNum<[20]>;
136defm M1 : Rss<2, 5, "m1">;
137def  M1 : Rii<2, 5, "m1", [M1H, M1L]>, DwarfRegNum<[21]>;
138defm M2 : Rss<2, 6, "m2">;
139def  M2 : Rii<2, 6, "m2", [M2H, M2L]>, DwarfRegNum<[22]>;
140defm M3 : Rss<2, 7, "m3">;
141def  M3 : Rii<2, 7, "m3", [M3H, M3L]>, DwarfRegNum<[23]>;
142
143// Group 3: Cyclic indexing registers
144defm B0 : Rss<3, 0, "b0">;
145def  B0 : Rii<3, 0, "b0", [B0H, B0L]>, DwarfRegNum<[24]>;
146defm B1 : Rss<3, 1, "b1">;
147def  B1 : Rii<3, 1, "b1", [B1H, B1L]>, DwarfRegNum<[25]>;
148defm B2 : Rss<3, 2, "b2">;
149def  B2 : Rii<3, 2, "b2", [B2H, B2L]>, DwarfRegNum<[26]>;
150defm B3 : Rss<3, 3, "b3">;
151def  B3 : Rii<3, 3, "b3", [B3H, B3L]>, DwarfRegNum<[27]>;
152defm L0 : Rss<3, 4, "l0">;
153def  L0 : Rii<3, 4, "l0", [L0H, L0L]>, DwarfRegNum<[28]>;
154defm L1 : Rss<3, 5, "l1">;
155def  L1 : Rii<3, 5, "l1", [L1H, L1L]>, DwarfRegNum<[29]>;
156defm L2 : Rss<3, 6, "l2">;
157def  L2 : Rii<3, 6, "l2", [L2H, L2L]>, DwarfRegNum<[30]>;
158defm L3 : Rss<3, 7, "l3">;
159def  L3 : Rii<3, 7, "l3", [L3H, L3L]>, DwarfRegNum<[31]>;
160
161// Accumulators
162def  A0X : Ri <4, 0, "a0.x">;
163defm A0  : Rss<4, 1, "a0">;
164def  A0W : Rii<4, 1, "a0.w", [A0H, A0L]>, DwarfRegNum<[32]>;
165def  A0  : Ra <0, "a0", [A0X, A0W]>;
166
167def  A1X : Ri <4, 2, "a1.x">;
168defm A1  : Rss<4, 3, "a1">;
169def  A1W : Rii<4, 3, "a1.w", [A1H, A1L]>, DwarfRegNum<[33]>;
170def  A1  : Ra <2, "a1", [A1X, A1W]>;
171
172def RETS : Ri<4, 7, "rets">,  DwarfRegNum<[35]>;
173def RETI : Ri<7, 3, "reti">,  DwarfRegNum<[36]>;
174def RETX : Ri<7, 4, "retx">,  DwarfRegNum<[37]>;
175def RETN : Ri<7, 5, "retn">,  DwarfRegNum<[38]>;
176def RETE : Ri<7, 6, "rete">,  DwarfRegNum<[39]>;
177
178def ASTAT   : Ri<4, 6, "astat">,   DwarfRegNum<[40]> {
179  let Aliases = [AZ, AN, CC, NCC, AQ, AC0, AC1, AV0, AV0S, AV1, AV1S, V, VS];
180}
181
182def SEQSTAT : Ri<7, 1, "seqstat">, DwarfRegNum<[41]>;
183def USP     : Ri<7, 0, "usp">,     DwarfRegNum<[42]>;
184def EMUDAT  : Ri<7, 7, "emudat">,  DwarfRegNum<[43]>;
185def SYSCFG  : Ri<7, 2, "syscfg">;
186def CYCLES  : Ri<6, 6, "cycles">;
187def CYCLES2 : Ri<6, 7, "cycles2">;
188
189// Hardware loops
190def LT0 : Ri<6, 1, "lt0">, DwarfRegNum<[44]>;
191def LT1 : Ri<6, 4, "lt1">, DwarfRegNum<[45]>;
192def LC0 : Ri<6, 0, "lc0">, DwarfRegNum<[46]>;
193def LC1 : Ri<6, 3, "lc1">, DwarfRegNum<[47]>;
194def LB0 : Ri<6, 2, "lb0">, DwarfRegNum<[48]>;
195def LB1 : Ri<6, 5, "lb1">, DwarfRegNum<[49]>;
196
197// Register classes.
198def D16L : RegisterClass<"BF", [i16], 16, (sequence "R%uL", 0, 7)>;
199
200def D16H : RegisterClass<"BF", [i16], 16, (sequence "R%uH", 0, 7)>;
201
202def D16 : RegisterClass<"BF", [i16], 16, (add D16L, D16H)>;
203
204def P16L : RegisterClass<"BF", [i16], 16,
205                         (add (sequence "P%uL", 0, 5), SPL, FPL)>;
206
207def P16H : RegisterClass<"BF", [i16], 16,
208                         (add (sequence "P%uH", 0, 5), SPH, FPH)>;
209
210def P16 : RegisterClass<"BF", [i16], 16, (add P16L, P16H)>;
211
212def DP16 : RegisterClass<"BF", [i16], 16, (add D16, P16)>;
213
214def DP16L : RegisterClass<"BF", [i16], 16, (add D16L, P16L)>;
215
216def DP16H : RegisterClass<"BF", [i16], 16, (add D16H, P16H)>;
217
218def GR16 : RegisterClass<"BF", [i16], 16,
219    (add DP16,
220     I0H, I0L, I1H, I1L, I2H, I2L, I3H, I3L,
221     M0H, M0L, M1H, M1L, M2H, M2L, M3H, M3L,
222     B0H, B0L, B1H, B1L, B2H, B2L, B3H, B3L,
223     L0H, L0L, L1H, L1L, L2H, L2L, L3H, L3L)>;
224
225def D : RegisterClass<"BF", [i32], 32, (sequence "R%u", 0, 7)> {
226  let SubRegClasses = [(D16L lo16), (D16H hi16)];
227}
228
229def P : RegisterClass<"BF", [i32], 32, (add (sequence "P%u", 0, 5), FP, SP)> {
230  let SubRegClasses = [(P16L lo16), (P16H hi16)];
231}
232
233def DP : RegisterClass<"BF", [i32], 32, (add D, P)> {
234  let SubRegClasses = [(DP16L lo16), (DP16H hi16)];
235}
236
237def I : RegisterClass<"BF", [i32], 32, (add I0, I1, I2, I3)>;
238def M : RegisterClass<"BF", [i32], 32, (add M0, M1, M2, M3)>;
239def B : RegisterClass<"BF", [i32], 32, (add B0, B1, B2, B3)>;
240def L : RegisterClass<"BF", [i32], 32, (add L0, L1, L2, L3)>;
241
242def GR : RegisterClass<"BF", [i32], 32, (add DP, I, M, B, L)>;
243
244def ALL : RegisterClass<"BF", [i32], 32,
245    (add GR,
246     A0X, A0W, A1X, A1W, ASTAT, RETS,
247     LC0, LT0, LB0, LC1, LT1, LB1, CYCLES, CYCLES2,
248     USP, SEQSTAT, SYSCFG, RETI, RETX, RETN, RETE, EMUDAT)>;
249
250def PI : RegisterClass<"BF", [i32], 32, (add P, I)>;
251
252// We are going to pretend that CC and !CC are 32-bit registers, even though
253// they only can hold 1 bit.
254let CopyCost = -1, Size = 8 in {
255def JustCC  : RegisterClass<"BF", [i32], 8, (add CC)>;
256def NotCC   : RegisterClass<"BF", [i32], 8, (add NCC)>;
257def AnyCC   : RegisterClass<"BF", [i32], 8, (add CC, NCC)>;
258def StatBit : RegisterClass<"BF", [i1], 8,
259    (add AZ, AN, CC, AQ, AC0, AC1, AV0, AV0S, AV1, AV1S, V, VS)>;
260}
261
262// Should be i40, but that isn't defined. It is not a legal type yet anyway.
263def Accu : RegisterClass<"BF", [i64], 64, (add A0, A1)>;
264
265// Register classes to match inline asm constraints.
266def zCons : RegisterClass<"BF", [i32], 32, (add P0, P1, P2)>;
267def DCons : RegisterClass<"BF", [i32], 32, (add R0, R2, R4, R6)>;
268def WCons : RegisterClass<"BF", [i32], 32, (add R1, R3, R5, R7)>;
269def cCons : RegisterClass<"BF", [i32], 32, (add I0, I1, I2, I3,
270    	    			       	   	B0, B1, B2, B3,
271						L0, L1, L2, L3)>;
272def tCons : RegisterClass<"BF", [i32], 32, (add LT0, LT1)>;
273def uCons : RegisterClass<"BF", [i32], 32, (add LB0, LB1)>;
274def kCons : RegisterClass<"BF", [i32], 32, (add LC0, LC1)>;
275def yCons : RegisterClass<"BF", [i32], 32, (add RETS, RETN, RETI, RETX,
276    	    			       	   	RETE, ASTAT, SEQSTAT,
277						USP)>;
278