aboutsummaryrefslogtreecommitdiff
path: root/scripts/decodetree.py
AgeCommit message (Collapse)AuthorFilesLines
2019-05-06decodetree: Add DisasContext argument to !function expandersRichard Henderson1-4/+5
This does require adjusting all existing users. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-05-06decodetree: Expand a decode_load functionRichard Henderson1-3/+172
Read the instruction, loading no more bytes than necessary. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-05-06decodetree: Initial support for variable-length ISAsRichard Henderson1-12/+37
Assuming that the ISA clearly describes how to determine the length of the instruction, and the ISA has a reasonable maximum instruction length, the input to the decoder can be right-justified in an appropriate insn word. This is not 100% convenient, as out-of-line %fields are numbered relative to the maximum instruction length, but this appears to still be usable. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Properly diagnose fields overflowing an insnRichard Henderson1-0/+2
Previously this would result in an exception for shifting the field mask by a negative number. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Prefix extract function names with decode_functionRichard Henderson1-1/+2
This makes it easier to name Formats within multiple decode files. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Allow +- to begin a number initializing a fieldRichard Henderson1-1/+1
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Produce clean output for an empty input fileRichard Henderson1-7/+8
This is interesting for bisection, where an output file is plumbed, but does not yet have patterns. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Add --static-decode optionRichard Henderson1-1/+4
Like --decode, but do not drop 'static' qualifier. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Allow grouping of overlapping patternsRichard Henderson1-22/+143
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Do not unconditionaly return from Pattern.output_codeRichard Henderson1-3/+4
As a consequence, the 'return false' gets pushed up one level. This will allow us to perform some other action when the translator returns failure. Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Ensure build_tree does not include values outside insnmaskPhilippe Mathieu-Daudé1-1/+1
Reproduced with "scripts/decodetree.py /dev/null". Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12decodetree: Move documentation to docs/devel/decodetree.rstRichard Henderson1-133/+1
One great big block comment isn't the best way to document the syntax of a language. Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-01-25decodetree: re.fullmatch was added in 3.4Paolo Bonzini1-1/+1
Python 3 versions earlier than 3.4 do not have it, use the same workaround that is in place for 3.0. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1548410602-16008-1-git-send-email-pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-11-01Merge remote-tracking branch 'remotes/rth/tags/pull-dt-20181031' into stagingPeter Maydell1-24/+40
Updates to decodetree.py for risc-v. # gpg: Signature made Wed 31 Oct 2018 16:52:07 GMT # gpg: using RSA key 64DF38E8AF7E215F # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * remotes/rth/tags/pull-dt-20181031: decodetree: Allow multiple input files decodetree: Remove "insn" argument from trans_* expanders decodetree: Add !extern flag to argument sets Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-10-31decodetree: Allow multiple input filesRichard Henderson1-10/+15
While it would be possible to concatenate input files with make, passing the original input files to decodetree.py allows us to generate error messages which allows compilation environments (read: emacs) to next-error to the correct input file. Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-10-31decodetree: Remove "insn" argument from trans_* expandersRichard Henderson1-3/+2
This allows trans_* expanders to be shared between decoders for 32 and 16-bit insns, by not tying the expander to the size of the insn that produced it. This change requires adjusting the two existing users to match. Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-10-31decodetree: Add !extern flag to argument setsRichard Henderson1-11/+23
Allow argument sets to be shared between two decoders by avoiding a re-declaration error. Make sure that anonymous argument sets and anonymous formats have unique names. Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-10-30scripts/decodetree.py: fix reference to attributesCleber Rosa1-1/+1
Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20181004161852.11673-9-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-10-26scripts/decodetree.py: remove unused importsCleber Rosa1-2/+0
Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20181004161852.11673-8-crosa@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-03-26scripts/decodetree: Fix insnmask not marked as global in main()Bastian Koppelmann1-0/+1
if '-w 16' was given as a cmdline args a local copy of insnmask is set and not the global one. Signed-off-by: Peer Adelt <peer.adelt@hni.uni-paderborn.de> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Message-Id: <20180319115846.9662-1-kbastian@mail.uni-paderborn.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-03-02decodetree: Propagate return value from translate subroutinesRichard Henderson1-3/+2
Allow the translate subroutines to return false for invalid insns. At present we can of course invoke an invalid insn exception from within the translate subroutine, but in the short term this consolidates code. In the long term it would allow the decodetree language to support overlapping patterns for ISA extensions. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180227232618.2908-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-22scripts: Add decodetree.pyRichard Henderson1-0/+1062
To be used to decode ARM SVE, but could be used for any fixed-width ISA. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>