mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-06 04:57:55 +00:00
@(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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user