mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
ir_init: Accept flags as an additional arguments
Signed-off-by: Anatol Belski <ab@php.net>
This commit is contained in:
parent
b701684704
commit
d0b4f108ee
4
ir.c
4
ir.c
@ -282,7 +282,7 @@ void ir_truncate(ir_ctx *ctx)
|
|||||||
ctx->ir_base = buf + ctx->consts_limit;
|
ctx->ir_base = buf + ctx->consts_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ir_init(ir_ctx *ctx, ir_ref consts_limit, ir_ref insns_limit)
|
void ir_init(ir_ctx *ctx, uint32_t flags, ir_ref consts_limit, ir_ref insns_limit)
|
||||||
{
|
{
|
||||||
ir_insn *buf;
|
ir_insn *buf;
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ void ir_init(ir_ctx *ctx, ir_ref consts_limit, ir_ref insns_limit)
|
|||||||
ctx->consts_count = -(IR_TRUE - 1);
|
ctx->consts_count = -(IR_TRUE - 1);
|
||||||
ctx->consts_limit = consts_limit;
|
ctx->consts_limit = consts_limit;
|
||||||
ctx->fold_cse_limit = IR_UNUSED + 1;
|
ctx->fold_cse_limit = IR_UNUSED + 1;
|
||||||
ctx->flags = 0;
|
ctx->flags = flags;
|
||||||
|
|
||||||
ctx->binding = NULL;
|
ctx->binding = NULL;
|
||||||
|
|
||||||
|
2
ir.h
2
ir.h
@ -557,7 +557,7 @@ struct _ir_ctx {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Basic IR Construction API (implementation in ir.c) */
|
/* Basic IR Construction API (implementation in ir.c) */
|
||||||
void ir_init(ir_ctx *ctx, ir_ref consts_limit, ir_ref insns_limit);
|
void ir_init(ir_ctx *ctx, uint32_t flags, ir_ref consts_limit, ir_ref insns_limit);
|
||||||
void ir_free(ir_ctx *ctx);
|
void ir_free(ir_ctx *ctx);
|
||||||
void ir_truncate(ir_ctx *ctx);
|
void ir_truncate(ir_ctx *ctx);
|
||||||
|
|
||||||
|
3
ir_gcm.c
3
ir_gcm.c
@ -658,9 +658,8 @@ restart:
|
|||||||
|
|
||||||
ir_mem_free(_prev);
|
ir_mem_free(_prev);
|
||||||
|
|
||||||
ir_init(&new_ctx, consts_count, insns_count);
|
ir_init(&new_ctx, ctx->flags, consts_count, insns_count);
|
||||||
new_ctx.insns_count = insns_count;
|
new_ctx.insns_count = insns_count;
|
||||||
new_ctx.flags = ctx->flags;
|
|
||||||
new_ctx.spill_base = ctx->spill_base;
|
new_ctx.spill_base = ctx->spill_base;
|
||||||
new_ctx.fixed_stack_red_zone = ctx->fixed_stack_red_zone;
|
new_ctx.fixed_stack_red_zone = ctx->fixed_stack_red_zone;
|
||||||
new_ctx.fixed_stack_frame_size = ctx->fixed_stack_frame_size;
|
new_ctx.fixed_stack_frame_size = ctx->fixed_stack_frame_size;
|
||||||
|
11
ir_main.c
11
ir_main.c
@ -381,19 +381,18 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
ir_loader_init();
|
ir_loader_init();
|
||||||
|
|
||||||
ir_init(&ctx, 256, 1024);
|
uint32_t flags = IR_FUNCTION | mflags;
|
||||||
ctx.flags |= IR_FUNCTION;
|
|
||||||
ctx.flags |= mflags;
|
|
||||||
|
|
||||||
if (opt_level > 0) {
|
if (opt_level > 0) {
|
||||||
ctx.flags |= IR_OPT_FOLDING | IR_OPT_CFG | IR_OPT_CODEGEN;
|
flags |= IR_OPT_FOLDING | IR_OPT_CFG | IR_OPT_CODEGEN;
|
||||||
}
|
}
|
||||||
if (emit_c) {
|
if (emit_c) {
|
||||||
ctx.flags |= IR_GEN_C;
|
flags |= IR_GEN_C;
|
||||||
}
|
}
|
||||||
if (dump_asm || run) {
|
if (dump_asm || run) {
|
||||||
ctx.flags |= IR_GEN_NATIVE;
|
flags |= IR_GEN_NATIVE;
|
||||||
}
|
}
|
||||||
|
ir_init(&ctx, flags, 256, 1024);
|
||||||
ctx.fixed_regset = ~debug_regset;
|
ctx.fixed_regset = ~debug_regset;
|
||||||
|
|
||||||
if (!ir_load(&ctx, f)) {
|
if (!ir_load(&ctx, f)) {
|
||||||
|
@ -134,12 +134,11 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ir_init(&ctx, 256, 1024);
|
uint32_t flags = IR_FUNCTION | mflags;
|
||||||
ctx.flags |= IR_FUNCTION;
|
|
||||||
ctx.flags |= mflags;
|
|
||||||
if (opt_level > 0) {
|
if (opt_level > 0) {
|
||||||
ctx.flags |= IR_OPT_FOLDING | IR_OPT_CFG | IR_OPT_CODEGEN;
|
flags |= IR_OPT_FOLDING | IR_OPT_CFG | IR_OPT_CODEGEN;
|
||||||
}
|
}
|
||||||
|
ir_init(&ctx, flags, 256, 1024);
|
||||||
ctx.fixed_regset = ~debug_regset;
|
ctx.fixed_regset = ~debug_regset;
|
||||||
gen_mandelbrot(&ctx);
|
gen_mandelbrot(&ctx);
|
||||||
// ir_save(&ctx, stderr);
|
// ir_save(&ctx, stderr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user