1 //===- MipsRegisterInfo.td - Mips Register defs -----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Bruno Cardoso Lopes and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
11 // Describe MIPS instructions format
13 // All the possible Mips fields are:
15 // opcode - operation code.
17 // rt - dst reg (on a 2 regs instr) or src reg (on a 3 reg instr).
18 // rd - dst reg, only used on 3 regs instr.
19 // shamt - only used on shift instructions, contains the shift amount.
20 // funct - combined with opcode field give us an operation code.
22 //===----------------------------------------------------------------------===//
24 // Generic Mips Format
25 class MipsInst<dag outs, dag ins, string asmstr, list<dag> pattern,
26 InstrItinClass itin>: Instruction
30 let Namespace = "Mips";
34 // Top 5 bits are the 'opcode' field
35 let Inst{31-26} = opcode;
37 dag OutOperandList = outs;
38 dag InOperandList = ins;
40 let AsmString = asmstr;
41 let Pattern = pattern;
46 //===----------------------------------------------------------------------===//
47 // Format R instruction class in Mips : <|opcode|rs|rt|rd|shamt|funct|>
48 //===----------------------------------------------------------------------===//
50 class FR<bits<6> op, bits<6> _funct, dag outs, dag ins, string asmstr,
51 list<dag> pattern, InstrItinClass itin>:
52 MipsInst<outs, ins, asmstr, pattern, itin>
66 let Inst{10-6} = shamt;
67 let Inst{5-0} = funct;
70 //===----------------------------------------------------------------------===//
71 // Format I instruction class in Mips : <|opcode|rs|rt|immediate|>
72 //===----------------------------------------------------------------------===//
74 class FI<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
75 InstrItinClass itin>: MipsInst<outs, ins, asmstr, pattern, itin>
85 let Inst{15-0} = imm16;
88 //===----------------------------------------------------------------------===//
89 // Format J instruction class in Mips : <|opcode|address|>
90 //===----------------------------------------------------------------------===//
92 class FJ<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
93 InstrItinClass itin>: MipsInst<outs, ins, asmstr, pattern, itin>
99 let Inst{25-0} = addr;