aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-30 14:53:12 +0100
committergingerBill <bill@gingerbill.org>2022-05-30 14:53:12 +0100
commitf3aefbc4434b92fc3fda74c942c953b08dd18a62 (patch)
treed13281680a7cd14ce92630cb9d3a49c984b2a888 /src/check_decl.cpp
parentcef022539ebd41a4a80707f1a702e09e6748ade0 (diff)
`@(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
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 62a1e2555..d4818892b 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -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: