comparison test/testcg.py @ 335:582a1aaa3983

Added long branch format
author Windel Bouwman
date Mon, 17 Feb 2014 20:41:30 +0100
parents 44f336460c2a
children 4d204f6f7d4e
comparison
equal deleted inserted replaced
334:6f4753202b9a 335:582a1aaa3983
16 class testCodeGeneration(unittest.TestCase): 16 class testCodeGeneration(unittest.TestCase):
17 def setUp(self): 17 def setUp(self):
18 self.cg = CodeGenerator(armtarget) 18 self.cg = CodeGenerator(armtarget)
19 19
20 def testFunction(self): 20 def testFunction(self):
21 s = outstream.OutputStream() 21 s = outstream.BinaryOutputStream(ppci.objectfile.ObjectFile())
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 obj = self.cg.generate(m, s) 25 obj = self.cg.generate(m, s)
26 self.assertTrue(obj) 26 self.assertTrue(obj)
27 27
28 28
29 class testArmCodeGeneration(unittest.TestCase): 29 class testArmCodeGeneration(unittest.TestCase):
30 def testStack(self): 30 def testStack(self):
31 s = outstream.OutputStream() 31 s = outstream.BinaryOutputStream(ppci.objectfile.ObjectFile())
32 cg = CodeGenerator(armtarget) 32 cg = CodeGenerator(armtarget)
33 m, f, bb = genTestFunction() 33 m, f, bb = genTestFunction()
34 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)))
35 bb.addInstruction(ir.Jump(f.epiloog)) 35 bb.addInstruction(ir.Jump(f.epiloog))
36 cg.generate(m, s) 36 cg.generate(m, s)