]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/PIC16/PIC16InstrFormats.td
Improve the Xen para-virtualized device infrastructure of FreeBSD:
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / PIC16 / PIC16InstrFormats.td
1 //===- PIC16InstrFormats.td - PIC16 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 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 // PIC16 Instructions are 14-bit wide.
25
26 // FIXME: Add Cooper Specific Formats if any.
27
28 class PIC16Inst<dag outs, dag ins, string asmstr, list<dag> pattern>
29   : Instruction {
30   field bits<14> Inst;
31
32   let Namespace = "PIC16";
33   dag OutOperandList = outs;
34   dag InOperandList = ins;
35   let AsmString = asmstr;
36   let Pattern = pattern;
37 }
38
39
40 //===----------------------------------------------------------------------===//
41 // Byte Oriented instruction class in PIC16 : <|opcode|d|f|>
42 // opcode = 6 bits.
43 // d = direction = 1 bit.
44 // f = file register address = 7 bits.
45 //===----------------------------------------------------------------------===//
46
47 class ByteFormat<bits<6> opcode, dag outs, dag ins, string asmstr,
48                  list<dag> pattern>
49   :PIC16Inst<outs, ins, asmstr, pattern> {
50   bits<1>  d;
51   bits<7>  f;
52
53   let Inst{13-8} = opcode;
54
55   let Inst{7} = d;
56   let Inst{6-0} = f; 
57 }
58
59 //===----------------------------------------------------------------------===//
60 // Bit Oriented instruction class in PIC16 : <|opcode|b|f|>
61 // opcode = 4 bits.
62 // b = bit specifier = 3 bits.
63 // f = file register address = 7 bits.
64 //===----------------------------------------------------------------------===//
65
66 class BitFormat<bits<4> opcode, dag outs, dag ins, string asmstr, 
67                 list<dag> pattern>
68   : PIC16Inst<outs, ins, asmstr, pattern> {
69   bits<3>  b;
70   bits<7>  f;
71
72   let Inst{13-10} = opcode;
73
74   let Inst{9-7} = b;
75   let Inst{6-0} = f; 
76 }
77
78 //===----------------------------------------------------------------------===//
79 // Literal Format instruction class in PIC16 : <|opcode|k|>
80 // opcode = 6 bits
81 // k = literal = 8 bits
82 //===----------------------------------------------------------------------===//
83
84 class LiteralFormat<bits<6> opcode, dag outs, dag ins, string asmstr, 
85                     list<dag> pattern>
86   : PIC16Inst<outs, ins, asmstr, pattern> {
87   bits<8> k;
88   
89   let Inst{13-8} = opcode;
90
91   let Inst{7-0} = k; 
92 }
93
94 //===----------------------------------------------------------------------===//
95 // Control Format instruction class in PIC16 : <|opcode|k|>
96 // opcode = 3 bits.
97 // k = jump address = 11 bits.
98 //===----------------------------------------------------------------------===//
99
100 class ControlFormat<bits<3> opcode, dag outs, dag ins, string asmstr, 
101                     list<dag> pattern>
102   : PIC16Inst<outs, ins, asmstr, pattern> {
103   bits<11> k;
104
105   let Inst{13-11} = opcode;
106
107   let Inst{10-0} = k; 
108 }
109
110 //===----------------------------------------------------------------------===//
111 // Pseudo instruction class in PIC16
112 //===----------------------------------------------------------------------===//
113
114 class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
115   : PIC16Inst<outs, ins, asmstr, pattern> {
116    let Inst{13-6} = 0;
117 }