Add instruction formats and few opcodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2009-07-16 14:35:20 +00:00
parent 6ff3f2c710
commit 6d4b270e38
2 changed files with 677 additions and 955 deletions

View File

@ -7,528 +7,121 @@
//
//===----------------------------------------------------------------------===//
class InstSystemZ<dag outs, dag ins, string asmstr, list<dag> pattern> : Instruction {
// 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;
let AsmString = asmstr;
}
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;
}
//===----------------------------------------------------------------------===//
// E format
//===----------------------------------------------------------------------===//
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;
class F_E<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<16> Inst;
let Inst{15-0} = opcode;
let Pattern = pattern;
let AsmString = asmstr;
}
//===----------------------------------------------------------------------===//
// I format
//===----------------------------------------------------------------------===//
class F_I<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-32} = opcode;
//let Inst{31-0} = simm32;
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;
}
//===----------------------------------------------------------------------===//
// RR format
//===----------------------------------------------------------------------===//
class RRI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I8<op, RRForm, outs, ins, asmstr, pattern>;
class F_RR<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<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>;
field bits<16> Inst;
class RILI<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I12<op, RILForm, outs, ins, asmstr, pattern>;
let Inst{15-8} = opcode;
}
class RREI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I16<op, RREForm, outs, ins, asmstr, pattern>;
//===----------------------------------------------------------------------===//
// RRE format
//===----------------------------------------------------------------------===//
class RXI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I8<op, RXForm, outs, ins, asmstr, pattern>;
class F_RRE<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<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>;
field bits<32> Inst;
class RSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I8<op, RSForm, outs, ins, asmstr, pattern>;
let Inst{31-16} = opcode;
let Inst{15-8} = 0;
//let Inst{7-4} = r1;
//let Inst{3-0} = r2;
}
class RSYI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I16<op, RSYForm, outs, ins, asmstr, pattern>;
//===----------------------------------------------------------------------===//
// RRF format (1)
//===----------------------------------------------------------------------===//
class SII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I8<op, SIForm, outs, ins, asmstr, pattern>;
class F_RRF_1<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<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>;
field bits<32> Inst;
class SILI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
: I16<op, SILForm, outs, ins, asmstr, pattern>;
let Inst{31-16} = opcode;
//let Inst{15-12} = r1;
let Inst{11-8} = 0;
//let Inst{7-4} = r3;
//let Inst{3-0} = r2;
}
//===----------------------------------------------------------------------===//
// RRF format (2)
//===----------------------------------------------------------------------===//
class F_RRF_2<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-16} = opcode;
//let Inst{15-12} = m3;
let Inst{11-8} = 0;
//let Inst{7-4} = r1;
//let Inst{3-0} = r2;
}
//===----------------------------------------------------------------------===//
// RRF format (3)
//===----------------------------------------------------------------------===//
class F_RRF_3<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-16} = opcode;
//let Inst{15-12} = r3;
//let Inst{11-8} = m4;
//let Inst{7-4} = r1;
//let Inst{3-0} = r2;
}
//===----------------------------------------------------------------------===//
// RX format
//===----------------------------------------------------------------------===//
class F_RX<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-20} = r1;
//let Inst{19-16} = x2;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12;
}
//===----------------------------------------------------------------------===//
// RXE format
//===----------------------------------------------------------------------===//
class F_RXE<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = x2;
//let Inst{31-28} = b2;
//let Inst{27-16} = udisp12;
let Inst{15-8} = 0;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RXF format
//===----------------------------------------------------------------------===//
class F_RXF<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r3;
//let Inst{35-32} = x2;
//let Inst{31-28} = b2;
//let Inst{27-16} = udisp12;
//let Inst{15-11} = r1;
let Inst{11-8} = 0;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RXY format
//===----------------------------------------------------------------------===//
class F_RXY<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = x2;
//let Inst{31-28} = b2;
//let Inst{27-8} = sdisp20;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RS format (1)
//===----------------------------------------------------------------------===//
class F_RS_1<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-20} = r1;
//let Inst{19-16} = r3;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12;
}
//===----------------------------------------------------------------------===//
// RS format (2)
//===----------------------------------------------------------------------===//
class F_RS_2<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-20} = r1;
//let Inst{19-16} = m3;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12;
}
//===----------------------------------------------------------------------===//
// RS format (3)
//===----------------------------------------------------------------------===//
class F_RS_3<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-20} = r1;
let Inst{19-16} = 0;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12;
}
//===----------------------------------------------------------------------===//
// RSY format (1)
//===----------------------------------------------------------------------===//
class F_RSY_1<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = r3;
//let Inst{31-28} = b2;
//let Inst{27-8} = sdisp20;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RSY format (2)
//===----------------------------------------------------------------------===//
class F_RSY_2<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = m3;
//let Inst{31-28} = b2;
//let Inst{27-8} = sdisp20;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RSL format
//===----------------------------------------------------------------------===//
class F_RSL<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = ll;
let Inst{35-32} = 0;
//let Inst{31-28} = b1;
//let Inst{27-16} = udisp12;
let Inst{15-8} = 0;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RSI format
//===----------------------------------------------------------------------===//
class F_RSI<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-20} = r1;
//let Inst{19-16} = r3;
//let Inst{15-0} = simm16;
}
//===----------------------------------------------------------------------===//
// RI format
//===----------------------------------------------------------------------===//
class F_RI<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-20} = r1;
//let Inst{19-16} = op2;
//let Inst{15-0} = simm16;
}
//===----------------------------------------------------------------------===//
// RIE format
//===----------------------------------------------------------------------===//
class F_RIE<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = r2;
//let Inst{31-16} = simm16;
let Inst{15-8} = 0;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// RIL format (1)
//===----------------------------------------------------------------------===//
class F_RIL_1<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = op2;
//let Inst{31-0} = simm32;
}
//===----------------------------------------------------------------------===//
// RIL format (2)
//===----------------------------------------------------------------------===//
class F_RIL_2<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = m1;
//let Inst{35-32} = op2;
//let Inst{31-0} = simm32;
}
//===----------------------------------------------------------------------===//
// SI format
//===----------------------------------------------------------------------===//
class F_SI<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-24} = opcode;
//let Inst{23-16} = simm8;
//let Inst{15-12} = b1;
//let Inst{11-0} = udisp12;
}
//===----------------------------------------------------------------------===//
// SIY format
//===----------------------------------------------------------------------===//
class F_SIY<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-32} = simm8;
//let Inst{31-28} = b1;
//let Inst{27-8} = sdisp20;
//let Inst{7-0} = op2;
}
//===----------------------------------------------------------------------===//
// S format
//===----------------------------------------------------------------------===//
class F_S<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<32> Inst;
let Inst{31-16} = opcode;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12;
}
//===----------------------------------------------------------------------===//
// SS format (1)
//===----------------------------------------------------------------------===//
class F_SS_1<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-32} = ll;
//let Inst{31-28} = b1;
//let Inst{27-16} = udisp12;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12_2;
}
//===----------------------------------------------------------------------===//
// SS format (2)
//===----------------------------------------------------------------------===//
class F_SS_2<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = l1;
//let Inst{35-32} = l2;
//let Inst{31-28} = b1;
//let Inst{27-16} = udisp12;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12_2;
}
//===----------------------------------------------------------------------===//
// SS format (3)
//===----------------------------------------------------------------------===//
class F_SS_3<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = r3;
//let Inst{31-28} = b1;
//let Inst{27-16} = udisp12;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12_2;
}
//===----------------------------------------------------------------------===//
// SS format (4)
//===----------------------------------------------------------------------===//
class F_SS_4<bits<8> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-40} = opcode;
//let Inst{39-36} = r1;
//let Inst{35-32} = r3;
//let Inst{31-28} = b2;
//let Inst{27-16} = udisp12_2;
//let Inst{15-12} = b4;
//let Inst{11-0} = udisp12_4;
}
//===----------------------------------------------------------------------===//
// SSE format
//===----------------------------------------------------------------------===//
class F_SSE<bits<16> opcode,
dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
field bits<48> Inst;
let Inst{47-32} = opcode;
//let Inst{31-28} = b1;
//let Inst{27-16} = udisp12;
//let Inst{15-12} = b2;
//let Inst{11-0} = udisp12_2;
}
//===----------------------------------------------------------------------===//
// Pseudo instructions
//===----------------------------------------------------------------------===//
class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
: InstSystemZ<outs, ins, asmstr, pattern> {
: InstSystemZ<0, Pseudo, outs, ins> {
let Pattern = pattern;
let AsmString = asmstr;
}

File diff suppressed because it is too large Load Diff