mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-17 11:22:22 -07: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:
@@ -169,6 +169,19 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool ignore_body)
|
||||
}
|
||||
}
|
||||
|
||||
if (!entity->Procedure.target_feature_disabled &&
|
||||
entity->Procedure.target_feature.len != 0) {
|
||||
auto features = split_by_comma(entity->Procedure.target_feature);
|
||||
for_array(i, features) {
|
||||
String feature = features[i];
|
||||
LLVMAttributeRef ref = LLVMCreateStringAttribute(
|
||||
m->ctx,
|
||||
cast(char const *)feature.text, cast(unsigned)feature.len,
|
||||
"", 0);
|
||||
LLVMAddAttributeAtIndex(p->value, LLVMAttributeIndex_FunctionIndex, ref);
|
||||
}
|
||||
}
|
||||
|
||||
if (entity->flags & EntityFlag_Cold) {
|
||||
lb_add_attribute_to_proc(m, p->value, "cold");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user