comparison python/ppci/irutils.py @ 394:988f3fb861e4

c3 code generator rewrite
author Windel Bouwman
date Thu, 22 May 2014 08:14:12 +0200
parents e84047f29c78
children
comparison
equal deleted inserted replaced
393:6ae782a085e0 394:988f3fb861e4
208 208
209 # Helpers: 209 # Helpers:
210 def setModule(self, m): 210 def setModule(self, m):
211 self.m = m 211 self.m = m
212 212
213 def newFunction(self, name): 213 def new_function(self, name):
214 f = ir.Function(name) 214 f = ir.Function(name)
215 self.m.add_function(f) 215 self.m.add_function(f)
216 return f 216 return f
217 217
218 def newBlock(self): 218 def newBlock(self):
238 raise Exception('No basic block') 238 raise Exception('No basic block')
239 self.bb.addInstruction(i) 239 self.bb.addInstruction(i)
240 240
241 241
242 class Verifier: 242 class Verifier:
243 """ Checks an ir module for correctness """
243 def verify(self, module): 244 def verify(self, module):
244 """ Verifies a module for some sanity """ 245 """ Verifies a module for some sanity """
245 assert isinstance(module, ir.Module) 246 assert isinstance(module, ir.Module)
246 for f in module.Functions: 247 for f in module.Functions:
247 self.verify_function(f) 248 self.verify_function(f)