Rename a function.
[oota-llvm.git] / lib / Target / XCore / XCoreInstrFormats.td
1 //===-- XCoreInstrFormats.td - XCore Instruction Formats ---*- 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 // Instruction format superclass
12 //===----------------------------------------------------------------------===//
13 class InstXCore<int sz, dag outs, dag ins, string asmstr, list<dag> pattern>
14     : Instruction {
15   field bits<32> Inst;
16
17   let Namespace = "XCore";
18   dag OutOperandList = outs;
19   dag InOperandList = ins;
20   let AsmString   = asmstr;
21   let Pattern = pattern;
22   let Size = sz;
23   field bits<32> SoftFail = 0;
24 }
25
26 // XCore pseudo instructions format
27 class PseudoInstXCore<dag outs, dag ins, string asmstr, list<dag> pattern>
28    : InstXCore<0, outs, ins, asmstr, pattern> {
29   let isPseudo = 1;
30 }
31
32 //===----------------------------------------------------------------------===//
33 // Instruction formats
34 //===----------------------------------------------------------------------===//
35
36 class _F3R<dag outs, dag ins, string asmstr, list<dag> pattern>
37     : InstXCore<2, outs, ins, asmstr, pattern> {
38 }
39
40 class _FL3R<dag outs, dag ins, string asmstr, list<dag> pattern>
41     : InstXCore<4, outs, ins, asmstr, pattern> {
42 }
43
44 class _F2RUS<dag outs, dag ins, string asmstr, list<dag> pattern>
45     : InstXCore<2, outs, ins, asmstr, pattern> {
46 }
47
48 class _FL2RUS<dag outs, dag ins, string asmstr, list<dag> pattern>
49     : InstXCore<4, outs, ins, asmstr, pattern> {
50 }
51
52 class _FRU6<dag outs, dag ins, string asmstr, list<dag> pattern>
53     : InstXCore<2, outs, ins, asmstr, pattern> {
54 }
55
56 class _FLRU6<dag outs, dag ins, string asmstr, list<dag> pattern>
57     : InstXCore<4, outs, ins, asmstr, pattern> {
58 }
59
60 class _FU6<dag outs, dag ins, string asmstr, list<dag> pattern>
61     : InstXCore<2, outs, ins, asmstr, pattern> {
62 }
63
64 class _FLU6<dag outs, dag ins, string asmstr, list<dag> pattern>
65     : InstXCore<4, outs, ins, asmstr, pattern> {
66 }
67
68 class _FU10<dag outs, dag ins, string asmstr, list<dag> pattern>
69     : InstXCore<2, outs, ins, asmstr, pattern> {
70 }
71
72 class _FLU10<dag outs, dag ins, string asmstr, list<dag> pattern>
73     : InstXCore<4, outs, ins, asmstr, pattern> {
74 }
75
76 class _F2R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
77     : InstXCore<2, outs, ins, asmstr, pattern> {
78   let Inst{15-11} = opc{5-1};
79   let Inst{4} = opc{0};
80   let DecoderMethod = "Decode2RInstruction";
81 }
82
83 // 2R with first operand as both a source and a destination.
84 class _F2RSrcDst<bits<6> opc, dag outs, dag ins, string asmstr,
85                  list<dag> pattern> : _F2R<opc, outs, ins, asmstr, pattern> {
86   let DecoderMethod = "Decode2RSrcDstInstruction";
87 }
88
89 // Same as 2R with last two operands swapped
90 class _FR2R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
91     : _F2R<opc, outs, ins, asmstr, pattern> {
92   let DecoderMethod = "DecodeR2RInstruction";
93 }
94
95 class _FRUS<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
96     : InstXCore<2, outs, ins, asmstr, pattern> {
97   let Inst{15-11} = opc{5-1};
98   let Inst{4} = opc{0};
99   let DecoderMethod = "DecodeRUSInstruction";
100 }
101
102 // RUS with bitp operand
103 class _FRUSBitp<bits<6> opc, dag outs, dag ins, string asmstr,
104                 list<dag> pattern>
105     : _FRUS<opc, outs, ins, asmstr, pattern> {
106   let DecoderMethod = "DecodeRUSBitpInstruction";
107 }
108
109 // RUS with first operand as both a source and a destination and a bitp second
110 // operand
111 class _FRUSSrcDstBitp<bits<6> opc, dag outs, dag ins, string asmstr,
112                       list<dag> pattern>
113     : _FRUS<opc, outs, ins, asmstr, pattern> {
114   let DecoderMethod = "DecodeRUSSrcDstBitpInstruction";
115 }
116
117 class _FL2R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
118     : InstXCore<4, outs, ins, asmstr, pattern> {
119   let Inst{31-27} = opc{9-5};
120   let Inst{26-20} = 0b1111110;
121   let Inst{19-16} = opc{4-1};
122
123   let Inst{15-11} = 0b11111;
124   let Inst{4} = opc{0};
125   let DecoderMethod = "DecodeL2RInstruction";
126 }
127
128 // Same as L2R with last two operands swapped
129 class _FLR2R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
130     : _FL2R<opc, outs, ins, asmstr, pattern> {
131   let DecoderMethod = "DecodeLR2RInstruction";
132 }
133
134 class _F1R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
135     : InstXCore<2, outs, ins, asmstr, pattern> {
136   bits<4> a;
137
138   let Inst{15-11} = opc{5-1};
139   let Inst{10-5} = 0b111111;
140   let Inst{4} = opc{0};
141   let Inst{3-0} = a;
142 }
143
144 class _F0R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
145     : InstXCore<2, outs, ins, asmstr, pattern> {
146   let Inst{15-11} = opc{9-5};
147   let Inst{10-5} = 0b111111;
148   let Inst{4-0} = opc{4-0};
149 }
150
151 class _L4R<dag outs, dag ins, string asmstr, list<dag> pattern>
152     : InstXCore<4, outs, ins, asmstr, pattern> {
153 }
154
155 class _L5R<dag outs, dag ins, string asmstr, list<dag> pattern>
156     : InstXCore<4, outs, ins, asmstr, pattern> {
157 }
158
159 class _L6R<dag outs, dag ins, string asmstr, list<dag> pattern>
160     : InstXCore<4, outs, ins, asmstr, pattern> {
161 }