comparison test/testcg.py @ 317:e30a77ae359b

Added glue blocks
author Windel Bouwman
date Sun, 22 Dec 2013 15:50:59 +0100
parents 68b01c8abf8a
children 44f336460c2a
comparison
equal deleted inserted replaced
316:56e6ff84f646 317:e30a77ae359b
20 def testFunction(self): 20 def testFunction(self):
21 s = outstream.OutputStream() 21 s = outstream.OutputStream()
22 m, f, bb = genTestFunction() 22 m, f, bb = genTestFunction()
23 bb.addInstruction(ir.Exp(ir.Const(123))) 23 bb.addInstruction(ir.Exp(ir.Const(123)))
24 bb.addInstruction(ir.Jump(f.epiloog)) 24 bb.addInstruction(ir.Jump(f.epiloog))
25 m.check()
26 obj = self.cg.generate(m, s) 25 obj = self.cg.generate(m, s)
27 self.assertTrue(obj) 26 self.assertTrue(obj)
28 27
29 28
30 class testArmCodeGeneration(unittest.TestCase): 29 class testArmCodeGeneration(unittest.TestCase):
32 s = outstream.OutputStream() 31 s = outstream.OutputStream()
33 cg = CodeGenerator(armtarget) 32 cg = CodeGenerator(armtarget)
34 m, f, bb = genTestFunction() 33 m, f, bb = genTestFunction()
35 bb.addInstruction(ir.Move(ir.Mem(ir.Const(1)), ir.Const(22))) 34 bb.addInstruction(ir.Move(ir.Mem(ir.Const(1)), ir.Const(22)))
36 bb.addInstruction(ir.Jump(f.epiloog)) 35 bb.addInstruction(ir.Jump(f.epiloog))
37 m.check()
38 cg.generate(m, s) 36 cg.generate(m, s)
39 #s.dump() 37 #s.dump()
40 38
41 39
42 if __name__ == '__main__': 40 if __name__ == '__main__':