pan/bi: Add pseudo-instruction mechanism
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 8 Dec 2020 01:01:11 +0000 (20:01 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 23 Dec 2020 17:06:56 +0000 (17:06 +0000)
Useful for instructions that need to be modeled in the IR (with support
in the builder and printer) but will always be lowered away before
packing since they don't correspond to anything real.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>

src/panfrost/bifrost/isa_parse.py

index c0dccbc..7d927e2 100644 (file)
@@ -98,6 +98,7 @@ def parse_instruction(ins):
             'derived': [],
             'staging': ins.attrib.get('staging', ''),
             'unused': ins.attrib.get('unused', False),
+            'pseudo': ins.attrib.get('pseudo', False),
     }
 
     if 'exact' in ins.attrib:
@@ -147,7 +148,7 @@ def parse_instruction(ins):
 
     return variants
 
-def parse_instructions(xml, include_unused = False):
+def parse_instructions(xml, include_unused = False, include_pseudo = False):
     final = {}
     instructions = ET.parse(xml).getroot().findall('ins')
 
@@ -159,6 +160,10 @@ def parse_instructions(xml, include_unused = False):
         if parsed[0][1]["unused"] and not include_unused:
             continue
 
+        # On the other hand, some instructions are only for the IR, not disassembly
+        if parsed[0][1]["pseudo"] and not include_pseudo:
+            continue
+
         final[ins.attrib['name']] = parsed
 
     return final