Mercurial > lcfOS
diff python/testcg.py @ 272:e64bae57cda8
refactor ir
author | Windel Bouwman |
---|---|
date | Sat, 31 Aug 2013 17:58:54 +0200 |
parents | 5ec7580976d9 |
children |
line wrap: on
line diff
--- a/python/testcg.py Tue Aug 20 18:56:02 2013 +0200 +++ b/python/testcg.py Sat Aug 31 17:58:54 2013 +0200 @@ -8,7 +8,7 @@ m = ir.Module('tst') f = ir.Function('tst') m.addFunction(f) - return m, f.entry + return m, f, f.entry class testCodeGeneration(unittest.TestCase): @@ -16,9 +16,9 @@ self.cg = codegen.CodeGenerator(arm.armtarget) def testFunction(self): - m, bb = genTestFunction() + m, f, bb = genTestFunction() bb.addInstruction(ir.Const(123)) - bb.addInstruction(ir.Return(ir.Const(0))) + bb.addInstruction(ir.Jump(f.epiloog)) m.check() obj = self.cg.generate(m) self.assertTrue(obj) @@ -28,9 +28,9 @@ def testStack(self): s = outstream.OutputStream() cg = codegenarm.ArmCodeGenerator(s) - m, bb = genTestFunction() + m, f, bb = genTestFunction() bb.addInstruction(ir.Move(ir.Mem(ir.Const(1)), ir.Const(22))) - bb.addInstruction(ir.Return(ir.Const(0))) + bb.addInstruction(ir.Jump(f.epiloog)) m.check() cg.generate(m) #s.dump()