@(require_target_feature=<string>) @(enable_target_feature=<string>)

require_target_feature - required by the target micro-architecture
enable_target_feature - will be enabled for the specified procedure only
This commit is contained in:
gingerBill
2022-05-30 14:53:12 +01:00
parent cef022539e
commit f3aefbc443
16 changed files with 533 additions and 9 deletions

View File

@@ -899,6 +899,18 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
}
}
if (ac.require_target_feature.len != 0 && ac.enable_target_feature.len != 0) {
error(e->token, "Attributes @(require_target_feature=...) and @(enable_target_feature=...) cannot be used together");
} else if (ac.require_target_feature.len != 0) {
if (check_target_feature_is_enabled(e->token.pos, ac.require_target_feature)) {
e->Procedure.target_feature = ac.require_target_feature;
} else {
e->Procedure.target_feature_disabled = true;
}
} else if (ac.enable_target_feature.len != 0) {
enable_target_feature(e->token.pos, ac.enable_target_feature);
e->Procedure.target_feature = ac.enable_target_feature;
}
switch (e->Procedure.optimization_mode) {
case ProcedureOptimizationMode_None: