Skip to content

Commit f124315

Browse files
authored
asm: refactor VEX implementation (#10845)
* asm: refactor VEX implementation This change adapts the current VEX logic implemented in #10754 to look more like the current infrastructure. To do so: - it factors out a `VexPrefix` from the current `VexInstruction`, allowing us to reuse existing logic for ModR/M and SIB bytes (these do are the same in both REX and VEX encodings) - it uses compile-time constant bits like the `L` or `pp` fields directly, hopefully saving a bit on compile time - all of this allows more consistent code generation On the DSL side, this significantly changes how one defines VEX instructions. Many helper methods are added and now documented. It also makes use of a slightly unrelated change included here: I factored out how any encoding can affect the ModR/M byte with `ModRmKind`. This `enum` forces the DSL to pick only one of `/r` or `/digit` when defining instructions. * review: add `VexW`
1 parent 2d3f6dc commit f124315

File tree

7 files changed

+573
-392
lines changed

7 files changed

+573
-392
lines changed

cranelift/assembler-x64/meta/src/dsl.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ mod encoding;
88
mod features;
99
pub mod format;
1010

11+
pub use encoding::{Encoding, ModRmKind, OpcodeMod};
1112
pub use encoding::{
12-
Encoding, Group1Prefix, Group2Prefix, Group3Prefix, Group4Prefix, Opcodes, Prefixes, Rex, Vex,
13-
VexLength, VexMMMMM, VexPP, rex, vex,
13+
Group1Prefix, Group2Prefix, Group3Prefix, Group4Prefix, Opcodes, Prefixes, Rex, rex,
1414
};
15+
pub use encoding::{Vex, VexEscape, VexLength, VexPrefix, vex};
1516
pub use features::{ALL_FEATURES, Feature, Features};
1617
pub use format::{Extension, Format, Location, Mutability, Operand, OperandKind, RegClass};
1718
pub use format::{align, fmt, implicit, r, rw, sxl, sxq, sxw, w};

0 commit comments

Comments
 (0)