From bd43a4040d764909cd441063ece569006d265b98 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 24 Feb 2024 01:48:49 -0500 Subject: stub mk_tmp --- compiler.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler.c b/compiler.c index 04fce43..504ba03 100644 --- a/compiler.c +++ b/compiler.c @@ -3552,8 +3552,13 @@ int _scope_avail_reg(Scope *s) { } // Creates a new tmp variable from an existing variable -Variable scope_mk_tmp(Variable *v) { - return *v; +Variable scope_mk_tmp(Scope *s, Variable *v) { + Variable out = var_copy(v); + if (is_inbuilt(v->type->name) || _var_ptr_type(v) < 1) { + int regs = _scope_avail_reg(s); + } + // TODO + return out; } // Checks if a variable is a tmp variable in the scope @@ -3839,7 +3844,7 @@ Variable _eval(Scope *s, CompData *data, Vector *tokens, size_t start, size_t en Variable rhs = _eval(s, data, tokens, op_pos + 1, end); out = _eval(s, data, tokens, start, op_pos); if (op != 10 && !scope_is_tmp(&out)) { - out = scope_mk_tmp(&out); + out = scope_mk_tmp(s, &out); } if (strlen(op_token->data) == 1) { -- cgit v1.2.3