forked from M-Labs/artiq
1
0
Fork 0

compiler.ir: print even blocks without predecessors.

This commit is contained in:
whitequark 2015-11-23 23:55:12 +08:00
parent d92b3434a0
commit a4525b21cf
1 changed files with 5 additions and 1 deletions

View File

@ -479,8 +479,12 @@ class Function:
type_printer.name(self.type.ret), self.name,
", ".join([arg.as_operand(type_printer) for arg in self.arguments]),
type_printer.name(self.type)))
for block in reversed(postorder):
postorder_blocks = list(reversed(postorder))
orphan_blocks = [block for block in self.basic_blocks if block not in postorder]
for block in postorder_blocks + orphan_blocks:
lines.append(block.as_entity(type_printer))
lines.append("}")
return "\n".join(lines)