Represent a sequence of the program

A basic block is composed of several instructions without a jump

Introduced properties

private var _df_computed: Bool

nitc :: BasicBlock :: _df_computed

If true, the iterated dominance frontier of this block has been computed
private var _dominance_frontier: Array[BasicBlock]

nitc :: BasicBlock :: _dominance_frontier

The iterated dominance frontier of this block
private var _first: ANode

nitc :: BasicBlock :: _first

First instruction of the basic block
private var _is_renaming: Bool

nitc :: BasicBlock :: _is_renaming

Indicate if the variables renaming step has been made for this block
private var _last: ANode

nitc :: BasicBlock :: _last

Last instruction of the basic block
private var _need_update: Bool

nitc :: BasicBlock :: _need_update

Indicate the BasicBlock is newly created and needs to be updated
private var _phi_functions: Array[PhiFunction]

nitc :: BasicBlock :: _phi_functions

The PhiFunction this block contains at the beginning
private var _predecessors: Array[BasicBlock]

nitc :: BasicBlock :: _predecessors

Direct predecessors
private var _read_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: _read_sites

Parts of AST that contain a read to a variable
private var _successors: Array[BasicBlock]

nitc :: BasicBlock :: _successors

Direct successors
private var _treated: Bool

nitc :: BasicBlock :: _treated

Used to handle recursions by treating only one time each block
private var _treated_debug: Bool

nitc :: BasicBlock :: _treated_debug

Used to dump the BasicBlock to dot
private var _variables: Array[Variable]

nitc :: BasicBlock :: _variables

The variables that are accessed in this block
private var _variables_sites: Array[AExpr]

nitc :: BasicBlock :: _variables_sites

Parts of AST that contain a variable access (read or write)
private var _write_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: _write_sites

Parts of AST that contain a write to a variable
fun add_df(block: BasicBlock)

nitc :: BasicBlock :: add_df

Add the block to the dominance frontier of this block
private fun compute_df

nitc :: BasicBlock :: compute_df

Compute recursively the dominance frontier of self block and its successors
fun df_computed: Bool

nitc :: BasicBlock :: df_computed

If true, the iterated dominance frontier of this block has been computed
protected fun df_computed=(df_computed: Bool)

nitc :: BasicBlock :: df_computed=

If true, the iterated dominance frontier of this block has been computed
fun dominance_frontier: Array[BasicBlock]

nitc :: BasicBlock :: dominance_frontier

The iterated dominance frontier of this block
protected fun dominance_frontier=(dominance_frontier: Array[BasicBlock])

nitc :: BasicBlock :: dominance_frontier=

The iterated dominance frontier of this block
fun first: ANode

nitc :: BasicBlock :: first

First instruction of the basic block
protected fun first=(first: ANode)

nitc :: BasicBlock :: first=

First instruction of the basic block
fun is_renaming: Bool

nitc :: BasicBlock :: is_renaming

Indicate if the variables renaming step has been made for this block
protected fun is_renaming=(is_renaming: Bool)

nitc :: BasicBlock :: is_renaming=

Indicate if the variables renaming step has been made for this block
fun last: ANode

nitc :: BasicBlock :: last

Last instruction of the basic block
protected fun last=(last: ANode)

nitc :: BasicBlock :: last=

Last instruction of the basic block
fun need_update: Bool

nitc :: BasicBlock :: need_update

Indicate the BasicBlock is newly created and needs to be updated
protected fun need_update=(need_update: Bool)

nitc :: BasicBlock :: need_update=

Indicate the BasicBlock is newly created and needs to be updated
fun phi_functions: Array[PhiFunction]

nitc :: BasicBlock :: phi_functions

The PhiFunction this block contains at the beginning
protected fun phi_functions=(phi_functions: Array[PhiFunction])

nitc :: BasicBlock :: phi_functions=

The PhiFunction this block contains at the beginning
fun predecessors: Array[BasicBlock]

nitc :: BasicBlock :: predecessors

Direct predecessors
protected fun predecessors=(predecessors: Array[BasicBlock])

nitc :: BasicBlock :: predecessors=

Direct predecessors
fun read_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: read_sites

Parts of AST that contain a read to a variable
protected fun read_sites=(read_sites: Array[AVarFormExpr])

nitc :: BasicBlock :: read_sites=

Parts of AST that contain a read to a variable
fun successors: Array[BasicBlock]

nitc :: BasicBlock :: successors

Direct successors
protected fun successors=(successors: Array[BasicBlock])

nitc :: BasicBlock :: successors=

Direct successors
fun treated: Bool

nitc :: BasicBlock :: treated

Used to handle recursions by treating only one time each block
protected fun treated=(treated: Bool)

nitc :: BasicBlock :: treated=

Used to handle recursions by treating only one time each block
fun treated_debug: Bool

nitc :: BasicBlock :: treated_debug

