diff options
| author | Kai Gunger <kgunger12@gmail.com> | 2025-12-07 18:32:35 -0500 |
|---|---|---|
| committer | Kai Gunger <kgunger12@gmail.com> | 2025-12-07 18:32:35 -0500 |
| commit | daedfe9e1684ae855e2a4cf21249e1274ff8484d (patch) | |
| tree | 6cacc8e364efb9b1472dfeb48a02bd37e1866634 /tnslc/compile/function.tnsl | |
| parent | 9e8e52bf43b325ab636fc4de81acc89eb17a2c1d (diff) | |
| parent | 17620a6aae801ff22e8eb6a95b30f6e830742542 (diff) | |
Merge branch 'origin' of cshift.net:git/tnsl-lang into origin
Diffstat (limited to 'tnslc/compile/function.tnsl')
| -rw-r--r-- | tnslc/compile/function.tnsl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl index eaf1da5..73188b8 100644 --- a/tnslc/compile/function.tnsl +++ b/tnslc/compile/function.tnsl @@ -20,6 +20,7 @@ struct Function { ~parse.Node tn = NULL ~parse.Node n int reg = 1 + int stack_down = 0 /; loop (int i = 0; i < dl`.sub.count) [i++] n = dl`.sub.get(i) /; if (n`._type == parse.NTYPE_TYPE) @@ -32,10 +33,13 @@ struct Function { Var p p.init(tn, n) p._resolve_type(parent) - /; if (reg < 7 && p.is_reg_passed()) + /; if (p.is_reg_passed() == true && reg < 7) p.loc = reg + reg++ ;; else p.loc = 0 + p.loc = p.loc - stack_down + stack_down = stack_down - p.actual_size() ;/ self.inputs.push(~p) ;/ @@ -102,10 +106,10 @@ struct Function { cb`.add_c(" push r15 ; scope init\n\n\0") # Add all params to the scope - ~Var inp + ~Var in /; loop (int i = 0; i < self.inputs.count) [i++] inp = self.inputs.get(i) - out.mk_set_var(inp) + out.mk_set_var(in) ;/ return out |