Mercurial > lcfOS
view python/testcg.py @ 213:003c8a976fff
Merge of semantics and parser again ..
author | Windel Bouwman |
---|---|
date | Fri, 05 Jul 2013 11:18:48 +0200 |
parents | 07bfea4c1ed7 |
children | 494828a7adf1 |
line wrap: on
line source
import unittest import ppci, codegen, ir import arm_cm3 class testCodeGeneration(unittest.TestCase): def setUp(self): self.cg = codegen.CodeGenerator(arm_cm3.armtarget) def testFunction(self): m = ir.Module('tst') f = ir.Function('tst') m.addFunction(f) bb = ir.BasicBlock('entry') f.addBasicBlock(bb) v = ir.Value('tst') bb.addInstruction(ir.ImmLoad(v, 123)) m.check() obj = self.cg.generate(m) self.assertTrue(obj) if __name__ == '__main__': unittest.main()