mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-05 04:27:51 +00:00
Move matrix compiler builtins to intrinsics; alias within core_builtin_matrix.odin
This commit is contained in:
@@ -3,6 +3,15 @@ package runtime
|
||||
import "core:intrinsics"
|
||||
_ :: intrinsics
|
||||
|
||||
@(builtin)
|
||||
transpose :: intrinsics.transpose
|
||||
@(builtin)
|
||||
outer_product :: intrinsics.outer_product
|
||||
@(builtin)
|
||||
hadamard_product :: intrinsics.hadamard_product
|
||||
@(builtin)
|
||||
matrix_flatten :: intrinsics.matrix_flatten
|
||||
|
||||
|
||||
@(builtin)
|
||||
determinant :: proc{
|
||||
|
||||
@@ -4577,7 +4577,8 @@ gb_internal bool is_entity_declared_for_selector(Entity *entity, Scope *import_s
|
||||
if (entity->kind == Entity_Builtin) {
|
||||
// NOTE(bill): Builtin's are in the universal scope which is part of every scopes hierarchy
|
||||
// This means that we should just ignore the found result through it
|
||||
*allow_builtin = entity->scope == import_scope || entity->scope != builtin_pkg->scope;
|
||||
*allow_builtin = entity->scope == import_scope ||
|
||||
(entity->scope != builtin_pkg->scope && entity->scope != intrinsics_pkg->scope);
|
||||
} else if ((entity->scope->flags&ScopeFlag_Global) == ScopeFlag_Global && (import_scope->flags&ScopeFlag_Global) == 0) {
|
||||
is_declared = false;
|
||||
}
|
||||
|
||||
@@ -3835,6 +3835,7 @@ gb_internal void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<
|
||||
case Entity_ProcGroup:
|
||||
case Entity_Procedure:
|
||||
case Entity_TypeName:
|
||||
case Entity_Constant:
|
||||
// Okay
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -34,11 +34,6 @@ enum BuiltinProcId {
|
||||
|
||||
BuiltinProc_soa_zip,
|
||||
BuiltinProc_soa_unzip,
|
||||
|
||||
BuiltinProc_transpose,
|
||||
BuiltinProc_outer_product,
|
||||
BuiltinProc_hadamard_product,
|
||||
BuiltinProc_matrix_flatten,
|
||||
|
||||
BuiltinProc_unreachable,
|
||||
|
||||
@@ -48,6 +43,11 @@ enum BuiltinProcId {
|
||||
|
||||
// "Intrinsics"
|
||||
BuiltinProc_is_package_imported,
|
||||
|
||||
BuiltinProc_transpose,
|
||||
BuiltinProc_outer_product,
|
||||
BuiltinProc_hadamard_product,
|
||||
BuiltinProc_matrix_flatten,
|
||||
|
||||
BuiltinProc_soa_struct,
|
||||
|
||||
@@ -341,11 +341,6 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_COUNT] = {
|
||||
|
||||
{STR_LIT("soa_zip"), 1, true, Expr_Expr, BuiltinProcPkg_builtin},
|
||||
{STR_LIT("soa_unzip"), 1, false, Expr_Expr, BuiltinProcPkg_builtin},
|
||||
|
||||
{STR_LIT("transpose"), 1, false, Expr_Expr, BuiltinProcPkg_builtin},
|
||||
{STR_LIT("outer_product"), 2, false, Expr_Expr, BuiltinProcPkg_builtin},
|
||||
{STR_LIT("hadamard_product"), 2, false, Expr_Expr, BuiltinProcPkg_builtin},
|
||||
{STR_LIT("matrix_flatten"), 1, false, Expr_Expr, BuiltinProcPkg_builtin},
|
||||
|
||||
{STR_LIT("unreachable"), 0, false, Expr_Expr, BuiltinProcPkg_builtin, /*diverging*/true},
|
||||
|
||||
@@ -356,6 +351,11 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_COUNT] = {
|
||||
|
||||
// "Intrinsics"
|
||||
{STR_LIT("is_package_imported"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
|
||||
{STR_LIT("transpose"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
{STR_LIT("outer_product"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
{STR_LIT("hadamard_product"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
{STR_LIT("matrix_flatten"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
|
||||
{STR_LIT("soa_struct"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics}, // Type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user