Mercurial > lcfOS
changeset 314:38f5f298ce0e
Add log for interference graph
author | Windel Bouwman |
---|---|
date | Wed, 18 Dec 2013 20:22:20 +0100 |
parents | 04cf4d26a3bc |
children | 084cccaa5deb |
files | doc/compiler.rst python/ppci/codegen/interferencegraph.py python/zcc.py |
diffstat | 3 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/compiler.rst Wed Dec 18 18:02:26 2013 +0100 +++ b/doc/compiler.rst Wed Dec 18 20:22:20 2013 +0100 @@ -1,5 +1,9 @@ +.. toctree:: + + ir + Compiler ========
--- a/python/ppci/codegen/interferencegraph.py Wed Dec 18 18:02:26 2013 +0100 +++ b/python/ppci/codegen/interferencegraph.py Wed Dec 18 20:22:20 2013 +0100 @@ -55,9 +55,9 @@ def to_dot(self, f): """ Generate graphviz dot representation """ for n in self.nodes: - print('{} [label="{}" shape=box3d];'.format(id(n), n), file=f) + print(' {} [label="{}" shape=box3d];'.format(id(n), n), file=f) for n, m in self.edges: - print('{} -> {};'.format(id(n), id(m)), file=f) + print(' {} -> {};'.format(id(n), id(m)), file=f) def to_txt(self): for node in self.nodes:
--- a/python/zcc.py Wed Dec 18 18:02:26 2013 +0100 +++ b/python/zcc.py Wed Dec 18 20:22:20 2013 +0100 @@ -33,6 +33,7 @@ def format(self, record): s = super().format(record) + s += '\n' if hasattr(record, 'c3_ast'): f = io.StringIO() print('', file=f) @@ -84,6 +85,18 @@ print(' }', file=f) print('', file=f) s += '\n' + f.getvalue() + if hasattr(record, 'ra_ig'): + f = io.StringIO() + print('', file=f) + print('', file=f) + print('.. graphviz::', file=f) + print('', file=f) + print(' digraph G {', file=f) + ig = record.ra_ig + ig.to_dot(f) + print(' }', file=f) + print('', file=f) + s += '\n' + f.getvalue() return s