Home | History | Annotate | Download | only in SystemZ
      1 //===- SystemZInstrFormats.td - SystemZ Instruction Formats ----*- tablegen -*-===//
      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 // Format specifies the encoding used by the instruction.  This is part of the
     11 // ad-hoc solution used to emit machine instruction encodings by our machine
     12 // code emitter.
     13 class Format<bits<5> val> {
     14   bits<5> Value = val;
     15 }
     16 
     17 def Pseudo   : Format<0>;
     18 def EForm    : Format<1>;
     19 def IForm    : Format<2>;
     20 def RIForm   : Format<3>;
     21 def RIEForm  : Format<4>;
     22 def RILForm  : Format<5>;
     23 def RISForm  : Format<6>;
     24 def RRForm   : Format<7>;
     25 def RREForm  : Format<8>;
     26 def RRFForm  : Format<9>;
     27 def RRRForm  : Format<10>;
     28 def RRSForm  : Format<11>;
     29 def RSForm   : Format<12>;
     30 def RSIForm  : Format<13>;
     31 def RSILForm : Format<14>;
     32 def RSYForm  : Format<15>;
     33 def RXForm   : Format<16>;
     34 def RXEForm  : Format<17>;
     35 def RXFForm  : Format<18>;
     36 def RXYForm  : Format<19>;
     37 def SForm    : Format<20>;
     38 def SIForm   : Format<21>;
     39 def SILForm  : Format<22>;
     40 def SIYForm  : Format<23>;
     41 def SSForm   : Format<24>;
     42 def SSEForm  : Format<25>;
     43 def SSFForm  : Format<26>;
     44 
     45 class InstSystemZ<bits<16> op, Format f, dag outs, dag ins> : Instruction {
     46   let Namespace = "SystemZ";
     47 
     48   bits<16> Opcode = op;
     49 
     50   Format Form = f;
     51   bits<5> FormBits = Form.Value;
     52 
     53   dag OutOperandList = outs;
     54   dag InOperandList = ins;
     55 }
     56 
     57 class I8<bits<8> op, Format f, dag outs, dag ins, string asmstr, 
     58          list<dag> pattern> 
     59   : InstSystemZ<0, f, outs, ins> {
     60   let Opcode{0-7} = op;
     61   let Opcode{8-15} = 0;
     62 
     63   let Pattern = pattern;
     64   let AsmString = asmstr;
     65 }
     66 
     67 class I12<bits<12> op, Format f, dag outs, dag ins, string asmstr, 
     68          list<dag> pattern> 
     69   : InstSystemZ<0, f, outs, ins> {
     70   let Opcode{0-11} = op;
     71   let Opcode{12-15} = 0;
     72 
     73   let Pattern = pattern;
     74   let AsmString = asmstr;
     75 }
     76 
     77 class I16<bits<16> op, Format f, dag outs, dag ins, string asmstr,
     78          list<dag> pattern>
     79   : InstSystemZ<op, f, outs, ins> {
     80   let Pattern = pattern;
     81   let AsmString = asmstr;
     82 }
     83 
     84 class RRI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
     85   : I8<op, RRForm, outs, ins, asmstr, pattern>;
     86 
     87 class RII<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
     88   : I12<op, RIForm, outs, ins, asmstr, pattern>;
     89 
     90 class RILI<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
     91   : I12<op, RILForm, outs, ins, asmstr, pattern>;
     92 
     93 class RREI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
     94   : I16<op, RREForm, outs, ins, asmstr, pattern>;
     95 
     96 class RXI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
     97   : I8<op, RXForm, outs, ins, asmstr, pattern> {
     98   let AddedComplexity = 1;
     99 }
    100 
    101 class RXYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
    102   : I16<op, RXYForm, outs, ins, asmstr, pattern>;
    103 
    104 class RSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
    105   : I8<op, RSForm, outs, ins, asmstr, pattern> {
    106   let AddedComplexity = 1;
    107 }
    108 
    109 class RSYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
    110   : I16<op, RSYForm, outs, ins, asmstr, pattern>;
    111 
    112 class SII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
    113   : I8<op, SIForm, outs, ins, asmstr, pattern> {
    114   let AddedComplexity = 1;
    115 }
    116 
    117 class SIYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
    118   : I16<op, SIYForm, outs, ins, asmstr, pattern>;
    119 
    120 class SILI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
    121   : I16<op, SILForm, outs, ins, asmstr, pattern>;
    122 
    123 
    124 //===----------------------------------------------------------------------===//
    125 // Pseudo instructions
    126 //===----------------------------------------------------------------------===//
    127 
    128 class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
    129    : InstSystemZ<0, Pseudo, outs, ins> {
    130 
    131   let Pattern = pattern;
    132   let AsmString = asmstr;
    133 }
    134