hit a comptime limitation with computing dense sets
This commit is contained in:
@@ -18,80 +18,66 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
|
||||
|
||||
pub const all_features = blk: {
|
||||
const len = @typeInfo(Feature).Enum.fields.len;
|
||||
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
|
||||
std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count);
|
||||
var result: [len]Cpu.Feature = undefined;
|
||||
result[@enumToInt(Feature.atomics)] = .{
|
||||
.index = @enumToInt(Feature.atomics),
|
||||
.name = @tagName(Feature.atomics),
|
||||
.llvm_name = "atomics",
|
||||
.description = "Enable Atomics",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.bulk_memory)] = .{
|
||||
.index = @enumToInt(Feature.bulk_memory),
|
||||
.name = @tagName(Feature.bulk_memory),
|
||||
.llvm_name = "bulk-memory",
|
||||
.description = "Enable bulk memory operations",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.exception_handling)] = .{
|
||||
.index = @enumToInt(Feature.exception_handling),
|
||||
.name = @tagName(Feature.exception_handling),
|
||||
.llvm_name = "exception-handling",
|
||||
.description = "Enable Wasm exception handling",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.multivalue)] = .{
|
||||
.index = @enumToInt(Feature.multivalue),
|
||||
.name = @tagName(Feature.multivalue),
|
||||
.llvm_name = "multivalue",
|
||||
.description = "Enable multivalue blocks, instructions, and functions",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.mutable_globals)] = .{
|
||||
.index = @enumToInt(Feature.mutable_globals),
|
||||
.name = @tagName(Feature.mutable_globals),
|
||||
.llvm_name = "mutable-globals",
|
||||
.description = "Enable mutable globals",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.nontrapping_fptoint)] = .{
|
||||
.index = @enumToInt(Feature.nontrapping_fptoint),
|
||||
.name = @tagName(Feature.nontrapping_fptoint),
|
||||
.llvm_name = "nontrapping-fptoint",
|
||||
.description = "Enable non-trapping float-to-int conversion operators",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.sign_ext)] = .{
|
||||
.index = @enumToInt(Feature.sign_ext),
|
||||
.name = @tagName(Feature.sign_ext),
|
||||
.llvm_name = "sign-ext",
|
||||
.description = "Enable sign extension operators",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.simd128)] = .{
|
||||
.index = @enumToInt(Feature.simd128),
|
||||
.name = @tagName(Feature.simd128),
|
||||
.llvm_name = "simd128",
|
||||
.description = "Enable 128-bit SIMD",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.tail_call)] = .{
|
||||
.index = @enumToInt(Feature.tail_call),
|
||||
.name = @tagName(Feature.tail_call),
|
||||
.llvm_name = "tail-call",
|
||||
.description = "Enable tail call instructions",
|
||||
.dependencies = featureSet(&[_]Feature{}),
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{}),
|
||||
};
|
||||
result[@enumToInt(Feature.unimplemented_simd128)] = .{
|
||||
.index = @enumToInt(Feature.unimplemented_simd128),
|
||||
.name = @tagName(Feature.unimplemented_simd128),
|
||||
.llvm_name = "unimplemented-simd128",
|
||||
.description = "Enable 128-bit SIMD not yet implemented in engines",
|
||||
.dependencies = featureSet(&[_]Feature{
|
||||
.dependencies = sparseFeatureSet(&[_]Feature{
|
||||
.simd128,
|
||||
}),
|
||||
};
|
||||
const ti = @typeInfo(Feature);
|
||||
for (result) |*elem, i| {
|
||||
elem.index = i;
|
||||
elem.name = ti.Enum.fields[i].name;
|
||||
elem.dependencies.initAsDependencies(i, &result);
|
||||
}
|
||||
break :blk result;
|
||||
};
|
||||
|
||||
@@ -99,7 +85,7 @@ pub const cpu = struct {
|
||||
pub const bleeding_edge = Cpu{
|
||||
.name = "bleeding_edge",
|
||||
.llvm_name = "bleeding-edge",
|
||||
.features = featureSet(&[_]Feature{
|
||||
.features = featureSet(&all_features, &[_]Feature{
|
||||
.atomics,
|
||||
.mutable_globals,
|
||||
.nontrapping_fptoint,
|
||||
@@ -110,12 +96,12 @@ pub const cpu = struct {
|
||||
pub const generic = Cpu{
|
||||
.name = "generic",
|
||||
.llvm_name = "generic",
|
||||
.features = featureSet(&[_]Feature{}),
|
||||
.features = featureSet(&all_features, &[_]Feature{}),
|
||||
};
|
||||
pub const mvp = Cpu{
|
||||
.name = "mvp",
|
||||
.llvm_name = "mvp",
|
||||
.features = featureSet(&[_]Feature{}),
|
||||
.features = featureSet(&all_features, &[_]Feature{}),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user