Introduce IR_PREALLOCATED_STACK flag

This commit is contained in:
Dmitry Stogov 2022-05-17 13:15:41 +03:00
parent 1e7059d7e0
commit da5de8a390
2 changed files with 14 additions and 12 deletions

23
ir.h
View File

@ -471,20 +471,21 @@ typedef struct _ir_use_list {
ir_ref count;
} ir_use_list;
#define IR_FUNCTION (1<<0)
#define IR_USE_FRAME_POINTER (1<<1)
#define IR_IRREDUCIBLE_CFG (1<<2)
#define IR_FUNCTION (1<<0)
#define IR_USE_FRAME_POINTER (1<<1)
#define IR_PREALLOCATED_STACK (1<<2)
#define IR_IRREDUCIBLE_CFG (1<<3)
#define IR_OPT_FOLDING (1<<16)
#define IR_OPT_CODEGEN (1<<17)
#define IR_OPT_IN_SCCP (1<<18)
#define IR_LINEAR (1<<19)
#define IR_GEN_NATIVE (1<<20)
#define IR_GEN_C (1<<22)
#define IR_OPT_FOLDING (1<<16)
#define IR_OPT_CODEGEN (1<<17)
#define IR_OPT_IN_SCCP (1<<18)
#define IR_LINEAR (1<<19)
#define IR_GEN_NATIVE (1<<20)
#define IR_GEN_C (1<<22)
/* x86 related */
#define IR_AVX (1<<24)
#define IR_HAS_CALLS (1<<25)
#define IR_AVX (1<<24)
#define IR_HAS_CALLS (1<<25)
/* debug relted */
#ifdef IR_DEBUG

View File

@ -3613,7 +3613,7 @@ static int32_t ir_emit_arguments(ir_ctx *ctx, ir_ref def, ir_insn *insn, ir_reg
bool has_mem_const_args = 0;
ir_reg tmp_fp_reg = IR_REG_FP_LAST; /* Temporary register for FP loads and swap */
if (0) {
if (insn->op == IR_CALL && (ctx->flags & IR_PREALLOCATED_STACK)) {
// TODO: support for preallocated stack
used_stack = 0;
} else {
@ -4401,6 +4401,7 @@ static void ir_calc_stack_frame_size(ir_ctx *ctx, ir_backend_data *data)
data->stack_frame_alignment += 8;
}
} else {
// TODO: Preallocate stack for calls (ctx->flags |= IR_PREALLOCATED_STACK)
while (IR_ALIGNED_SIZE(data->stack_frame_size + sizeof(void*), 16) != data->stack_frame_size + sizeof(void*)) {
data->stack_frame_size += 8;
data->stack_frame_alignment += 8;