From d47e0af56b46caa5a63928f0296ca568bef46f55 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 6 Dec 2020 22:42:37 -0500 Subject: [PATCH] pan/bi: Add unused instruction mechanism Certain instructions are highly unlikely to ever be used in the Bifrost compiler, due to differences in the Mesa stack versus the Arm compiler, as well as hardware features added speculatively and that never became API visible. It doesn't make sense to include these instructions in the IR, so let's disable them, while retaining complete disassembly. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/gen_disasm.py | 2 +- src/panfrost/bifrost/isa_parse.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/panfrost/bifrost/gen_disasm.py b/src/panfrost/bifrost/gen_disasm.py index a4aa66a..f80a97f 100644 --- a/src/panfrost/bifrost/gen_disasm.py +++ b/src/panfrost/bifrost/gen_disasm.py @@ -25,7 +25,7 @@ import itertools from isa_parse import parse_instructions, opname_to_c, expand_states from mako.template import Template -instructions = parse_instructions(sys.argv[1]) +instructions = parse_instructions(sys.argv[1], include_unused = True) # Constructs a reserved mask for a derived to cull impossible encodings diff --git a/src/panfrost/bifrost/isa_parse.py b/src/panfrost/bifrost/isa_parse.py index 9b4e8a6..c0dccbc 100644 --- a/src/panfrost/bifrost/isa_parse.py +++ b/src/panfrost/bifrost/isa_parse.py @@ -96,7 +96,8 @@ def parse_instruction(ins): 'immediates': [], 'swaps': [], 'derived': [], - 'staging': ins.attrib.get('staging', '') + 'staging': ins.attrib.get('staging', ''), + 'unused': ins.attrib.get('unused', False), } if 'exact' in ins.attrib: @@ -146,12 +147,19 @@ def parse_instruction(ins): return variants -def parse_instructions(xml): +def parse_instructions(xml, include_unused = False): final = {} instructions = ET.parse(xml).getroot().findall('ins') for ins in instructions: - final[ins.attrib['name']] = parse_instruction(ins) + parsed = parse_instruction(ins) + + # Some instructions are for useful disassembly only and can be stripped + # out of the compiler, particularly useful for release builds + if parsed[0][1]["unused"] and not include_unused: + continue + + final[ins.attrib['name']] = parsed return final -- 2.7.4