Parameter Compile_to_canonical_ir.1-I
Values
Values are 64 bit signed integers. They have type value t
.
Effects
val move : value t -> value t -> effect t
Move a value into a location.
move v1 v2
is valid whenv1
evaluates to either:box b
, which storesv2
inb
mem addr
, which storesv2
in memory at addressaddr
val seq : effect t -> effect t -> effect t
seq e1 e2
is the effect of first performinge1
and then performinge2
.
val cjump : rel -> value t -> value t -> label -> label -> effect t
Continue execution at one of two labels, based on a relation between values.
cjump rel v1 v2 l1 l2
comparesv1
andv2
according torel
. If the relation holds then execution continues at the location ofl1
. Otherwise, execution continues at the location ofl2
.
val jump : label -> effect t
Continue execution at the location of a label.
Note: Appel's
jump
is more complex: his takes the value of an address to jump to and a list of all possible labels that the address is referring to. The reason for this complexity is to support jumping to an address which is the result of a calculation, like aswitch
statement in the C programming language. For example, we may calculate the address to jump to from a base address and an offset. We must still know all the possible labels that the calculation could resolve to because that information is needed for data-flow analysis. Tiger doesn't need such functionality so we keep things simple.