A PhiFunction is a kind of Variable used in SSA-construction,

it is placed at the beginning of a BasicBlock with many incoming blocks

Introduced properties

private var _block: BasicBlock

nitc :: PhiFunction :: _block

The position in the AST of the phi-function
private var _dependences: Array[Couple[Variable, BasicBlock]]

nitc :: PhiFunction :: _dependences

The dependences of this variable for SSA-Algorithm
fun add_dependences(block: BasicBlock, v: Variable)

nitc :: PhiFunction :: add_dependences

Set the dependences for the phi-function
fun block: BasicBlock

nitc :: PhiFunction :: block

The position in the AST of the phi-function
protected fun block=(block: BasicBlock)

nitc :: PhiFunction :: block=

The position in the AST of the phi-function
fun dependences: Array[Couple[Variable, BasicBlock]]

nitc :: PhiFunction :: dependences

The dependences of this variable for SSA-Algorithm
protected fun dependences=(dependences: Array[Couple[Variable, BasicBlock]])

nitc :: PhiFunction :: dependences=

The dependences of this variable for SSA-Algorithm

Redefined properties

redef type SELF: PhiFunction

nitc $ PhiFunction :: SELF

Type of this instance, automatically specialized in every class
redef fun to_s: String

nitc $ PhiFunction :: to_s

Print the PhiFunction with all its dependences

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 _assignment_blocks: Array[BasicBlock]

nitc :: Variable :: _assignment_blocks

The blocks in which this variable is assigned
private var _block: BasicBlock

nitc :: PhiFunction :: _block

The position in the AST of the phi-function
private var _declared_type: nullable MType

nitc :: Variable :: _declared_type

The declared type of the variable
private var _dep_exprs: Array[AExpr]

nitc :: Variable :: _dep_exprs

The expressions of AST of this variable depends
private var _dependences: Array[Couple[Variable, BasicBlock]]

nitc :: PhiFunction :: _dependences

The dependences of this variable for SSA-Algorithm
private var _is_adapted: Bool

nitc :: Variable :: _is_adapted

Was the variable type-adapted?
private var _location: nullable Location

nitc :: Variable :: _location

The declaration of the variable, if any
private var _name: String

nitc :: Variable :: _name

The name of the variable (as used in the program)
private var _original_variable: nullable Variable

nitc :: Variable :: _original_variable

The original Variable in case of renaming
private var _parameter: Bool

nitc :: Variable :: _parameter

If true, this variable is a parameter of a method
private var _position: Int

nitc :: Variable :: _position

The position in the environment
private var _read_blocks: Array[BasicBlock]

nitc :: Variable :: _read_blocks

Part of the program where this variable is read
private var _stack: Array[Variable]

nitc :: Variable :: _stack

The stack of this variable, used for SSA renaming
private var _warn_unread: Bool

nitc :: Variable :: _warn_unread

Is the local variable not read and need a warning?
fun add_dependences(block: BasicBlock, v: Variable)

nitc :: PhiFunction :: add_dependences

Set the dependences for the phi-function
fun assignment_blocks: Array[BasicBlock]

nitc :: Variable :: assignment_blocks

The blocks in which this variable is assigned
protected fun assignment_blocks=(assignment_blocks: Array[BasicBlock])

nitc :: Variable :: assignment_blocks=

The blocks in which this variable is assigned
fun block: BasicBlock

nitc :: PhiFunction :: block

The position in the AST of the phi-function
protected fun block=(block: BasicBlock)

nitc :: PhiFunction :: block=

The position in the AST of the phi-function
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.
fun declared_type: nullable MType

nitc :: Variable :: declared_type

The declared type of the variable
fun declared_type=(declared_type: nullable MType)

nitc :: Variable :: declared_type=

The declared type of the variable
fun dep_exprs: Array[AExpr]

nitc :: Variable :: dep_exprs

The expressions of AST of this variable depends
protected fun dep_exprs=(dep_exprs: Array[AExpr])

nitc :: Variable :: dep_exprs=

The expressions of AST of this variable depends
fun dependences: Array[Couple[Variable, BasicBlock]]

