From 01af44f3c81b90e4e9472d2ea22aeb5038169694 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Mon, 25 Jun 2012 14:14:34 +0200 Subject: [PATCH] ir_function_allocate_locals prototype --- ir.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ir.c b/ir.c index c68fc8a..4c03899 100644 --- a/ir.c +++ b/ir.c @@ -138,6 +138,7 @@ ir_value* ir_builder_create_global(ir_builder *self, const char *name, int vtype bool ir_function_naive_phi(ir_function*); void ir_function_enumerate(ir_function*); bool ir_function_calculate_liferanges(ir_function*); +bool ir_function_allocate_locals(ir_function*); ir_function* ir_function_new(ir_builder* owner) { @@ -223,6 +224,9 @@ bool ir_function_finalize(ir_function *self) if (!ir_function_calculate_liferanges(self)) return false; + + if (!ir_function_allocate_locals(self)) + return false; return true; } @@ -1414,6 +1418,16 @@ bool ir_function_calculate_liferanges(ir_function *self) return true; } +/* Local-value allocator + * After finishing creating the liferange of all values used in a function + * we can allocate their global-positions. + * This is the counterpart to register-allocation in register machines. + */ +bool ir_function_allocate_locals(ir_function *self) +{ + return false; +} + /* Get information about which operand * is read from, or written to. */ @@ -1983,8 +1997,8 @@ static bool gen_global_function(ir_builder *ir, ir_value *global) fun.argsize[i] = 1; } - fun.locals = irfun->locals_count; fun.firstlocal = code_globals_elements; + fun.locals = irfun->locals_count; for (i = 0; i < irfun->locals_count; ++i) { if (!ir_builder_gen_global(ir, irfun->locals[i])) { printf("Failed to generate global %s\n", irfun->locals[i]->name); -- 2.39.2