X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FSystemZ%2FSystemZOperands.td;h=66d9c5fceba52606cec731a460b01407f10d1064;hb=98017a015bb862afce4f90d432eded4e28fe1d26;hp=829306f37370bde8fcb5b0b9008c94dcba01ee6e;hpb=055ac429cc995c78be4aee552ea51be7b32efbf1;p=oota-llvm.git diff --git a/lib/Target/SystemZ/SystemZOperands.td b/lib/Target/SystemZ/SystemZOperands.td index 829306f3737..66d9c5fceba 100644 --- a/lib/Target/SystemZ/SystemZOperands.td +++ b/lib/Target/SystemZ/SystemZOperands.td @@ -24,14 +24,30 @@ class ImmediateAsmOperand class Immediate : PatLeaf<(vt imm), pred, xform>, Operand { let PrintMethod = "print"##asmop##"Operand"; + let DecoderMethod = "decode"##asmop##"Operand"; let ParserMatchClass = !cast(asmop); } +// Constructs an asm operand for a PC-relative address. SIZE says how +// many bits there are. +class PCRelAsmOperand : ImmediateAsmOperand<"PCRel"##size> { + let PredicateMethod = "isImm"; + let ParserMethod = "parsePCRel"##size; +} + +// Constructs an operand for a PC-relative address with address type VT. +// ASMOP is the associated asm operand. +class PCRelOperand : Operand { + let PrintMethod = "printPCRelOperand"; + let ParserMatchClass = asmop; +} + // Constructs both a DAG pattern and instruction operand for a PC-relative -// address with address size VT. SELF is the name of the operand. -class PCRelAddress +// address with address size VT. SELF is the name of the operand and +// ASMOP is the associated asm operand. +class PCRelAddress : ComplexPattern, - Operand { + PCRelOperand { let MIOperandInfo = (ops !cast(self)); } @@ -45,8 +61,9 @@ class AddressAsmOperand } // Constructs both a DAG pattern and instruction operand for an addressing mode. -// The mode is selected by custom code in select() -// and encoded by custom code in getEncoding(). +// The mode is selected by custom code in select(), +// encoded by custom code in getEncoding() and decoded +// by custom code in decodeDispOperand(). // The address registers have BITSIZE bits and displacements have // DISPSIZE bits. NUMOPS is the number of operands that make up an // address and OPERANDS lists the types of those operands using (ops ...). @@ -60,6 +77,7 @@ class AddressingMode("i"##bitsize)> { let PrintMethod = "print"##format##"Operand"; let EncoderMethod = "get"##format##dispsize##"Encoding"; + let DecoderMethod = "decode"##format##bitsize##"Disp"##dispsize##"Operand"; let MIOperandInfo = operands; let ParserMatchClass = !cast(format##bitsize##"Disp"##dispsize); @@ -337,30 +355,39 @@ def fpimmneg0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(-0.0); }]>; // Symbolic address operands //===----------------------------------------------------------------------===// +// PC-relative asm operands. +def PCRel16 : PCRelAsmOperand<"16">; +def PCRel32 : PCRelAsmOperand<"32">; + // PC-relative offsets of a basic block. The offset is sign-extended // and multiplied by 2. -def brtarget16 : Operand { +def brtarget16 : PCRelOperand { let EncoderMethod = "getPC16DBLEncoding"; + let DecoderMethod = "decodePC16DBLOperand"; } -def brtarget32 : Operand { +def brtarget32 : PCRelOperand { let EncoderMethod = "getPC32DBLEncoding"; + let DecoderMethod = "decodePC32DBLOperand"; } // A PC-relative offset of a global value. The offset is sign-extended // and multiplied by 2. -def pcrel32 : PCRelAddress { +def pcrel32 : PCRelAddress { let EncoderMethod = "getPC32DBLEncoding"; + let DecoderMethod = "decodePC32DBLOperand"; } // A PC-relative offset of a global value when the value is used as a // call target. The offset is sign-extended and multiplied by 2. -def pcrel16call : PCRelAddress { +def pcrel16call : PCRelAddress { let PrintMethod = "printCallOperand"; let EncoderMethod = "getPLT16DBLEncoding"; + let DecoderMethod = "decodePC16DBLOperand"; } -def pcrel32call : PCRelAddress { +def pcrel32call : PCRelAddress { let PrintMethod = "printCallOperand"; let EncoderMethod = "getPLT32DBLEncoding"; + let DecoderMethod = "decodePC32DBLOperand"; } //===----------------------------------------------------------------------===//