decodetree: Allow !function with no input bits

Call this form a "parameter", returning a value extracted
from the DisasContext.

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2019-07-22 17:02:56 -07:00
parent 3fbd3405d2
commit 94597b6146
4 changed files with 56 additions and 12 deletions

View file

@ -23,7 +23,7 @@ Fields
Syntax::
field_def := '%' identifier ( unnamed_field )+ ( !function=identifier )?
field_def := '%' identifier ( unnamed_field )* ( !function=identifier )?
unnamed_field := number ':' ( 's' ) number
For *unnamed_field*, the first number is the least-significant bit position
@ -34,6 +34,12 @@ present, they are concatenated. In this way one can define disjoint fields.
If ``!function`` is specified, the concatenated result is passed through the
named function, taking and returning an integral value.
One may use ``!function`` with zero ``unnamed_fields``. This case is called
a *parameter*, and the named function is only passed the ``DisasContext``
and returns an integral value extracted from there.
A field with no ``unnamed_fields`` and no ``!function`` is in error.
FIXME: the fields of the structure into which this result will be stored
is restricted to ``int``. Which means that we cannot expand 64-bit items.