Mercurial > lcfOS
diff python/ppci/core/asmwriter.py @ 111:d3068efdf045
merge
author | Windel Bouwman |
---|---|
date | Fri, 04 Jan 2013 15:26:59 +0100 |
parents | 9e552d34bd60 |
children |
line wrap: on
line diff
--- a/python/ppci/core/asmwriter.py Thu Jan 03 18:33:29 2013 +0100 +++ b/python/ppci/core/asmwriter.py Fri Jan 04 15:26:59 2013 +0100 @@ -1,5 +1,6 @@ from . import llvmtype +from .instruction import BinaryOperator #typeNames[VoidType] = 'void' class AsmWriter: @@ -9,7 +10,6 @@ def printModule(self, module): if module.Identifier: print('; ModuleID = {0}'.format(module.Identifier)) - # # Print functions: for f in module.Functions: self.printFunction(f) @@ -20,10 +20,9 @@ args = '()' print('define {0} {1}{2}'.format(t, f.name, args)) print('{') - for bb in f.BasicBlocks: - print(bb) - + print('basic block!') + self.printBasicBlock(bb) print('}') def strType(self, t): @@ -36,5 +35,9 @@ for instr in bb.Instructions: self.printInstruction(instr) def printInstruction(self, i): - pass + print('Instruction!') + if isinstance(i, BinaryOperator): + print(i.operation, i.value1.Name, i.value2.Name) + else: + print(i)