Support for calling FASTCALL variable functions.

Currutly this done through BITCAST hack.
It may make sense to implement full support for function prototypes.
This commit is contained in:
Dmitry Stogov 2022-09-28 20:48:35 +03:00
parent 36b59306ee
commit a1361d77ba
2 changed files with 9 additions and 2 deletions

2
TODO
View File

@ -1,5 +1,7 @@
- va_arg nodes
- BSTART, BEND nodes (to free data allocated by ALLOCA)
- Full support for function prototypes ???
(now we may only set "fastcall" calling convention for constants or for variables through BITCAST)
- VLOAD, VSTORE -> SSA

View File

@ -469,8 +469,13 @@ const char *ir_reg_name(int8_t reg, ir_type type)
#if !defined(_WIN64) && !defined(__x86_64__)
static bool ir_is_fastcall(ir_ctx *ctx, ir_insn *insn)
{
if (sizeof(void*) == 4 && IR_IS_CONST_REF(insn->op2) && (ctx->ir_base[insn->op2].const_flags & IR_CONST_FASTCALL_FUNC)) {
return 1;
if (sizeof(void*) == 4) {
if (IR_IS_CONST_REF(insn->op2)) {
return (ctx->ir_base[insn->op2].const_flags & IR_CONST_FASTCALL_FUNC) != 0;
} else if (ctx->ir_base[insn->op2].op == IR_BITCAST) {
return (ctx->ir_base[insn->op2].op2 & IR_CONST_FASTCALL_FUNC) != 0;
}
return 0;
}
return 0;
}