There is no EndPtr anymore - reinterpret the original comment in terms
[oota-llvm.git] / lib / Target / MBlaze / MBlazeInstrFormats.td
1 //===- MBlazeInstrFormats.td - MB Instruction 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 // Format specifies the encoding used by the instruction.  This is part of the
11 // ad-hoc solution used to emit machine instruction encodings by our machine
12 // code emitter.
13 class Format<bits<6> val> {
14       bits<6> Value = val;
15 }
16
17 def FPseudo : Format<0>;
18 def FRRR    : Format<1>;  // ADD, RSUB, OR, etc.
19 def FRRI    : Format<2>;  // ADDI, RSUBI, ORI, etc.
20 def FCRR    : Format<3>;  // PUTD, WDC, WIC, BEQ, BNE, BGE, etc.
21 def FCRI    : Format<4>;  // RTID, RTED, RTSD, BEQI, BNEI, BGEI, etc.
22 def FRCR    : Format<5>;  // BRLD, BRALD, GETD
23 def FRCI    : Format<6>;  // BRLID, BRALID, MSRCLR, MSRSET
24 def FCCR    : Format<7>;  // BR, BRA, BRD, etc.
25 def FCCI    : Format<8>;  // IMM, BRI, BRAI, BRID, etc.
26 def FRRCI   : Format<9>;  // BSRLI, BSRAI, BSLLI
27 def FRRC    : Format<10>; // SEXT8, SEXT16, SRA, SRC, SRL, FLT, FINT, FSQRT
28 def FRCX    : Format<11>; // GET
29 def FRCS    : Format<12>; // MFS
30 def FCRCS   : Format<13>; // MTS
31 def FCRCX   : Format<14>; // PUT
32 def FCX     : Format<15>; // TPUT
33 def FCR     : Format<16>; // TPUTD
34 def FRIR    : Format<17>; // RSUBI
35 def FC      : Format<18>; // NOP
36
37 //===----------------------------------------------------------------------===//
38 //  Describe MBlaze instructions format
39 //
40 //  CPU INSTRUCTION FORMATS
41 //
42 //  opcode  - operation code.
43 //  rd      - dst reg.
44 //  ra      - first src. reg.
45 //  rb      - second src. reg.
46 //  imm16   - 16-bit immediate value.
47 //
48 //===----------------------------------------------------------------------===//
49
50 // Generic MBlaze Format
51 class MBlazeInst<bits<6> op, Format form, dag outs, dag ins, string asmstr, 
52                  list<dag> pattern, InstrItinClass itin> : Instruction {
53   let Namespace = "MBlaze";
54   field bits<32> Inst;
55
56   bits<6> opcode = op;
57   Format Form = form;
58   bits<6> FormBits = Form.Value;
59
60   // Top 6 bits are the 'opcode' field
61   let Inst{0-5} = opcode;
62
63   // If the instruction is marked as a pseudo, set isCodeGenOnly so that the
64   // assembler and disassmbler ignore it.
65   let isCodeGenOnly = !eq(!cast<string>(form), "FPseudo");
66   
67   dag OutOperandList = outs;
68   dag InOperandList  = ins;
69
70   let AsmString   = asmstr;
71   let Pattern     = pattern;
72   let Itinerary   = itin;
73
74   // TSFlags layout should be kept in sync with MBlazeInstrInfo.h.
75   let TSFlags{5-0}   = FormBits;
76 }
77
78 //===----------------------------------------------------------------------===//
79 // Pseudo instruction class
80 //===----------------------------------------------------------------------===//
81 class MBlazePseudo<dag outs, dag ins, string asmstr, list<dag> pattern>:
82       MBlazeInst<0x0, FPseudo, outs, ins, asmstr, pattern, IIPseudo>;
83
84 //===----------------------------------------------------------------------===//
85 // Type A instruction class in MBlaze : <|opcode|rd|ra|rb|flags|>
86 //===----------------------------------------------------------------------===//
87
88 class TA<bits<6> op, bits<11> flags, dag outs, dag ins, string asmstr,
89          list<dag> pattern, InstrItinClass itin> :
90          MBlazeInst<op,FRRR,outs, ins, asmstr, pattern, itin>
91 {
92   bits<5> rd;
93   bits<5> ra;
94   bits<5> rb;
95
96   let Inst{6-10}  = rd;
97   let Inst{11-15} = ra;
98   let Inst{16-20} = rb;
99   let Inst{21-31} = flags;
100 }
101
102 //===----------------------------------------------------------------------===//
103 // Type B instruction class in MBlaze : <|opcode|rd|ra|immediate|>
104 //===----------------------------------------------------------------------===//
105
106 class TB<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
107          InstrItinClass itin> :
108          MBlazeInst<op, FRRI, outs, ins, asmstr, pattern, itin>
109 {
110   bits<5>  rd;
111   bits<5>  ra;
112   bits<16> imm16;
113
114   let Inst{6-10}  = rd;
115   let Inst{11-15} = ra;
116   let Inst{16-31} = imm16;
117 }
118
119 //===----------------------------------------------------------------------===//
120 // Type B instruction class in MBlaze but with the operands reversed in
121 // the LLVM DAG : <|opcode|rd|ra|immediate|>
122 //===----------------------------------------------------------------------===//
123 class TBR<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
124          InstrItinClass itin> :
125          TB<op, outs, ins, asmstr, pattern, itin> {
126   bits<5>  rrd;
127   bits<16> rimm16;
128   bits<5>  rra;
129
130   let Form = FRIR;
131
132   let rd = rrd;
133   let ra = rra;
134   let imm16 = rimm16;
135 }