From bcd87a52c80e0a1c7e101b72989c26bf72f34b76 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 3 Dec 2022 14:03:08 -0800 Subject: TEMP generate InstDecoder bits --- data/generate_opcode.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'data/generate_opcode.py') diff --git a/data/generate_opcode.py b/data/generate_opcode.py index 491798d..03a46b8 100644 --- a/data/generate_opcode.py +++ b/data/generate_opcode.py @@ -354,15 +354,20 @@ for root in ROOTS: f.begin_block("pub(crate) mod {}".format(root)) f.writeline("use crate::generated::{}::Opcode;".format(root)) - f.writeline("use crate::{}::{{InstDecoder, Instruction, DecodeError}};".format(root)) + f.writeline("use crate::{}::{{Instruction, DecodeError}};".format(root)) f.newline() f.writeline("use yaxpeax_arch::{Colorize, YaxColors};") f.writeline("use core::fmt;") - f.begin_block("impl InstDecoder") - for ext in arch['extensions']: + f.begin_block("struct ExtensionAwareInstDecoder") + f.writeline("flags: u128") + f.end_block() + + f.begin_block("impl ExtensionAwareInstDecoder") + for (i, ext) in enumerate(arch['extensions']): f.begin_block("fn feature_{}(&self) -> bool".format(ext)) - f.writeline("true") + f.writeline("(self.flags >> {}) & 1".format(i)) +# f.writeline("true") f.end_block() f.end_block() -- cgit v1.1