summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tnslc/compile/function.tnsl7
-rw-r--r--tnslc/compile/scope.tnsl8
-rw-r--r--tnslc/compile/var.tnsl5
3 files changed, 15 insertions, 5 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl
index f0aac81..73188b8 100644
--- a/tnslc/compile/function.tnsl
+++ b/tnslc/compile/function.tnsl
@@ -105,10 +105,10 @@ struct Function {
cb`.add_c(" push r14\n\0")
cb`.add_c(" push r15 ; scope init\n\n\0")
- # TODO: Add all params to the scope
+ # Add all params to the scope
~Var in
/; loop (int i = 0; i < self.inputs.count) [i++]
- in = self.inputs.get(i)
+ inp = self.inputs.get(i)
out.mk_set_var(in)
;/
@@ -116,9 +116,6 @@ struct Function {
;/
/; _end_func(~Scope scope, ~CompBuf cb)
- # TODO: place jmp label
- # TODO: pop all saved vars
- # TODO: ret
cb`.add_c(" lea rsp, [rbp - 56]\n\0")
cb`.add_c(" pop r15\n\0")
cb`.add_c(" pop r14\n\0")
diff --git a/tnslc/compile/scope.tnsl b/tnslc/compile/scope.tnsl
index 24fbed1..7dcf0ea 100644
--- a/tnslc/compile/scope.tnsl
+++ b/tnslc/compile/scope.tnsl
@@ -154,6 +154,14 @@ struct Scope {
return out
;/
+
+ #
+ # Add variables to the scope
+ #
+
+ /; mk_set_var(~Var v)
+ ;/
+
#
# Label generation
#
diff --git a/tnslc/compile/var.tnsl b/tnslc/compile/var.tnsl
index 34c101a..33c3973 100644
--- a/tnslc/compile/var.tnsl
+++ b/tnslc/compile/var.tnsl
@@ -114,6 +114,11 @@ struct Var {
self._id = id
;/
+ /; _is_reg_passed [bool]
+ /; if ()
+ ;/
+ ;/
+
/; _print (int idt)
_indent(idt)
_printf("{ Var : \0")