## points-to.api
#
# This module can be used to perform points-to analysis for typed languages
#
# -- Allen Leung
# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.lib# "Novices and masters both break the rules.
# The difference is that the master knows
# which rules he is breaking, and why."
stipulate
package rkj = registerkinds_junk; # registerkinds_junk is from
src/lib/compiler/back/low/code/registerkinds-junk.pkgherein
api Points_To {
#
eqtype Edgekind;
Cell
= LINK Ramregion # Redirection to another Cell.
#
| SREF (rkj::Codetemp_Info, Ref(Edges))
# Strong, mutable.
| WREF (rkj::Codetemp_Info, Ref(Edges))
# Weak, mutable.
| SCELL (rkj::Codetemp_Info, Ref(Edges))
# Strong, immutable.
| WCELL (rkj::Codetemp_Info, Ref(Edges))
# Weak, immutable.
#
| TOP { mutable: Bool,
id: rkj::Codetemp_Info,
name: String
}
withtype Ramregion = Ref( Cell ) # A collapsed node
also Edges = List( (Edgekind, Int, Ramregion) );
reset: (Void -> rkj::Codetemp_Info) -> Void;
# Generate a new reference/immutable cell
#
new_sref: Void -> Ramregion;
new_wref: Void -> Ramregion;
new_scell: Void -> Ramregion;
new_wcell: Void -> Ramregion;
# Generate a new collapsed node
#
new_top: { mutable: Bool, name: String } -> Ramregion;
# The following are methods for constructing the storage shape graph.
#
ith_projection: (Ramregion, Int) -> Ramregion;
ith_subscript: (Ramregion, Int) -> Ramregion;
ith_domain: (Ramregion, Int) -> Ramregion;
ith_range: (Ramregion, Int) -> Ramregion;
ith_offset: (Ramregion, Int) -> Ramregion;
unify: (Ramregion, Ramregion) -> Void;
interfere: (Ramregion, Ramregion) -> Bool; # Do they interfere?
# More complex methods
#
make_ref: (Null_Or(Ramregion), Ramregion ) -> Ramregion;
make_record: (Null_Or(Ramregion), List(Ramregion)) -> Ramregion;
make_rw_vector: (Null_Or(Ramregion), List(Ramregion)) -> Ramregion;
make_ro_vector: (Null_Or(Ramregion), List(Ramregion)) -> Ramregion;
make_fn: List(Ramregion) -> Ramregion; # Define a function.
apply: (Ramregion, List(Ramregion)) -> Void; # Apply a function. First arg is the fn.
ret: (Ramregion, List(Ramregion)) -> Void; # Bind the return values.
strong_set: (Ramregion, Int, Ramregion) -> Void;
strong_get: (Ramregion, Int) -> Ramregion;
weak_set: (Ramregion, Ramregion) -> Void;
weak_get: Ramregion -> Ramregion;
ramregion_to_string: Ramregion -> String;
};
end;
## Changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.