|
10 | 10 | // Declarations that describe the VE register file
|
11 | 11 | //===----------------------------------------------------------------------===//
|
12 | 12 |
|
13 |
| -class VEReg<bits<7> Enc, string n> : Register<n> { |
| 13 | +class VEReg<bits<7> enc, string n, list<Register> subregs = [], |
| 14 | + list<string> altNames = [], list<Register> aliases = []> |
| 15 | + : Register<n, altNames> { |
14 | 16 | let HWEncoding{15-7} = 0;
|
15 |
| - let HWEncoding{6-0} = Enc; |
| 17 | + let HWEncoding{6-0} = enc; |
16 | 18 | let Namespace = "VE";
|
| 19 | + let SubRegs = subregs; |
| 20 | + let Aliases = aliases; |
17 | 21 | }
|
18 | 22 |
|
19 | 23 | let Namespace = "VE" in {
|
20 | 24 | def sub_i8 : SubRegIndex<8, 56>; // Low 8 bit (56..63)
|
21 | 25 | def sub_i16 : SubRegIndex<16, 48>; // Low 16 bit (48..63)
|
22 | 26 | def sub_i32 : SubRegIndex<32, 32>; // Low 32 bit (32..63)
|
23 | 27 | def sub_f32 : SubRegIndex<32>; // High 32 bit (0..31)
|
| 28 | + def AsmName : RegAltNameIndex; |
24 | 29 | }
|
25 | 30 |
|
26 |
| -// Registers are identified with 7-bit ID numbers. |
27 |
| -// R - 64-bit integer or floating-point registers |
28 |
| -class R<bits<7> Enc, string n, list<Register> subregs = [], |
29 |
| - list<Register> aliases = []>: VEReg<Enc, n> { |
30 |
| - let SubRegs = subregs; |
31 |
| - let Aliases = aliases; |
32 |
| -} |
| 31 | +//----------------------------------------------------------------------------- |
| 32 | +// Gneric Registers |
| 33 | +//----------------------------------------------------------------------------- |
| 34 | + |
| 35 | +let RegAltNameIndices = [AsmName] in { |
33 | 36 |
|
34 | 37 | // Generic integer registers - 8 bits wide
|
35 | 38 | foreach I = 0-63 in
|
36 |
| - def SB#I : R<I, "S"#I>, DwarfRegNum<[I]>; |
| 39 | + def SB#I : VEReg<I, "sb"#I, [], ["s"#I]>, DwarfRegNum<[I]>; |
37 | 40 |
|
38 | 41 | // Generic integer registers - 16 bits wide
|
39 | 42 | let SubRegIndices = [sub_i8] in
|
40 | 43 | foreach I = 0-63 in
|
41 |
| - def SH#I : R<I, "S"#I, [!cast<R>("SB"#I)]>, DwarfRegNum<[I]>; |
| 44 | + def SH#I : VEReg<I, "sh"#I, [!cast<VEReg>("SB"#I)], ["s"#I]>, |
| 45 | + DwarfRegNum<[I]>; |
42 | 46 |
|
43 | 47 | // Generic integer registers - 32 bits wide
|
44 | 48 | let SubRegIndices = [sub_i16] in
|
45 | 49 | foreach I = 0-63 in
|
46 |
| - def SW#I : R<I, "S"#I, [!cast<R>("SH"#I)]>, DwarfRegNum<[I]>; |
| 50 | + def SW#I : VEReg<I, "sw"#I, [!cast<VEReg>("SH"#I)], ["s"#I]>, |
| 51 | + DwarfRegNum<[I]>; |
47 | 52 |
|
48 | 53 | // Generic floating point registers - 32 bits wide
|
49 | 54 | // NOTE: Mark SF#I as alias of SW#I temporary to avoid register allocation
|
50 | 55 | // problem.
|
51 | 56 | foreach I = 0-63 in
|
52 |
| - def SF#I : R<I, "S"#I, [], [!cast<R>("SW"#I)]>, DwarfRegNum<[I]>; |
| 57 | + def SF#I : VEReg<I, "sf"#I, [], ["s"#I], [!cast<VEReg>("SW"#I)]>, |
| 58 | + DwarfRegNum<[I]>; |
53 | 59 |
|
54 | 60 | // Generic integer registers - 64 bits wide
|
55 | 61 | let SubRegIndices = [sub_i32, sub_f32], CoveredBySubRegs = 1 in
|
56 | 62 | foreach I = 0-63 in
|
57 |
| - def SX#I : R<I, "S"#I, [!cast<R>("SW"#I), !cast<R>("SF"#I)]>, |
58 |
| - DwarfRegNum<[I]>; |
| 63 | + def SX#I : VEReg<I, "s"#I, [!cast<VEReg>("SW"#I), !cast<VEReg>("SF"#I)], |
| 64 | + ["s"#I]>, DwarfRegNum<[I]>; |
| 65 | + |
| 66 | +} // RegAltNameIndices = [AsmName] |
59 | 67 |
|
60 | 68 | // Register classes.
|
61 | 69 | //
|
|
0 commit comments