Skip to content

Commit 3e55be3

Browse files
committed
WIP INCLUDE OPERANDKINDS FOR EXTENDED GRAMMAR
1 parent d7b9dcd commit 3e55be3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

autogen/src/header.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,7 @@ pub fn gen_opcodes(op: &str, grammar: &structs::ExtInstSetGrammar, comment: &str
400400
})
401401
.collect::<Vec<_>>();
402402

403+
dbg!(&grammar.operand_kinds);
404+
403405
generate_enum(&op, &variants, comment)
404406
}

autogen/src/structs.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ pub struct ExtInstSetGrammar {
7979
pub version: Option<u32>,
8080
pub revision: u32,
8181
pub instructions: Vec<Instruction>,
82+
#[serde(default)]
83+
pub operand_kinds: Vec<OperandKind>,
8284
}
8385

8486
fn num_or_hex<'de, D: de::Deserializer<'de>>(d: D) -> result::Result<u32, D::Error> {
@@ -92,7 +94,8 @@ fn num_or_hex<'de, D: de::Deserializer<'de>>(d: D) -> result::Result<u32, D::Err
9294
}
9395

9496
fn visit_str<E: de::Error>(self, value: &str) -> result::Result<Self::Value, E> {
95-
Ok(u32::from_str_radix(&value[2..], 16).unwrap())
97+
let hex = value.strip_prefix("0x").unwrap();
98+
Ok(u32::from_str_radix(hex, 16).unwrap())
9699
}
97100

98101
fn visit_u64<E: de::Error>(self, value: u64) -> result::Result<Self::Value, E> {

0 commit comments

Comments
 (0)