1 //===- MBlazeInstrFormats.td - MB Instruction defs --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
11 // Describe MBlaze instructions format
13 // CPU INSTRUCTION FORMATS
15 // opcode - operation code.
17 // ra - first src. reg.
18 // rb - second src. reg.
19 // imm16 - 16-bit immediate value.
21 //===----------------------------------------------------------------------===//
23 // Generic MBlaze Format
24 class MBlazeInst<dag outs, dag ins, string asmstr, list<dag> pattern,
25 InstrItinClass itin> : Instruction
29 let Namespace = "MBlaze";
33 // Top 6 bits are the 'opcode' field
34 let Inst{0-5} = opcode;
36 dag OutOperandList = outs;
37 dag InOperandList = ins;
39 let AsmString = asmstr;
40 let Pattern = pattern;
44 //===----------------------------------------------------------------------===//
45 // Pseudo instruction class
46 //===----------------------------------------------------------------------===//
47 class MBlazePseudo<dag outs, dag ins, string asmstr, list<dag> pattern>:
48 MBlazeInst<outs, ins, asmstr, pattern, IIPseudo>;
50 //===----------------------------------------------------------------------===//
51 // Type A instruction class in MBlaze : <|opcode|rd|ra|rb|flags|>
52 //===----------------------------------------------------------------------===//
54 class TA<bits<6> op, bits<11> flags, dag outs, dag ins, string asmstr,
55 list<dag> pattern, InstrItinClass itin> :
56 MBlazeInst<outs, ins, asmstr, pattern, itin>
67 let Inst{21-31} = flags;
70 class TAI<bits<6> op, dag outs, dag ins, string asmstr,
71 list<dag> pattern, InstrItinClass itin> :
72 MBlazeInst<outs, ins, asmstr, pattern, itin>
82 let Inst{16-31} = imm16;
85 class TIMM<bits<6> op, dag outs, dag ins, string asmstr,
86 list<dag> pattern, InstrItinClass itin> :
87 MBlazeInst<outs, ins, asmstr, pattern, itin>
95 let Inst{16-31} = imm16;
98 class TADDR<bits<6> op, dag outs, dag ins, string asmstr,
99 list<dag> pattern, InstrItinClass itin> :
100 MBlazeInst<outs, ins, asmstr, pattern, itin>
106 let Inst{6-31} = addr;
109 //===----------------------------------------------------------------------===//
110 // Type B instruction class in MBlaze : <|opcode|rd|ra|immediate|>
111 //===----------------------------------------------------------------------===//
113 class TB<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
114 InstrItinClass itin> :
115 MBlazeInst<outs, ins, asmstr, pattern, itin>
124 let Inst{11-15} = ra;
125 let Inst{16-31} = imm16;
128 //===----------------------------------------------------------------------===//
129 // Float instruction class in MBlaze : <|opcode|rd|ra|flags|>
130 //===----------------------------------------------------------------------===//
132 class TF<bits<6> op, bits<11> flags, dag outs, dag ins, string asmstr,
133 list<dag> pattern, InstrItinClass itin> :
134 MBlazeInst<outs, ins, asmstr, pattern, itin>
142 let Inst{11-15} = ra;
144 let Inst{21-31} = flags;
147 //===----------------------------------------------------------------------===//
148 // Branch instruction class in MBlaze : <|opcode|rd|br|ra|flags|>
149 //===----------------------------------------------------------------------===//
151 class TBR<bits<6> op, bits<5> br, bits<11> flags, dag outs, dag ins,
152 string asmstr, list<dag> pattern, InstrItinClass itin> :
153 MBlazeInst<outs, ins, asmstr, pattern, itin>
160 let Inst{11-15} = br;
161 let Inst{16-20} = ra;
162 let Inst{21-31} = flags;
165 class TBRC<bits<6> op, bits<5> br, bits<11> flags, dag outs, dag ins,
166 string asmstr, list<dag> pattern, InstrItinClass itin> :
167 MBlazeInst<outs, ins, asmstr, pattern, itin>
175 let Inst{11-15} = ra;
176 let Inst{16-20} = rb;
177 let Inst{21-31} = flags;
180 class TBRL<bits<6> op, bits<5> br, bits<11> flags, dag outs, dag ins,
181 string asmstr, list<dag> pattern, InstrItinClass itin> :
182 MBlazeInst<outs, ins, asmstr, pattern, itin>
188 let Inst{6-10} = 0xF;
189 let Inst{11-15} = br;
190 let Inst{16-20} = ra;
191 let Inst{21-31} = flags;
194 class TBRI<bits<6> op, bits<5> br, dag outs, dag ins,
195 string asmstr, list<dag> pattern, InstrItinClass itin> :
196 MBlazeInst<outs, ins, asmstr, pattern, itin>
203 let Inst{11-15} = br;
204 let Inst{16-31} = imm16;
207 class TBRLI<bits<6> op, bits<5> br, dag outs, dag ins,
208 string asmstr, list<dag> pattern, InstrItinClass itin> :
209 MBlazeInst<outs, ins, asmstr, pattern, itin>
215 let Inst{6-10} = 0xF;
216 let Inst{11-15} = br;
217 let Inst{16-31} = imm16;
220 class TBRCI<bits<6> op, bits<5> br, dag outs, dag ins,
221 string asmstr, list<dag> pattern, InstrItinClass itin> :
222 MBlazeInst<outs, ins, asmstr, pattern, itin>
230 let Inst{11-15} = ra;
231 let Inst{16-31} = imm16;
234 class TRET<bits<6> op, dag outs, dag ins,
235 string asmstr, list<dag> pattern, InstrItinClass itin> :
236 MBlazeInst<outs, ins, asmstr, pattern, itin>
243 let Inst{6-10} = 0x10;
244 let Inst{11-15} = ra;
245 let Inst{16-31} = imm16;