From 94597b6146f30f949f2c454f424082a2b0f55a0e Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 22 Jul 2019 17:02:56 -0700 Subject: decodetree: Allow !function with no input bits Call this form a "parameter", returning a value extracted from the DisasContext. Reviewed-by: Philippe Mathieu-Daude Signed-off-by: Richard Henderson --- docs/devel/decodetree.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst index 44ac621..ce7f523 100644 --- a/docs/devel/decodetree.rst +++ b/docs/devel/decodetree.rst @@ -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. -- cgit v1.1