1 //===- MBlazeInstrFormats.td - MB Instruction defs ---------*- tablegen -*-===//
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 // 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
13 class Format<bits<6> val> {
17 def FPseudo : Format<0>;
22 def FFSLD : Format<5>;
23 def FFSLT : Format<6>;
24 def FFSLTD : Format<7>;
30 //===----------------------------------------------------------------------===//
31 // Describe MBlaze instructions format
33 // CPU INSTRUCTION FORMATS
35 // opcode - operation code.
37 // ra - first src. reg.
38 // rb - second src. reg.
39 // imm16 - 16-bit immediate value.
41 //===----------------------------------------------------------------------===//
43 // Generic MBlaze Format
44 class MBlazeInst<bits<6> op, Format form, dag outs, dag ins, string asmstr,
45 list<dag> pattern, InstrItinClass itin> : Instruction
47 let Namespace = "MBlaze";
52 bits<6> FormBits = Form.Value;
54 // Top 6 bits are the 'opcode' field
55 let Inst{0-5} = opcode;
57 dag OutOperandList = outs;
58 dag InOperandList = ins;
60 let AsmString = asmstr;
61 let Pattern = pattern;
64 // TSFlags layout should be kept in sync with MBlazeInstrInfo.h.
65 let TSFlags{5-0} = FormBits;
68 //===----------------------------------------------------------------------===//
69 // Pseudo instruction class
70 //===----------------------------------------------------------------------===//
71 class MBlazePseudo<dag outs, dag ins, string asmstr, list<dag> pattern>:
72 MBlazeInst<0x0, FPseudo, outs, ins, asmstr, pattern, IIPseudo>;
74 //===----------------------------------------------------------------------===//
75 // Type A instruction class in MBlaze : <|opcode|rd|ra|rb|flags|>
76 //===----------------------------------------------------------------------===//
78 class TA<bits<6> op, bits<11> flags, dag outs, dag ins, string asmstr,
79 list<dag> pattern, InstrItinClass itin> :
80 MBlazeInst<op,FRRR,outs, ins, asmstr, pattern, itin>
89 let Inst{21-31} = flags;
92 //===----------------------------------------------------------------------===//
93 // Type B instruction class in MBlaze : <|opcode|rd|ra|immediate|>
94 //===----------------------------------------------------------------------===//
96 class TB<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
97 InstrItinClass itin> :
98 MBlazeInst<op, FRRI, outs, ins, asmstr, pattern, itin>
105 let Inst{11-15} = ra;
106 let Inst{16-31} = imm16;
109 //===----------------------------------------------------------------------===//
110 // Type B instruction class in MBlaze but with the operands reversed in
111 // the LLVM DAG : <|opcode|rd|ra|immediate|>
112 //===----------------------------------------------------------------------===//
113 class TBR<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
114 InstrItinClass itin> :
115 TB<op, outs, ins, asmstr, pattern, itin> {