MSP430InstrFormats.td revision f2c3e179ecc2a6ebc259382828a5e5dc5a61d2f8
1//===- MSP430InstrFormats.td - MSP430 Instruction Formats-----*- tblgen -*-===//
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//  Describe MSP430 instructions format here
12//
13
14// Generic MSP430 Format
15class MSP430Inst<dag outs, dag ins, string asmstr> : Instruction {
16  field bits<16> Inst;
17
18  let Namespace = "MSP430";
19
20  dag OutOperandList = outs;
21  dag InOperandList  = ins;
22
23  let AsmString   = asmstr;
24}
25
26// FIXME: Create different classes for different addressing modes.
27
28// MSP430 Double Operand (Format I) Instructions
29class IForm<bits<4> opcode, bit ad, bit bw, bits<2> as,
30            dag outs, dag ins, string asmstr, list<dag> pattern>
31  : MSP430Inst<outs, ins, asmstr> {
32  let Pattern = pattern;
33  
34  let Inst{12-15} = opcode;
35  let Inst{7}     = ad;
36  let Inst{6}     = bw;
37  let Inst{4-5}   = as;
38}
39
40// MSP430 Single Operand (Format II) Instructions
41class IIForm<bits<9> opcode, bit bw, bits<2> ad,
42             dag outs, dag ins, string asmstr, list<dag> pattern>
43  : MSP430Inst<outs, ins, asmstr> {
44  let Pattern = pattern;
45  
46  let Inst{7-15} = opcode;
47  let Inst{6}    = bw;
48  let Inst{4-5}  = ad;
49}
50
51// MSP430 Conditional Jumps Instructions
52class CJForm<bits<3> opcode, bits<3> cond, bit s,
53             dag outs, dag ins, string asmstr, list<dag> pattern>
54  : MSP430Inst<outs, ins, asmstr> {
55  let Pattern = pattern;
56  
57  let Inst{13-15} = opcode;
58  let Inst{10-12} = cond;
59  let Inst{9}     = s;
60}
61
62// Pseudo instructions
63class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
64  : MSP430Inst<outs, ins, asmstr> {
65  let Pattern = pattern;
66  let Inst{15-0} = 0;
67}
68