Track the default member name for immediate operands.

Usually an instruction firmat has only a single immediate operand called 'imm',
or 'cond' if it is one of the condigtion codes. Add a 'default_member' field to
ImmediateKind to keep track of this default member name in the InstructionData
struct.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-23 11:39:47 -07:00
parent 2dfeea67e1
commit 7ead1e3f6f
2 changed files with 12 additions and 3 deletions

View File

@@ -237,11 +237,15 @@ variable_args = OperandKind(
class ImmediateKind(OperandKind): class ImmediateKind(OperandKind):
""" """
The kind of an immediate instruction operand. The kind of an immediate instruction operand.
:param default_member: The default member name of this kind the
`InstructionData` data structure.
""" """
def __init__(self, name, doc): def __init__(self, name, doc, default_member='imm'):
self.name = name self.name = name
self.__doc__ = doc self.__doc__ = doc
self.default_member = default_member
def __repr__(self): def __repr__(self):
return 'ImmediateKind({})'.format(self.name) return 'ImmediateKind({})'.format(self.name)

View File

@@ -34,11 +34,16 @@ immvector = ImmediateKind('immvector', 'An immediate SIMD vector.')
#: #:
#: This enumerated operand kind is used for the :cton:inst:`icmp` instruction #: This enumerated operand kind is used for the :cton:inst:`icmp` instruction
#: and corresponds to the `condcodes::IntCC` Rust type. #: and corresponds to the `condcodes::IntCC` Rust type.
intcc = ImmediateKind('intcc', 'An integer comparison condition code.') intcc = ImmediateKind(
'intcc',
'An integer comparison condition code.',
default_member='cond')
#: A condition code for comparing floating point values. #: A condition code for comparing floating point values.
#: #:
#: This enumerated operand kind is used for the :cton:inst:`fcmp` instruction #: This enumerated operand kind is used for the :cton:inst:`fcmp` instruction
#: and corresponds to the `condcodes::FloatCC` Rust type. #: and corresponds to the `condcodes::FloatCC` Rust type.
floatcc = ImmediateKind( floatcc = ImmediateKind(
'floatcc', 'A floating point comparison condition code.') 'floatcc',
'A floating point comparison condition code.',
default_member='cond')