mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Attempt supporting setjmp on MSVC
This commit is contained in:
committed by
Christoffer Lerno
parent
eaaa5362a5
commit
de4bfe470e
@@ -841,6 +841,7 @@ typedef enum
|
||||
BUILTIN_FLOOR,
|
||||
BUILTIN_FMA,
|
||||
BUILTIN_FMULADD,
|
||||
BUILTIN_FRAMEADDRESS,
|
||||
BUILTIN_FSHL,
|
||||
BUILTIN_FSHR,
|
||||
BUILTIN_GET_ROUNDING_MODE,
|
||||
|
||||
@@ -637,6 +637,7 @@ static void llvm_codegen_setup()
|
||||
intrinsic_id.floor = lookup_intrinsic("llvm.floor");
|
||||
intrinsic_id.flt_rounds = lookup_intrinsic("llvm.flt.rounds");
|
||||
intrinsic_id.fma = lookup_intrinsic("llvm.fma");
|
||||
intrinsic_id.frameaddress = lookup_intrinsic("llvm.frameaddress");
|
||||
intrinsic_id.fshl = lookup_intrinsic("llvm.fshl");
|
||||
intrinsic_id.fshr = lookup_intrinsic("llvm.fshr");
|
||||
intrinsic_id.lifetime_end = lookup_intrinsic("llvm.lifetime.end");
|
||||
|
||||
@@ -449,6 +449,14 @@ void llvm_emit_builtin_call(GenContext *c, BEValue *result_value, Expr *expr)
|
||||
case BUILTIN_SHUFFLEVECTOR:
|
||||
llvm_emit_shufflevector(c, result_value, expr);
|
||||
return;
|
||||
case BUILTIN_FRAMEADDRESS:
|
||||
{
|
||||
LLVMTypeRef type[2] = { llvm_get_type(c, type_voidptr), llvm_get_type(c, type_int) };
|
||||
LLVMValueRef value = LLVMConstNull(type[1]);
|
||||
value = llvm_emit_call_intrinsic(c, intrinsic_id.frameaddress, type, 1, &value, 1);
|
||||
llvm_value_set(result_value, value, expr->type);
|
||||
return;
|
||||
}
|
||||
case BUILTIN_REVERSE:
|
||||
llvm_emit_reverse(c, result_value, expr);
|
||||
return;
|
||||
|
||||
@@ -134,6 +134,7 @@ typedef struct
|
||||
unsigned floor;
|
||||
unsigned flt_rounds;
|
||||
unsigned fma;
|
||||
unsigned frameaddress;
|
||||
unsigned fshl;
|
||||
unsigned fshr;
|
||||
unsigned lifetime_end;
|
||||
|
||||
@@ -284,6 +284,9 @@ bool sema_expr_analyse_builtin_call(SemaContext *context, Expr *expr)
|
||||
case BUILTIN_GET_ROUNDING_MODE:
|
||||
rtype = type_int;
|
||||
break;
|
||||
case BUILTIN_FRAMEADDRESS:
|
||||
rtype = type_voidptr;
|
||||
break;
|
||||
case BUILTIN_SET_ROUNDING_MODE:
|
||||
if (!sema_check_builtin_args(args,
|
||||
(BuiltinArg[]) { BA_INTEGER },
|
||||
@@ -551,6 +554,7 @@ static inline unsigned builtin_expected_args(BuiltinFunction func)
|
||||
case BUILTIN_SYSCLOCK:
|
||||
case BUILTIN_TRAP:
|
||||
case BUILTIN_UNREACHABLE:
|
||||
case BUILTIN_FRAMEADDRESS:
|
||||
return 0;
|
||||
case BUILTIN_ABS:
|
||||
case BUILTIN_BITREVERSE:
|
||||
|
||||
@@ -203,6 +203,7 @@ void symtab_init(uint32_t capacity)
|
||||
builtin_list[BUILTIN_FLOOR] = KW_DEF("floor");
|
||||
builtin_list[BUILTIN_FMA] = KW_DEF("fma");
|
||||
builtin_list[BUILTIN_FMULADD] = KW_DEF("fmuladd");
|
||||
builtin_list[BUILTIN_FRAMEADDRESS] = KW_DEF("frameaddress");
|
||||
builtin_list[BUILTIN_FSHL] = KW_DEF("fshl");
|
||||
builtin_list[BUILTIN_FSHR] = KW_DEF("fshr");
|
||||
builtin_list[BUILTIN_GET_ROUNDING_MODE] = KW_DEF("get_rounding_mode");
|
||||
|
||||
Reference in New Issue
Block a user