etnaviv: isa: Add support for bitset's displayname

In isaspec the displayname of a bitset defines what is shown in
dissassembly. The assembler only sees this representation and
needs to be able to handle it.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30030>
This commit is contained in:
Christian Gmeiner
2024-07-03 21:06:01 +02:00
committed by Marge Bot
parent 87439ffed1
commit b771d2eef6
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -9,6 +9,7 @@ use std::collections::HashMap;
#[derive(Debug)]
pub struct Bitset<'a> {
pub name: &'a str,
pub displayname: Option<&'a str>,
pub extends: Option<&'a str>,
pub meta: HashMap<&'a str, &'a str>,
}
@@ -112,6 +113,7 @@ impl<'a> ISA<'a> {
.filter(|node| node.is_element() && node.has_tag_name("bitset"))
.for_each(|node| {
let name = node.attribute("name").unwrap();
let displayname = node.attribute("displayname");
let extends = node.attribute("extends");
let meta_nodes = node
.children()
@@ -127,6 +129,7 @@ impl<'a> ISA<'a> {
name,
Bitset {
name,
displayname,
extends,
meta: combined_meta,
},
+4 -1
View File
@@ -281,7 +281,10 @@ fn generate_peg_grammar_instructions(isa: &ISA) -> String {
// Prepare rule parts
let mut rule_parts = Vec::new();
rule_parts.push(format!("\"{}\"", instruction.name));
rule_parts.push(format!(
"\"{}\"",
instruction.displayname.unwrap_or(instruction.name)
));
let template_key = format!("INSTR_{}", type_.to_ascii_uppercase());
let flags = isa