diff python/c3/codegenerator.py @ 172:5a7d37d615ee

Added function to IR
author Windel Bouwman
date Thu, 04 Apr 2013 17:58:37 +0200
parents 3eb9b9e2958d
children 3eb06f5fb987
line wrap: on
line diff
--- a/python/c3/codegenerator.py	Wed Apr 03 22:20:20 2013 +0200
+++ b/python/c3/codegenerator.py	Thu Apr 04 17:58:37 2013 +0200
@@ -20,11 +20,15 @@
             pass
          elif type(s) is astnodes.Function:
             # TODO: handle arguments
-            # TODO handle return?
+            f = self.builder.newFunc(s.name)
+            self.builder.setFunc(f)
             bb = self.builder.newBB()
+            f.entry = bb
             self.builder.setBB(bb)
             self.genCode(s.body)
+            # TODO handle return?
             self.builder.addIns(ir.Return())
+            self.builder.setFunc(None)
          else:
             print(s)