[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] decodetree: Allow custom var width load functions
From: |
Luis Pires |
Subject: |
[PATCH 3/5] decodetree: Allow custom var width load functions |
Date: |
Tue, 13 Apr 2021 18:11:27 -0300 |
This is useful in situations where you want decodetree
to handle variable width instructions but you want to
provide custom code to load the instructions. Suppressing
the generation of the load function is necessary to avoid
compilation errors due to the load function being unused.
This will be used by the PowerPC decodetree code.
Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
---
scripts/decodetree.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 935b2964e0..a62b8d8d76 100644
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -1278,9 +1278,10 @@ def main():
global anyextern
decode_scope = 'static '
+ noloadfunc = False
long_opts = ['decode=', 'translate=', 'output=', 'insnwidth=',
- 'static-decode=', 'varinsnwidth=']
+ 'static-decode=', 'varinsnwidth=', 'noloadfunc']
try:
(opts, args) = getopt.gnu_getopt(sys.argv[1:], 'o:vw:', long_opts)
except getopt.GetoptError as err:
@@ -1312,6 +1313,8 @@ def main():
deposit_function = 'deposit64'
elif insnwidth != 32:
error(0, 'cannot handle insns of width', insnwidth)
+ elif o == '--noloadfunc':
+ noloadfunc = True
else:
assert False, 'unhandled option'
@@ -1401,12 +1404,13 @@ def main():
output(i4, 'return false;\n')
output('}\n')
- if variablewidth:
- output('\n', decode_scope, insntype, ' ', decode_function,
- '_load(DisasContext *ctx)\n{\n',
- ' ', insntype, ' insn = 0;\n\n')
- stree.output_code(4, 0, 0, 0)
- output('}\n')
+ if not noloadfunc:
+ if variablewidth:
+ output('\n', decode_scope, insntype, ' ', decode_function,
+ '_load(DisasContext *ctx)\n{\n',
+ ' ', insntype, ' insn = 0;\n\n')
+ stree.output_code(4, 0, 0, 0)
+ output('}\n')
if output_file:
output_fd.close()
--
2.25.1