diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-07-23 17:54:55 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2025-07-25 10:31:45 +0100 |
| commit | b79f944e09657f63b6dd6e78ac7966fdc7a3e6d1 (patch) | |
| tree | daa432b9029d5899e67f1e65241a544bf6954585 /scripts | |
| parent | aba39946baaf5ca73aae0b79e2cd0790ddafe291 (diff) | |
| download | focaccia-qemu-b79f944e09657f63b6dd6e78ac7966fdc7a3e6d1.tar.gz focaccia-qemu-b79f944e09657f63b6dd6e78ac7966fdc7a3e6d1.zip | |
decodetree: Infer argument set before inferring format
Failure to confirm an argument set first may result in the selection of a format which leaves extra arguments to be filled in by the pattern. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20250723165458.3509150-4-peter.maydell@linaro.org Message-id: 20250722183343.273533-1-richard.henderson@linaro.org Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/decodetree.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/decodetree.py b/scripts/decodetree.py index e8b72da3a9..f992472b73 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1016,9 +1016,12 @@ def infer_format(arg, fieldmask, flds, width): else: var_flds[n] = c + if not arg: + arg = infer_argument_set(flds) + # Look for an existing format with the same argument set and fields for fmt in formats.values(): - if arg and fmt.base != arg: + if fmt.base != arg: continue if fieldmask != fmt.fieldmask: continue @@ -1029,8 +1032,6 @@ def infer_format(arg, fieldmask, flds, width): return (fmt, const_flds) name = decode_function + '_Fmt_' + str(len(formats)) - if not arg: - arg = infer_argument_set(flds) fmt = Format(name, 0, arg, 0, 0, 0, fieldmask, var_flds, width) formats[name] = fmt |