Switch Alpha to new section handling stuff
[oota-llvm.git] / lib / Target / PIC16 / PIC16InstrFormats.td
1 //===- PIC16RegisterInfo.td - PIC16 Register defs ------------*- 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 PIC16 instructions format
12 //
13 //  All the possible PIC16 fields are:
14 //
15 //  opcode  - operation code.
16 //  f       - 7-bit register file address.
17 //  d       - 1-bit direction specifier
18 //  k       - 8/11 bit literals
19 //  b       - 3 bits bit num specifier
20 //
21 //===----------------------------------------------------------------------===//
22
23 // Generic PIC16 Format
24 class PIC16Inst<dag outs, dag ins, string asmstr, list<dag> pattern>
25         : Instruction 
26 {
27   field bits<14> Inst;
28
29   let Namespace = "PIC16";
30
31   dag OutOperandList = outs;
32   dag InOperandList = ins;
33
34   let AsmString = asmstr;
35   let Pattern = pattern;
36 }
37
38
39 //===----------------------------------------------------------------------===//
40 // Byte Oriented instruction class in PIC16 : <|opcode|d|f|>
41 //===----------------------------------------------------------------------===//
42
43 class ByteFormat<bits<6> op, dag outs, dag ins, string asmstr,
44                   list<dag> pattern>
45         :PIC16Inst<outs, ins, asmstr, pattern> 
46 {
47   bits<1>  d;
48   bits<7>  f;
49
50   let Inst{13-8} = op;
51
52   let Inst{7} = d;
53   let Inst{6-0} = f; 
54 }
55
56 //===----------------------------------------------------------------------===//
57 // Bit Oriented instruction class in PIC16 : <|opcode|b|f|>
58 //===----------------------------------------------------------------------===//
59
60 class BitFormat<bits<4> op, dag outs, dag ins, string asmstr, list<dag> pattern>
61          : PIC16Inst<outs, ins, asmstr, pattern> 
62 {
63   bits<3>  b;
64   bits<7>  f;
65
66   let Inst{13-10} = op;
67
68   let Inst{9-7} = b;
69   let Inst{6-0} = f; 
70 }
71
72 //===----------------------------------------------------------------------===//
73 // Literal Format instruction class in PIC16 : <|opcode|k|>
74 //===----------------------------------------------------------------------===//
75
76 class LiteralFormat<bits<6> op, dag outs, dag ins, string asmstr, 
77                     list<dag> pattern>
78         : PIC16Inst<outs, ins, asmstr, pattern> 
79 {
80   bits<8> k;
81
82   
83   let Inst{13-8} = op;
84
85   let Inst{7-0} = k; 
86 }
87
88 //===----------------------------------------------------------------------===//
89 // Control Format instruction class in PIC16 : <|opcode|k|>
90 //===----------------------------------------------------------------------===//
91
92 class ControlFormat<bits<3> op, dag outs, dag ins, string asmstr, 
93                     list<dag> pattern>
94         :PIC16Inst<outs, ins, asmstr, pattern> 
95 {
96   bits<11> k;
97
98   
99   let Inst{13-11} = op;
100
101   let Inst{10-0} = k; 
102 }
103
104 //===----------------------------------------------------------------------===//
105 // Pseudo instruction class in PIC16
106 //===----------------------------------------------------------------------===//
107
108 class Pseudo<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>:
109       PIC16Inst<outs, ins, asmstr, pattern>
110 {
111    let Inst{13-6} = op;
112 }