Used to dump the BasicBlock to dot
protected fun treated_debug=(treated_debug: Bool)

nitc :: BasicBlock :: treated_debug=

Used to dump the BasicBlock to dot
fun variables: Array[Variable]

nitc :: BasicBlock :: variables

The variables that are accessed in this block
protected fun variables=(variables: Array[Variable])

nitc :: BasicBlock :: variables=

The variables that are accessed in this block
fun variables_sites: Array[AExpr]

nitc :: BasicBlock :: variables_sites

Parts of AST that contain a variable access (read or write)
protected fun variables_sites=(variables_sites: Array[AExpr])

nitc :: BasicBlock :: variables_sites=

Parts of AST that contain a variable access (read or write)
fun write_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: write_sites

Parts of AST that contain a write to a variable
protected fun write_sites=(write_sites: Array[AVarFormExpr])

nitc :: BasicBlock :: write_sites=

Parts of AST that contain a write to a variable

Redefined properties

redef type SELF: BasicBlock

nitc $ BasicBlock :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _df_computed: Bool

nitc :: BasicBlock :: _df_computed

If true, the iterated dominance frontier of this block has been computed
private var _dominance_frontier: Array[BasicBlock]

nitc :: BasicBlock :: _dominance_frontier

The iterated dominance frontier of this block
private var _first: ANode

nitc :: BasicBlock :: _first

First instruction of the basic block
private var _is_renaming: Bool

nitc :: BasicBlock :: _is_renaming

Indicate if the variables renaming step has been made for this block
private var _last: ANode

nitc :: BasicBlock :: _last

Last instruction of the basic block
private var _need_update: Bool

nitc :: BasicBlock :: _need_update

Indicate the BasicBlock is newly created and needs to be updated
private var _phi_functions: Array[PhiFunction]

nitc :: BasicBlock :: _phi_functions

The PhiFunction this block contains at the beginning
private var _predecessors: Array[BasicBlock]

nitc :: BasicBlock :: _predecessors

Direct predecessors
private var _read_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: _read_sites

Parts of AST that contain a read to a variable
private var _successors: Array[BasicBlock]

nitc :: BasicBlock :: _successors

Direct successors
private var _treated: Bool

nitc :: BasicBlock :: _treated

Used to handle recursions by treating only one time each block
private var _treated_debug: Bool

nitc :: BasicBlock :: _treated_debug

Used to dump the BasicBlock to dot
private var _variables: Array[Variable]

nitc :: BasicBlock :: _variables

The variables that are accessed in this block
private var _variables_sites: Array[AExpr]

nitc :: BasicBlock :: _variables_sites

Parts of AST that contain a variable access (read or write)
private var _write_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: _write_sites

Parts of AST that contain a write to a variable
fun add_df(block: BasicBlock)

nitc :: BasicBlock :: add_df

Add the block to the dominance frontier of this block
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
private fun compute_df

nitc :: BasicBlock :: compute_df

Compute recursively the dominance frontier of self block and its successors
fun df_computed: Bool

nitc :: BasicBlock :: df_computed

If true, the iterated dominance frontier of this block has been computed
protected fun df_computed=(df_computed: Bool)

nitc :: BasicBlock :: df_computed=

If true, the iterated dominance frontier of this block has been computed
fun dominance_frontier: Array[BasicBlock]

nitc :: BasicBlock :: dominance_frontier

The iterated dominance frontier of this block
protected fun dominance_frontier=(dominance_frontier: Array[BasicBlock])

nitc :: BasicBlock :: dominance_frontier=

The iterated dominance frontier of this block
fun first: ANode

nitc :: BasicBlock :: first

First instruction of the basic block
protected fun first=(first: ANode)

nitc :: BasicBlock :: first=

First instruction of the basic block
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_renaming: Bool

nitc :: BasicBlock :: is_renaming

Indicate if the variables renaming step has been made for this block
protected fun is_renaming=(is_renaming: Bool)

nitc :: BasicBlock :: is_renaming=

Indicate if the variables renaming step has been made for this block
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun last: ANode

nitc :: BasicBlock :: last

Last instruction of the basic block
protected fun last=(last: ANode)

nitc :: BasicBlock :: last=

Last instruction of the basic block
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
fun need_update: Bool

nitc :: BasicBlock :: need_update

Indicate the BasicBlock is newly created and needs to be updated
protected fun need_update=(need_update: Bool)

nitc :: BasicBlock :: need_update=

Indicate the BasicBlock is newly created and needs to be updated
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun phi_functions: Array[PhiFunction]

nitc :: BasicBlock :: phi_functions

The PhiFunction this block contains at the beginning
protected fun phi_functions=(phi_functions: Array[PhiFunction])

nitc :: BasicBlock :: phi_functions=

The PhiFunction this block contains at the beginning
fun predecessors: Array[BasicBlock]

nitc :: BasicBlock :: predecessors

Direct predecessors
protected fun predecessors=(predecessors: Array[BasicBlock])

