summary refs log tree commit diff stats
path: root/scripts/decodetree.py
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-02-27 21:37:32 -0800
committerRichard Henderson <richard.henderson@linaro.org>2019-03-12 09:46:58 -0700
commit82bfac1c06cadeb5c7252734dc695d951185916c (patch)
treed4bdb746fbffd5df397444acc65b67f2a83edd2d /scripts/decodetree.py
parentcd3e7fc18db43b296f413814cd4b72bcd6878bc4 (diff)
downloadfocaccia-qemu-82bfac1c06cadeb5c7252734dc695d951185916c.tar.gz
focaccia-qemu-82bfac1c06cadeb5c7252734dc695d951185916c.zip
decodetree: Produce clean output for an empty input file
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>
Diffstat (limited to 'scripts/decodetree.py')
-rwxr-xr-xscripts/decodetree.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 6067e940ab..6e7ba278be 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -1049,15 +1049,16 @@ def main():
            '(DisasContext *ctx, ', insntype, ' insn)\n{\n')
 
     i4 = str_indent(4)
-    output(i4, 'union {\n')
-    for n in sorted(arguments.keys()):
-        f = arguments[n]
-        output(i4, i4, f.struct_name(), ' f_', f.name, ';\n')
-    output(i4, '} u;\n\n')
 
-    t.output_code(4, False, 0, 0)
-    output(i4, 'return false;\n')
+    if len(allpatterns) != 0:
+        output(i4, 'union {\n')
+        for n in sorted(arguments.keys()):
+            f = arguments[n]
+            output(i4, i4, f.struct_name(), ' f_', f.name, ';\n')
+        output(i4, '} u;\n\n')
+        t.output_code(4, False, 0, 0)
 
+    output(i4, 'return false;\n')
     output('}\n')
 
     if output_file: