diff options
author | iximeow <me@iximeow.net> | 2022-12-03 14:03:08 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2023-01-02 08:50:23 -0800 |
commit | bcd87a52c80e0a1c7e101b72989c26bf72f34b76 (patch) | |
tree | d43c7341676f145c804492bc5e11edbab49f7cc0 /data | |
parent | 789797accee0caa6580fbba650c719a952945ac6 (diff) |
TEMP generate InstDecoder bitsx86-generic
Diffstat (limited to 'data')
-rw-r--r-- | data/generate_opcode.py | 13 |
1 files changed, 9 insertions, 4 deletions
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() |