summaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-02-24 01:48:49 -0500
committerKyle Gunger <kgunger12@gmail.com>2024-02-24 01:48:49 -0500
commitbd43a4040d764909cd441063ece569006d265b98 (patch)
tree17055eaea6a0f9fc03e70d9072518d67bfcfc0ce /compiler.c
parentad3c3ba2b42ec6190faa7549a00e92d42fcbad9a (diff)
stub mk_tmp
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c11
1 files 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) {