annotate python/c3/codegenerator.py @ 272:e64bae57cda8

refactor ir
author Windel Bouwman
date Sat, 31 Aug 2013 17:58:54 +0200
parents 5f8c04a8d26b
children ea93e0a7a31e
rev   line source
255
7416c923a02a Added more logging
Windel Bouwman
parents: 252
diff changeset
1 import logging
155
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 151
diff changeset
2 import ir
b28a11c01dbe Simplified IR classes
Windel Bouwman
parents: 151
diff changeset
3 from . import astnodes
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
4 from .scope import boolType, intType
220
3f6c30a5d234 Major change in expression parsing to enable pointers and structs
Windel Bouwman
parents: 217
diff changeset
5 from ppci import CompilerError
231
521567d17388 simplify blink.c3
Windel Bouwman
parents: 230
diff changeset
6 from .typecheck import theType
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
7
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
8
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
9 class CodeGenerator(ir.Builder):
261
444b9df2ed99 try to split up code generation
Windel Bouwman
parents: 259
diff changeset
10 """ Generates intermediate code from a package """
255
7416c923a02a Added more logging
Windel Bouwman
parents: 252
diff changeset
11 def __init__(self):
261
444b9df2ed99 try to split up code generation
Windel Bouwman
parents: 259
diff changeset
12 self.logger = logging.getLogger('c3cgen')
444b9df2ed99 try to split up code generation
Windel Bouwman
parents: 259
diff changeset
13
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
14 def gencode(self, pkg):
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
15 self.prepare()
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
16 assert type(pkg) is astnodes.Package
255
7416c923a02a Added more logging
Windel Bouwman
parents: 252
diff changeset
17 self.logger.info('Generating ir-code for {}'.format(pkg.name))
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
18 self.varMap = {} # Maps variables to storage locations.
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
19 self.funcMap = {}
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
20 self.m = ir.Module(pkg.name)
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
21 self.genModule(pkg)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
22 return self.m
170
4348da5ca307 Cleanup of ir dir
Windel Bouwman
parents: 169
diff changeset
23
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
24 # inner helpers:
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
25 def genModule(self, pkg):
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
26 # Take care of forward declarations:
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
27 for s in pkg.innerScope.Functions:
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
28 f = self.newFunction(s.name)
175
a51b3c956386 Added function call in expressions
Windel Bouwman
parents: 174
diff changeset
29 self.funcMap[s] = f
272
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
30 for v in pkg.innerScope.Variables:
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
31 #print(v)
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
32 self.varMap[v] = self.newTemp()
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
33 for s in pkg.innerScope.Functions:
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
34 self.genFunction(s)
174
3eb06f5fb987 Added memory alloc for locals
Windel Bouwman
parents: 172
diff changeset
35
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
36 def genFunction(self, fn):
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
37 # TODO: handle arguments
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
38 f = self.funcMap[fn]
272
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
39 f.return_value = self.newTemp()
269
5f8c04a8d26b Towards better modularity
Windel Bouwman
parents: 268
diff changeset
40 # TODO reserve room for stack, this can be done at later point?
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
41 self.setFunction(f)
269
5f8c04a8d26b Towards better modularity
Windel Bouwman
parents: 268
diff changeset
42 l2 = self.newBlock()
5f8c04a8d26b Towards better modularity
Windel Bouwman
parents: 268
diff changeset
43 self.emit(ir.Jump(l2))
5f8c04a8d26b Towards better modularity
Windel Bouwman
parents: 268
diff changeset
44 self.setBlock(l2)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
45 # generate room for locals:
174
3eb06f5fb987 Added memory alloc for locals
Windel Bouwman
parents: 172
diff changeset
46
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
47 for sym in fn.innerScope:
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
48 # TODO: handle parameters different
272
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
49 if sym.isParameter:
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
50 print('param', sym)
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
51 ir.Parameter(sym.name)
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
52 if sym.isLocal:
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
53 print('local', sym)
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
54
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
55 v = self.newTemp()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
56 # TODO: make this ssa here??
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
57 self.varMap[sym] = v
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
58
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
59 self.genCode(fn.body)
272
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
60 # Set the default return value to zero:
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
61 # TBD: this may not be required?
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
62 self.emit(ir.Move(f.return_value, ir.Const(0)))
269
5f8c04a8d26b Towards better modularity
Windel Bouwman
parents: 268
diff changeset
63 self.emit(ir.Jump(f.epiloog))
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
64 self.setFunction(None)
158
9683a4cd848f Added some functions for code generation
Windel Bouwman
parents: 157
diff changeset
65
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
66 def genCode(self, code):
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
67 assert isinstance(code, astnodes.Statement)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
68 self.setLoc(code.loc)
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
69 if type(code) is astnodes.CompoundStatement:
221
848c4b15fd0b pointers
Windel Bouwman
parents: 220
diff changeset
70 for s in code.statements:
848c4b15fd0b pointers
Windel Bouwman
parents: 220
diff changeset
71 self.genCode(s)
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
72 elif type(code) is astnodes.Assignment:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
73 rval = self.genExprCode(code.rval)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
74 lval = self.genExprCode(code.lval)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
75 self.emit(ir.Move(lval, rval))
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
76 elif type(code) is astnodes.ExpressionStatement:
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
77 self.genExprCode(code.ex)
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
78 elif type(code) is astnodes.IfStatement:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
79 bbtrue = self.newBlock()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
80 bbfalse = self.newBlock()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
81 te = self.newBlock()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
82 self.genCondCode(code.condition, bbtrue, bbfalse)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
83 self.setBlock(bbtrue)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
84 self.genCode(code.truestatement)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
85 self.emit(ir.Jump(te))
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
86 self.setBlock(bbfalse)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
87 if code.falsestatement:
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
88 self.genCode(code.falsestatement)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
89 self.emit(ir.Jump(te))
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
90 self.setBlock(te)
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
91 elif type(code) is astnodes.ReturnStatement:
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
92 if code.expr:
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
93 re = self.genExprCode(code.expr)
272
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
94 self.emit(ir.Move(self.fn.return_value, re))
e64bae57cda8 refactor ir
Windel Bouwman
parents: 269
diff changeset
95 self.emit(ir.Jump(self.fn.epiloog))
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
96 else:
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
97 self.builder.addIns(ir.Return())
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
98 elif type(code) is astnodes.WhileStatement:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
99 bbdo = self.newBlock()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
100 bbtest = self.newBlock()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
101 te = self.newBlock()
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
102 self.emit(ir.Jump(bbtest))
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
103 self.setBlock(bbtest)
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
104 self.genCondCode(code.condition, bbdo, te)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
105 self.setBlock(bbdo)
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
106 self.genCode(code.statement)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
107 self.emit(ir.Jump(bbtest))
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
108 self.setBlock(te)
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
109 else:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
110 raise NotImplementedError('Unknown stmt {}'.format(code))
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
111
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
112 def genCondCode(self, expr, bbtrue, bbfalse):
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
113 # Implement sequential logical operators
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
114 assert expr.typ == boolType
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
115 if type(expr) is astnodes.Binop:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
116 if expr.op == 'or':
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
117 l2 = self.newBlock()
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
118 self.genCondCode(expr.a, bbtrue, l2)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
119 self.setBlock(l2)
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
120 self.genCondCode(expr.b, bbtrue, bbfalse)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
121 elif expr.op == 'and':
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
122 l2 = self.newBlock()
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
123 self.genCondCode(expr.a, l2, bbfalse)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
124 self.setBlock(l2)
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
125 self.genCondCode(expr.b, bbtrue, bbfalse)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
126 elif expr.op in ['==', '>', '<']:
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
127 ta = self.genExprCode(expr.a)
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
128 tb = self.genExprCode(expr.b)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
129 self.emit(ir.CJump(ta, expr.op, tb, bbtrue, bbfalse))
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
130 else:
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
131 raise NotImplementedError('Unknown condition {}'.format(expr))
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
132 elif type(expr) is astnodes.Literal:
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
133 if expr.val:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
134 self.emit(ir.Jump(bbtrue))
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
135 else:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
136 self.emit(ir.Jump(bbfalse))
228
7f18ed9b6b7e Removal of emptystatement class
Windel Bouwman
parents: 227
diff changeset
137 else:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
138 raise NotImplementedError('Unknown cond {}'.format(expr))
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
139
217
8b2e5f3cd579 Removed some stale python source files
Windel Bouwman
parents: 205
diff changeset
140 def genExprCode(self, expr):
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
141 assert isinstance(expr, astnodes.Expression)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
142 if type(expr) is astnodes.Binop and expr.op in ir.Binop.ops:
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
143 ra = self.genExprCode(expr.a)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
144 rb = self.genExprCode(expr.b)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
145 return ir.Binop(ra, expr.op, rb)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
146 elif type(expr) is astnodes.Unop and expr.op == '&':
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
147 ra = self.genExprCode(expr.a)
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
148 # TODO: Make this work?
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
149 return ra
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
150 elif type(expr) is astnodes.VariableUse:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
151 return self.varMap[expr.target]
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
152 elif type(expr) is astnodes.Deref:
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
153 # dereference pointer type:
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
154 addr = self.genExprCode(expr.ptr)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
155 return ir.Mem(addr)
227
82dfe6a32717 Fixed tests
Windel Bouwman
parents: 225
diff changeset
156 elif type(expr) is astnodes.FieldRef:
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
157 b = self.genExprCode(expr.base)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
158 #b = b.e
231
521567d17388 simplify blink.c3
Windel Bouwman
parents: 230
diff changeset
159 bt = theType(expr.base.typ)
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
160 offset = ir.Const(bt.fieldOffset(expr.field))
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
161 return ir.Mem(ir.Binop(b, '+', offset))
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
162 elif type(expr) is astnodes.Literal:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
163 return ir.Const(expr.val)
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
164 elif type(expr) is astnodes.TypeCast:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
165 # TODO: improve this mess:
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
166 ar = self.genExprCode(expr.a)
231
521567d17388 simplify blink.c3
Windel Bouwman
parents: 230
diff changeset
167 tt = theType(expr.to_type)
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
168 if isinstance(tt, astnodes.PointerType):
222
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
169 if expr.a.typ is intType:
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
170 return ar
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
171 elif isinstance(expr.a.typ, astnodes.PointerType):
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
172 return ar
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
173 else:
c3f1ce8b638f Fixup of parser
Windel Bouwman
parents: 221
diff changeset
174 raise Exception()
230
88a1e0baef65 Added some tests for IR-code
Windel Bouwman
parents: 228
diff changeset
175 else:
233
d3dccf12ca88 Added hexfile tests
Windel Bouwman
parents: 232
diff changeset
176 raise NotImplementedError("not implemented")
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
177 elif type(expr) is astnodes.FunctionCall:
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
178 args = [self.genExprCode(e) for e in expr.args]
259
ac603eb66b63 Added function call
Windel Bouwman
parents: 255
diff changeset
179 fn = self.funcMap[expr.proc]
268
5ec7580976d9 Op naar tree-IR
Windel Bouwman
parents: 261
diff changeset
180 return ir.Call(fn, args)
225
1c7364bd74c7 Fixed pointer deref
Windel Bouwman
parents: 222
diff changeset
181 else:
259
ac603eb66b63 Added function call
Windel Bouwman
parents: 255
diff changeset
182 raise NotImplementedError('Unknown expr {}'.format(expr))
157
8f3924b6076e Added some code generator things
Windel Bouwman
parents: 156
diff changeset
183