2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 03:38:25 +08:00

Add printing of SSA functions.

This commit is contained in:
whitequark 2015-07-13 20:53:02 +03:00
parent dbdd45acc5
commit ebe243f8d9

View File

@ -331,4 +331,16 @@ class Function(Value):
return "{} @{}".format(types.TypePrinter().name(self.type), return "{} @{}".format(types.TypePrinter().name(self.type),
escape_name(self.name)) escape_name(self.name))
def __str__(self):
printer = types.TypePrinter()
lines = []
lines.append("{} {}({}) {{ ; type: {}".format(
printer.name(self.type.ret), self.name,
", ".join([arg.as_operand() for arg in self.arguments]),
printer.name(self.type)))
for block in self.basic_blocks:
lines.append(str(block))
lines.append("}")
return "\n".join(lines)
# Python-specific SSA IR classes # Python-specific SSA IR classes