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 <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
This commit is contained in:
Alyssa Rosenzweig 2020-12-06 22:42:37 -05:00 committed by Marge Bot
parent f31922faf7
commit d47e0af56b
2 changed files with 12 additions and 4 deletions

View file

@ -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

View file

@ -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