nitc :: BlockDebug
nitc :: BlockDebug :: defaultinit
nitc :: BlockDebug :: dump
Dump all the hierarchy of BasicBlock fromblock
to the leaves
nitc :: BlockDebug :: print_block
Print all the block recursively fromblock
to the leaves
nitc $ BlockDebug :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: BlockDebug :: defaultinit
core :: Object :: defaultinit
nitc :: BlockDebug :: dump
Dump all the hierarchy of BasicBlock fromblock
to the leaves
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: BlockDebug :: print_block
Print all the block recursively fromblock
to the leaves
# Utility class for dump basic block and SSA output to dot files
class BlockDebug
# The output file
var file: FileWriter
# Dump all the hierarchy of BasicBlock from `block` to the leaves
fun dump(block: BasicBlock)
do
# Write the basic blocks hierarchy in output file
file.write("digraph basic_blocks\n\{\n")
var i = 0
file.write(print_block(block, i))
file.write("\n\}")
file.close
end
# Print all the block recursively from `block` to the leaves
# *`block` The root BasicBlock
# *`i` Used for the recursion
private fun print_block(block: BasicBlock, i: Int): String
do
# Precise the type and location of the begin and end of current block
var s = "block{block.hash.to_s} [shape=record, label="+"\"\{"
s += "block" + block.to_s.escape_to_dot
s += "|\{" + block.first.location.file.filename.to_s + block.first.location.line_start.to_s
s += " | " + block.first.to_s.escape_to_dot
# Print phi-functions if any
for phi in block.phi_functions do
s += " | " + phi.to_s.escape_to_dot + " "
end
s += "}|\{" + block.last.location.file.filename.to_s + block.last.location.line_start.to_s
s += " | " + block.last.to_s.escape_to_dot + "}}\"];"+ "\n"
i += 1
block.treated_debug = true
for b in block.successors do
# Print edges to successors
s += "block{block.hash.to_s} -> " + " block{b.hash.to_s};\n"
# Recursively print child blocks
if not b.treated_debug then s += print_block(b, i)
end
return s
end
end
src/ssa.nit:522,1--571,3