Update naming to cpu-flags

This commit is contained in:
Christoffer Lerno
2025-10-27 14:08:21 +01:00
parent c10d449e43
commit c483c3b75f
7 changed files with 24 additions and 24 deletions

View File

@@ -17,7 +17,7 @@
- Rename `@extern` to `@cname`, deprecating the old name #2493.
- Allow `(Foo)0` bitstruct casts even if type sizes do not match.
- The option `--riscvfloat` renamed `--riscv-abi`.
- Add initial `--cpu-features` allowing fine grained control over CPU features.
- Add initial `--cpu-flags` allowing fine grained control over CPU features.
### Fixes
- Bug in `io::write_using_write_byte`.

View File

@@ -13,7 +13,7 @@
],
"dependency-search-paths": [ "./lib" ],
"dependencies": ["clib", "clib2"],
"cpu-flags": ",,",
"features": ["ABCD"],
"exec": ["scriptme.c3 myarg"],
// c sources

View File

@@ -586,7 +586,7 @@ typedef struct BuildOptions_
SanitizeMode sanitize_mode;
uint32_t max_vector_size;
uint32_t max_stack_object_size;
const char *cpu_features;
const char *cpu_flags;
uint32_t max_macro_iterations;
bool print_keywords;
bool print_attributes;
@@ -727,7 +727,7 @@ typedef struct
ArchOsTarget arch_os_target;
CompilerBackend backend;
LinkerType linker_type;
const char *cpu_features;
const char *cpu_flags;
uint32_t symtab_size;
uint32_t max_vector_size;
uint32_t max_stack_object_size;

View File

@@ -974,17 +974,17 @@ static void parse_option(BuildOptions *options)
options->riscv_abi = parse_opt_select(RiscvAbi, argopt, riscv_abi);
return;
}
if (match_longopt("cpu-features"))
if (match_longopt("cpu-flags"))
{
if (at_end() || next_is_opt()) error_exit("error: --cpu-features expected a comma-separated list, like '+a,-b,+x'.");
if (at_end() || next_is_opt()) error_exit("error: --cpu-flags expected a comma-separated list, like '+a,-b,+x'.");
scratch_buffer_clear();
if (options->cpu_features)
if (options->cpu_flags)
{
scratch_buffer_append(options->cpu_features);
scratch_buffer_append(options->cpu_flags);
scratch_buffer_append_char(',');
}
scratch_buffer_append(next_arg());
options->cpu_features = scratch_buffer_copy();
options->cpu_flags = scratch_buffer_copy();
return;
}
if (match_longopt("max-stack-object-size"))

View File

@@ -447,17 +447,17 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
OVERRIDE_IF_SET(android.ndk_path);
OVERRIDE_IF_SET(android.api_version);
if (options->cpu_features)
if (options->cpu_flags)
{
if (target->cpu_features)
if (target->cpu_flags)
{
scratch_buffer_clear();
scratch_buffer_printf("%s,%s", target->cpu_features, options->cpu_features);
target->cpu_features = scratch_buffer_copy();
scratch_buffer_printf("%s,%s", target->cpu_flags, options->cpu_flags);
target->cpu_flags = scratch_buffer_copy();
}
else
{
target->cpu_features = options->cpu_features;
target->cpu_flags = options->cpu_flags;
}
}
if (!target->max_vector_size) target->max_vector_size = DEFAULT_VECTOR_WIDTH;

View File

@@ -195,15 +195,15 @@ static void load_into_build_target(BuildParseContext context, JSONObject *json,
const char *cpu_flags = get_optional_string(context, json, "cpu-flags");
if (cpu_flags)
{
if (target->cpu_features)
if (target->cpu_flags)
{
scratch_buffer_clear();
scratch_buffer_printf("%s,%s", target->cpu_features, cpu_flags);
target->cpu_features = scratch_buffer_copy();
scratch_buffer_printf("%s,%s", target->cpu_flags, cpu_flags);
target->cpu_flags = scratch_buffer_copy();
}
else
{
target->cpu_features = cpu_flags;
target->cpu_flags = cpu_flags;
}
}
if (context.target)
@@ -215,7 +215,7 @@ static void load_into_build_target(BuildParseContext context, JSONObject *json,
{
error_exit("Error reading %s: 'cpu-flags' and 'cpu-flags-override' cannot be combined.", context.file);
}
target->cpu_features = cpu_flags_override;
target->cpu_flags = cpu_flags_override;
}
}

