summaryrefslogtreecommitdiff
path: root/tnslc/compile/scope.tnsl
diff options
context:
space:
mode:
authorCircleShift <kgunger12@gmail.com>2025-12-23 01:45:55 -0500
committerCircleShift <kgunger12@gmail.com>2025-12-23 01:45:55 -0500
commit562547d3c55c79f5ec92464718dab5b524c7ae83 (patch)
treec3ad9114fa3d72eba2792e0bc81b67663c611c0d /tnslc/compile/scope.tnsl
parent132279939f8266e7bbd0e07f66926e36b50c35b2 (diff)
slightly better var creation (not done)
Diffstat (limited to 'tnslc/compile/scope.tnsl')
-rw-r--r--tnslc/compile/scope.tnsl21
1 files changed, 11 insertions, 10 deletions
diff --git a/tnslc/compile/scope.tnsl b/tnslc/compile/scope.tnsl
index 1afaeab..9079e60 100644
--- a/tnslc/compile/scope.tnsl
+++ b/tnslc/compile/scope.tnsl
@@ -64,13 +64,13 @@ struct Scope {
# Make variables
#
- /; _next_reg_slot [uint]
- uint out = 9
+ /; _next_reg_slot [int]
+ int out = 11
/; if (self.parent !== NULL)
out = self.parent`._next_reg_slot()
;/
- /; if (out == 0)
+ /; if (out < 0)
return out
;/
@@ -80,7 +80,7 @@ struct Scope {
/; if (v`.loc > 0)
out++
/; if (out > 16)
- return 0
+ return 0 - 1
;/
;/
;/
@@ -88,8 +88,8 @@ struct Scope {
return out
;/
- /; _next_stack_slot [uint]
- uint out = 0
+ /; _next_stack_slot [int]
+ int out = 0 - 56
/; if (self.parent !== NULL)
out = self.parent`._next_stack_slot()
;/
@@ -108,13 +108,14 @@ struct Scope {
/; mk_set_var (~Var src)
Var out = src`.copy()
- /; if (src`.is_reg_passed() == true)
+ /; if (src`.regable() == true)
out.loc = self._next_reg_slot()
- /; if (out.loc == 0)
- out.loc = self._next_stack_slot()
+ /; if (out.loc + 1 == 0)
+ out.offset = self._next_stack_slot()
;/
;; else
- out.loc = self._next_stack_slot()
+ out.loc = 0 - 1
+ out.offset = self._next_stack_slot()
;/
~int32 p = out.top_ptrc()