Showing
2 changed files
with
10 additions
and
2 deletions
... | @@ -194,6 +194,13 @@ class CodeGenVisitor (Visitor) : | ... | @@ -194,6 +194,13 @@ class CodeGenVisitor (Visitor) : |
194 | outfile.write("\n#\n# string literals from file %r\n#\n\n" | 194 | outfile.write("\n#\n# string literals from file %r\n#\n\n" |
195 | % c.path) | 195 | % c.path) |
196 | outfile.write(s) | 196 | outfile.write(s) |
197 | + outfile.write("\n#\n" | ||
198 | + "# call main\n" | ||
199 | + "#\n\n" | ||
200 | + "IRQ0:\n" | ||
201 | + " set R9 @main\n" | ||
202 | + " call R9\n" | ||
203 | + " halt\n") | ||
197 | 204 | ||
198 | def _calc_function_var_addrs(self, symtab, last_fp_loc): | 205 | def _calc_function_var_addrs(self, symtab, last_fp_loc): |
199 | self._calc_function_arg_addrs(symtab) | 206 | self._calc_function_arg_addrs(symtab) |
... | @@ -201,7 +208,7 @@ class CodeGenVisitor (Visitor) : | ... | @@ -201,7 +208,7 @@ class CodeGenVisitor (Visitor) : |
201 | 208 | ||
202 | def _calc_function_arg_addrs(self, symtab): | 209 | def _calc_function_arg_addrs(self, symtab): |
203 | for symbol in symtab.entries.values(): | 210 | for symbol in symtab.entries.values(): |
204 | - symbol.compile_loc = 2 + symbol.param_num | 211 | + symbol.compile_loc = 3 + symbol.param_num |
205 | if not symbol.is_used: | 212 | if not symbol.is_used: |
206 | self.warning("function argument '%s' is never used." % symbol.name) | 213 | self.warning("function argument '%s' is never used." % symbol.name) |
207 | 214 | ||
... | @@ -401,7 +408,7 @@ class CodeGenVisitor (Visitor) : | ... | @@ -401,7 +408,7 @@ class CodeGenVisitor (Visitor) : |
401 | call = node.arglist.nodes[0].get_str() | 408 | call = node.arglist.nodes[0].get_str() |
402 | expect = self.test[call] | 409 | expect = self.test[call] |
403 | ret = self._accept_and_pop(node.arglist.nodes[1]) | 410 | ret = self._accept_and_pop(node.arglist.nodes[1]) |
404 | - self.o(" ### %s == %s # == %s" % (ret, expect, call)) | 411 | + self.o(" ### %s == %s # == %s\n" % (ret, expect, call)) |
405 | self.stack.done() | 412 | self.stack.done() |
406 | return | 413 | return |
407 | self.c("FUNCTION CALL to %s() - begin" % | 414 | self.c("FUNCTION CALL to %s() - begin" % | ... | ... |
-
Please register or login to post a comment