nitc :: BasicBlock :: predecessors=

Direct predecessors
fun read_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: read_sites

Parts of AST that contain a read to a variable
protected fun read_sites=(read_sites: Array[AVarFormExpr])

nitc :: BasicBlock :: read_sites=

Parts of AST that contain a read to a variable
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun successors: Array[BasicBlock]

nitc :: BasicBlock :: successors

Direct successors
protected fun successors=(successors: Array[BasicBlock])

nitc :: BasicBlock :: successors=

Direct successors
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun treated: Bool

nitc :: BasicBlock :: treated

Used to handle recursions by treating only one time each block
protected fun treated=(treated: Bool)

nitc :: BasicBlock :: treated=

Used to handle recursions by treating only one time each block
fun treated_debug: Bool

nitc :: BasicBlock :: treated_debug

Used to dump the BasicBlock to dot
protected fun treated_debug=(treated_debug: Bool)

nitc :: BasicBlock :: treated_debug=

Used to dump the BasicBlock to dot
fun variables: Array[Variable]

nitc :: BasicBlock :: variables

The variables that are accessed in this block
protected fun variables=(variables: Array[Variable])

nitc :: BasicBlock :: variables=

The variables that are accessed in this block
fun variables_sites: Array[AExpr]

nitc :: BasicBlock :: variables_sites

Parts of AST that contain a variable access (read or write)
protected fun variables_sites=(variables_sites: Array[AExpr])

nitc :: BasicBlock :: variables_sites=

Parts of AST that contain a variable access (read or write)
fun write_sites: Array[AVarFormExpr]

nitc :: BasicBlock :: write_sites

Parts of AST that contain a write to a variable
protected fun write_sites=(write_sites: Array[AVarFormExpr])

nitc :: BasicBlock :: write_sites=

Parts of AST that contain a write to a variable
package_diagram nitc::BasicBlock BasicBlock core::Object Object nitc::BasicBlock->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

nitc $ BasicBlock
# Represent a sequence of the program
# A basic block is composed of several instructions without a jump
class BasicBlock
	# First instruction of the basic block
	var first: ANode is noinit

	# Last instruction of the basic block
	var last: ANode is noinit

	# Direct successors
	var successors = new Array[BasicBlock]

	# Direct predecessors
	var predecessors = new Array[BasicBlock]

	# Parts of AST that contain a read to a variable
	var read_sites = new Array[AVarFormExpr]

	# Parts of AST that contain a write to a variable
	var write_sites = new Array[AVarFormExpr]

	# Parts of AST that contain a variable access (read or write)
	var variables_sites = new Array[AExpr]

	# The iterated dominance frontier of this block
	# i.e. the set of blocks this block dominate directly or indirectly
	var dominance_frontier: Array[BasicBlock] = new Array[BasicBlock] is lazy

	# Self is the old block to link to the new,
	# The two blocks are not linked if the current ends with a `AReturnExpr` or `ABreakExpr`
	# i.e. self is the predecessor of `successor`
	# `successor` The successor block
	fun link(successor: BasicBlock)
	do
		# Do not link the two blocks if the current block end with a return, break or continue
		if last isa AReturnExpr or last isa ABreakExpr or last isa AContinueExpr then return

		successors.add(successor)
		successor.predecessors.add(self)
	end

	# Self is the old block to link to the new
	# i.e. self is the predecessor of `successor`
	# `successor` The successor block
	fun link_special(successor: BasicBlock)
	do
		# Link the two blocks even if the current block ends with a return or a break
		successors.add(successor)
		successor.predecessors.add(self)
	end

	# Add the `block` to the dominance frontier of this block
	fun add_df(block: BasicBlock)
	do
		dominance_frontier.add(block)

		# Add this block recursively in super-blocks to compute the iterated
		# dominance frontier
		for successor in block.successors do
			# If this successor has not already been add to the dominance frontier
			if not dominance_frontier.has(successor) then
				add_df(successor)
			end
		end
	end

	# Compute recursively the dominance frontier of self block and its successors
	private fun compute_df
	do
		# Treat each block only one time
		df_computed = true

		for s in successors do
			add_df(s)

			if not s.df_computed then s.compute_df
		end
	end

	# Used to handle recursions by treating only one time each block
	var treated: Bool = false

	# Used to dump the BasicBlock to dot
	var treated_debug: Bool = false

	# If true, the iterated dominance frontier of this block has been computed
	var df_computed: Bool = false

	# Indicate the BasicBlock is newly created and needs to be updated
	var need_update: Bool = false

	# Indicate if the variables renaming step has been made for this block
	var is_renaming: Bool = false

	# The variables that are accessed in this block
	var variables = new Array[Variable] is lazy

	# The PhiFunction this block contains at the beginning
	var phi_functions = new Array[PhiFunction] is lazy
end
src/ssa.nit:23,1--122,3