summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/SystemZInstrFormats.td
blob: 81f704f977857fc30513c93d661b3bd36d01d0d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//===- SystemZInstrFormats.td - SystemZ Instruction Formats ----*- tablegen -*-===//
// 
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// 
//===----------------------------------------------------------------------===//

// Format specifies the encoding used by the instruction.  This is part of the
// ad-hoc solution used to emit machine instruction encodings by our machine
// code emitter.
class Format<bits<5> val> {
  bits<5> Value = val;
}

def Pseudo   : Format<0>;
def EForm    : Format<1>;
def IForm    : Format<2>;
def RIForm   : Format<3>;
def RIEForm  : Format<4>;
def RILForm  : Format<5>;
def RISForm  : Format<6>;
def RRForm   : Format<7>;
def RREForm  : Format<8>;
def RRFForm  : Format<9>;
def RRRForm  : Format<10>;
def RRSForm  : Format<11>;
def RSForm   : Format<12>;
def RSIForm  : Format<13>;
def RSILForm : Format<14>;
def RSYForm  : Format<15>;
def RXForm   : Format<16>;
def RXEForm  : Format<17>;
def RXFForm  : Format<18>;
def RXYForm  : Format<19>;
def SForm    : Format<20>;
def SIForm   : Format<21>;
def SILForm  : Format<22>;
def SIYForm  : Format<23>;
def SSForm   : Format<24>;
def SSEForm  : Format<25>;
def SSFForm  : Format<26>;

class InstSystemZ<bits<16> op, Format f, dag outs, dag ins> : Instruction {
  let Namespace = "SystemZ";

  bits<16> Opcode = op;

  Format Form = f;
  bits<5> FormBits = Form.Value;

  dag OutOperandList = outs;
  dag InOperandList = ins;
}

class I8<bits<8> op, Format f, dag outs, dag ins, string asmstr, 
         list<dag> pattern> 
  : InstSystemZ<0, f, outs, ins> {
  let Opcode{0-7} = op;
  let Opcode{8-15} = 0;

  let Pattern = pattern;
  let AsmString = asmstr;
}

class I12<bits<12> op, Format f, dag outs, dag ins, string asmstr, 
         list<dag> pattern> 
  : InstSystemZ<0, f, outs, ins> {
  let Opcode{0-11} = op;
  let Opcode{12-15} = 0;

  let Pattern = pattern;
  let AsmString = asmstr;
}

class I16<bits<16> op, Format f, dag outs, dag ins, string asmstr,
         list<dag> pattern>
  : InstSystemZ<op, f, outs, ins> {
  let Pattern = pattern;
  let AsmString = asmstr;
}

class RRI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I8<op, RRForm, outs, ins, asmstr, pattern>;

class RII<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I12<op, RIForm, outs, ins, asmstr, pattern>;

class RILI<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I12<op, RILForm, outs, ins, asmstr, pattern>;

class RREI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I16<op, RREForm, outs, ins, asmstr, pattern>;

class RXI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I8<op, RXForm, outs, ins, asmstr, pattern>;

class RXYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I16<op, RXYForm, outs, ins, asmstr, pattern>;

class RSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I8<op, RSForm, outs, ins, asmstr, pattern>;

class RSYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I16<op, RSYForm, outs, ins, asmstr, pattern>;

class SII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I8<op, SIForm, outs, ins, asmstr, pattern>;

class SIYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I16<op, SIYForm, outs, ins, asmstr, pattern>;

class SILI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
  : I16<op, SILForm, outs, ins, asmstr, pattern>;


//===----------------------------------------------------------------------===//
// Pseudo instructions
//===----------------------------------------------------------------------===//

class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
   : InstSystemZ<0, Pseudo, outs, ins> {

  let Pattern = pattern;
  let AsmString = asmstr;
}