From 7ead1e3f6f2420a4c6fe91c6e1085fb8422f4beb Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 23 Aug 2016 11:39:47 -0700 Subject: [PATCH] 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. --- meta/cretonne/__init__.py | 6 +++++- meta/cretonne/immediates.py | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/meta/cretonne/__init__.py b/meta/cretonne/__init__.py index ecfea17989..c79e0f7bdc 100644 --- a/meta/cretonne/__init__.py +++ b/meta/cretonne/__init__.py @@ -237,11 +237,15 @@ variable_args = OperandKind( class ImmediateKind(OperandKind): """ 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.__doc__ = doc + self.default_member = default_member def __repr__(self): return 'ImmediateKind({})'.format(self.name) diff --git a/meta/cretonne/immediates.py b/meta/cretonne/immediates.py index 61ba418c9c..ca8affded0 100644 --- a/meta/cretonne/immediates.py +++ b/meta/cretonne/immediates.py @@ -34,11 +34,16 @@ immvector = ImmediateKind('immvector', 'An immediate SIMD vector.') #: #: This enumerated operand kind is used for the :cton:inst:`icmp` instruction #: 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. #: #: This enumerated operand kind is used for the :cton:inst:`fcmp` instruction #: and corresponds to the `condcodes::FloatCC` Rust type. floatcc = ImmediateKind( - 'floatcc', 'A floating point comparison condition code.') + 'floatcc', + 'A floating point comparison condition code.', + default_member='cond')