Update math and math/linalg; add "pure_none" calling convention

This commit is contained in:
gingerBill
2020-09-10 15:00:19 +01:00
parent 7e625f6ee7
commit c1149dbdee
14 changed files with 1422 additions and 360 deletions
+9
View File
@@ -1197,6 +1197,15 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty
ctx->curr_proc_sig = type;
ctx->curr_proc_calling_convention = type->Proc.calling_convention;
switch (type->Proc.calling_convention) {
case ProcCC_None:
error(body, "Procedures with the calling convention \"none\" are not allowed a body");
break;
case ProcCC_PureNone:
error(body, "Procedures with the calling convention \"pure_none\" are not allowed a body");
break;
}
ast_node(bs, BlockStmt, body);
Array<ProcUsingVar> using_entities = {};
+1 -1
View File
@@ -7655,7 +7655,7 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *call, Ast *pr
{
if (c->curr_proc_calling_convention == ProcCC_Pure) {
if (pt->kind == Type_Proc && pt->Proc.calling_convention != ProcCC_Pure) {
if (pt->kind == Type_Proc && pt->Proc.calling_convention != ProcCC_Pure && pt->Proc.calling_convention != ProcCC_PureNone) {
error(call, "Only \"pure\" procedure calls are allowed within a \"pure\" procedure");
}
}
+3 -3
View File
@@ -2200,7 +2200,7 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type, ProcCall
return new_type;
}
if (cc == ProcCC_None) {
if (cc == ProcCC_None || cc == ProcCC_PureNone) {
return new_type;
}
@@ -2335,7 +2335,7 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type, ProcCal
if (build_context.ODIN_OS == "windows") {
if (build_context.ODIN_ARCH == "amd64") {
if (is_type_integer_128bit(single_type)) {
if (cc == ProcCC_None) {
if (cc == ProcCC_None || cc == ProcCC_PureNone) {
return original_type;
} else {
return alloc_type_simd_vector(2, t_u64);
@@ -2401,7 +2401,7 @@ bool abi_compat_return_by_pointer(gbAllocator a, ProcCallingConvention cc, Type
if (abi_return_type == nullptr) {
return false;
}
if (cc == ProcCC_None) {
if (cc == ProcCC_None || cc == ProcCC_PureNone) {
return false;
}
+1
View File
@@ -1440,6 +1440,7 @@ void ir_print_calling_convention(irFileBuffer *f, irModule *m, ProcCallingConven
case ProcCC_StdCall: ir_write_str_lit(f, "cc 64 "); break;
case ProcCC_FastCall: ir_write_str_lit(f, "cc 65 "); break;
case ProcCC_None: ir_write_str_lit(f, ""); break;
case ProcCC_PureNone: ir_write_str_lit(f, ""); break;
default: GB_PANIC("unknown calling convention: %d", cc);
}
}
+1
View File
@@ -2991,6 +2991,7 @@ ProcCallingConvention string_to_calling_convention(String s) {
if (s == "odin") return ProcCC_Odin;
if (s == "contextless") return ProcCC_Contextless;
if (s == "pure") return ProcCC_Pure;
if (s == "pure_none") return ProcCC_PureNone;
if (s == "cdecl") return ProcCC_CDecl;
if (s == "c") return ProcCC_CDecl;
if (s == "stdcall") return ProcCC_StdCall;
+8 -7
View File
@@ -178,14 +178,15 @@ enum ProcTag {
enum ProcCallingConvention {
ProcCC_Invalid = 0,
ProcCC_Odin,
ProcCC_Contextless,
ProcCC_Pure,
ProcCC_CDecl,
ProcCC_StdCall,
ProcCC_FastCall,
ProcCC_Odin = 1,
ProcCC_Contextless = 2,
ProcCC_Pure = 3,
ProcCC_CDecl = 4,
ProcCC_StdCall = 5,
ProcCC_FastCall = 6,
ProcCC_None,
ProcCC_None = 7,
ProcCC_PureNone = 8,
ProcCC_MAX,
+3
View File
@@ -3556,6 +3556,9 @@ gbString write_type_to_string(gbString str, Type *type) {
case ProcCC_FastCall:
str = gb_string_appendc(str, " \"fastcall\" ");
break;
case ProcCC_PureNone:
str = gb_string_appendc(str, " \"pure_none\" ");
break;
case ProcCC_None:
str = gb_string_appendc(str, " \"none\" ");
break;