nitc :: PhiFunction :: dependences

The dependences of this variable for SSA-Algorithm
protected fun dependences=(dependences: Array[Couple[Variable, BasicBlock]])

nitc :: PhiFunction :: dependences=

The dependences of this variable for SSA-Algorithm
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.
abstract fun infobox(v: HtmlightVisitor): HInfoBox

nitc :: HInfoBoxable :: infobox

An new infobox documenting the entity
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".
private fun is_adapted: Bool

nitc :: Variable :: is_adapted

Was the variable type-adapted?
private fun is_adapted=(is_adapted: Bool)

nitc :: Variable :: is_adapted=

Was the variable type-adapted?
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 location: nullable Location

nitc :: Variable :: location

The declaration of the variable, if any
fun location=(location: nullable Location)

nitc :: Variable :: location=

The declaration of the variable, if any
fun name: String

nitc :: Variable :: name

The name of the variable (as used in the program)
fun name=(name: String)

nitc :: Variable :: name=

The name of the variable (as used in the program)
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun original_variable: nullable Variable

nitc :: Variable :: original_variable

The original Variable in case of renaming
protected fun original_variable=(original_variable: nullable Variable)

nitc :: Variable :: original_variable=

The original Variable in case of renaming
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 parameter: Bool

nitc :: Variable :: parameter

If true, this variable is a parameter of a method
protected fun parameter=(parameter: Bool)

nitc :: Variable :: parameter=

If true, this variable is a parameter of a method
fun position: Int

nitc :: Variable :: position

The position in the environment
fun position=(position: Int)

nitc :: Variable :: position=

The position in the environment
fun read_blocks: Array[BasicBlock]

nitc :: Variable :: read_blocks

Part of the program where this variable is read
protected fun read_blocks=(read_blocks: Array[BasicBlock])

nitc :: Variable :: read_blocks=

Part of the program where this variable is read
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun stack: Array[Variable]

nitc :: Variable :: stack

The stack of this variable, used for SSA renaming
protected fun stack=(stack: Array[Variable])

nitc :: Variable :: stack=

The stack of this variable, used for SSA renaming
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 warn_unread: Bool

nitc :: Variable :: warn_unread

Is the local variable not read and need a warning?
fun warn_unread=(warn_unread: Bool)

nitc :: Variable :: warn_unread=

Is the local variable not read and need a warning?
package_diagram nitc::PhiFunction PhiFunction nitc::Variable Variable nitc::PhiFunction->nitc::Variable nitc::HInfoBoxable HInfoBoxable nitc::Variable->nitc::HInfoBoxable ...nitc::HInfoBoxable ... ...nitc::HInfoBoxable->nitc::HInfoBoxable

Ancestors

interface HInfoBoxable

nitc :: HInfoBoxable

Model entity or whatever that can produce an infobox
interface Object

core :: Object

The root of the class hierarchy.

Parents

class Variable

nitc :: Variable

A local variable (including parameters, automatic variables and self)

Class definitions

nitc $ PhiFunction
# A PhiFunction is a kind of Variable used in SSA-construction,
# it is placed at the beginning of a BasicBlock with many incoming blocks
class PhiFunction
	super Variable

	# The dependences of this variable for SSA-Algorithm
	var dependences = new Array[Couple[Variable, BasicBlock]]

	# The position in the AST of the phi-function
	var block: BasicBlock

	# Set the dependences for the phi-function
	# *`block` BasicBlock in which we go through the dominance-frontier
	# *`v` The variable to looking for
	fun add_dependences(block: BasicBlock, v: Variable)
	do
		# Look in which blocks of DF(block) `v` has been assigned
		for b in block.predecessors do
			if v.assignment_blocks.has(b) then
				var dep = new Couple[Variable, BasicBlock](v, b)
				dependences.add(dep)
			end
		end
	end

	# Print the PhiFunction with all its dependences
	redef fun to_s: String
	do
		var s = ""
		s += " dependences = [ "
		for d in dependences do
			s += d.first.to_s + " "
		end
		s += "]"

		return s
	end
end
src/ssa.nit:159,1--196,3