mirror of
https://github.com/ziglang/zig.git
synced 2025-04-04 12:32:29 +00:00
x86_64: use ZON for encodings
This commit is contained in:
@ -559,7 +559,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
src/arch/x86_64/abi.zig
|
||||
src/arch/x86_64/bits.zig
|
||||
src/arch/x86_64/encoder.zig
|
||||
src/arch/x86_64/encodings.zig
|
||||
src/arch/x86_64/encodings.zon
|
||||
src/clang.zig
|
||||
src/clang_options.zig
|
||||
src/clang_options_data.zig
|
||||
|
@ -1015,11 +1015,14 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op
|
||||
|
||||
const mnemonic_to_encodings_map = init: {
|
||||
@setEvalBranchQuota(5_800);
|
||||
const ModrmExt = u3;
|
||||
const Entry = struct { Mnemonic, OpEn, []const Op, []const u8, ModrmExt, Mode, Feature };
|
||||
const encodings: []const Entry = @import("encodings.zon");
|
||||
|
||||
const mnemonic_count = @typeInfo(Mnemonic).@"enum".fields.len;
|
||||
var mnemonic_map: [mnemonic_count][]Data = @splat(&.{});
|
||||
const encodings = @import("encodings.zig");
|
||||
for (encodings.table) |entry| mnemonic_map[@intFromEnum(entry[0])].len += 1;
|
||||
var data_storage: [encodings.table.len]Data = undefined;
|
||||
for (encodings) |entry| mnemonic_map[@intFromEnum(entry[0])].len += 1;
|
||||
var data_storage: [encodings.len]Data = undefined;
|
||||
var storage_i: usize = 0;
|
||||
for (&mnemonic_map) |*value| {
|
||||
value.ptr = data_storage[storage_i..].ptr;
|
||||
@ -1028,7 +1031,7 @@ const mnemonic_to_encodings_map = init: {
|
||||
var mnemonic_i: [mnemonic_count]usize = @splat(0);
|
||||
const ops_len = @typeInfo(std.meta.FieldType(Data, .ops)).array.len;
|
||||
const opc_len = @typeInfo(std.meta.FieldType(Data, .opc)).array.len;
|
||||
for (encodings.table) |entry| {
|
||||
for (encodings) |entry| {
|
||||
const i = &mnemonic_i[@intFromEnum(entry[0])];
|
||||
mnemonic_map[@intFromEnum(entry[0])][i.*] = .{
|
||||
.op_en = entry[1],
|
||||
|
File diff suppressed because it is too large
Load Diff
2612
src/arch/x86_64/encodings.zon
Normal file
2612
src/arch/x86_64/encodings.zon
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user