View File

@@ -368,7 +368,7 @@ static inline void target_setup_aarch64_abi(void)
cpu_features_add_feature_single(&features, AARCH64_FEAT_RDM);
cpu_features_add_feature_single(&features, AARCH64_FEAT_FP_ARMV8);
cpu_features_add_feature_single(&features, AARCH64_FEAT_NEON);
update_cpu_features(compiler.build.cpu_features, &features, aarch64_feature_name, AARCH64_FEATURE_LAST);
update_cpu_features(compiler.build.cpu_flags, &features, aarch64_feature_name, AARCH64_FEATURE_LAST);
cpu_features_set_to_features(features, cpu_feature_zero, NULL, aarch64_feature_name, AARCH64_FEATURE_LAST);
}
@@ -393,7 +393,7 @@ static inline void target_setup_arm_abi(void)
cpu_features_add_feature_single(&features, ARM_FEAT_VFP2);
cpu_features_add_feature_single(&features, ARM_FEAT_VFP2SP);
update_cpu_features(compiler.build.cpu_features, &features, arm_feature_name, ARM_FEAT_LAST);
update_cpu_features(compiler.build.cpu_flags, &features, arm_feature_name, ARM_FEAT_LAST);
cpu_features_set_to_features(features, cpu_feature_zero, NULL, arm_feature_name, ARM_FEAT_LAST);
if (compiler.platform.object_format == OBJ_FORMAT_MACHO)
{
@@ -1093,7 +1093,7 @@ static inline void target_setup_x64_abi(BuildTarget *target)
if (target->feature.pass_win64_simd_as_arrays == WIN64_SIMD_ARRAY) compiler.platform.x64.win64_simd_as_array = true;
if (compiler.platform.x64.soft_float) cpu_features_add_feature_single(&cpu_features, X86_FEAT_SOFT_FLOAT);
update_cpu_features(compiler.build.cpu_features, &cpu_features, x86_feature_name, X86_FEATURE_LAST);
update_cpu_features(compiler.build.cpu_flags, &cpu_features, x86_feature_name, X86_FEATURE_LAST);
x86features_as_diff_to_scratch(cpu_features, cpu_set);
@@ -1998,7 +1998,7 @@ static void target_setup_wasm_abi(BuildTarget *target)
cpu_features_add_feature_single(&features, WASM_FEAT_NONTRAPPING_FPTORINT);
cpu_features_add_feature_single(&features, WASM_FEAT_REFERENCE_TYPES);
cpu_features_add_feature_single(&features, WASM_FEAT_SIGN_EXT);
update_cpu_features(target->cpu_features, &features, wasm_feature_name, WASM_FEATURE_LAST);
update_cpu_features(target->cpu_flags, &features, wasm_feature_name, WASM_FEATURE_LAST);
cpu_features_set_to_features(features, cpu_feature_zero, NULL, wasm_feature_name, WASM_FEATURE_LAST);
}
@@ -2026,7 +2026,7 @@ static void target_setup_riscv_abi(BuildTarget *target)
{
cpu_features_add_feature_single(&features, RISCV_FEAT_32BIT);
}
update_cpu_features(target->cpu_features, &features, riscv_feature_name, RISCV_FEATURE_LAST);
update_cpu_features(target->cpu_flags, &features, riscv_feature_name, RISCV_FEATURE_LAST);
cpu_features_set_to_features(features, cpu_feature_zero, NULL, riscv_feature_name, RISCV_FEATURE_LAST);
}