## nextcode-aliasing-g.pkg
# Compiled by:
#
src/lib/compiler/core.sublib# We are nowhere invoked.
generic package nextcode_aliasing_g (
# ===================
#
package frr: Nextcode_Ramregions; # Nextcode_Ramregions is from
src/lib/compiler/back/low/main/nextcode/nextcode-ramregions.api #
exception_handler_register: Int;
heap_allocation_pointer: Int;
)
{
package frr = frr; # nextcode_ramregions is from
src/lib/compiler/back/low/main/nextcode/nextcode-ramregions.pkg Reg = Int;
My_Def_Use =
{ m_def: List( Reg ), m_use: List( Reg ), r_def: List( Reg ), r_use: List( Reg ) };
rw = [65];
ro = [66];
stack = [67];
real = [68];
storelist = [69];
fun read_region frr::RW_MEM => { m_def=> [], m_use=> [], r_def=> [], r_use=>rw };
read_region frr::RO_MEM => { m_def=> [], m_use=> [], r_def=> [], r_use=>ro };
read_region frr::STACK => { m_def=> [], m_use=> [], r_def=> [], r_use=>stack };
read_region frr::REAL => { m_def=> [], m_use=> [], r_def=> [], r_use=>real };
read_region (frr::RVAR r) => { m_def=> [], m_use=> [r], r_def=> [], r_use=> [] };
read_region frr::STORELIST => { m_def=> [], m_use=> [], r_def=> [], r_use=>storelist };
read_region (frr::MUTABLE (defs, uses)) => read_region uses;
read_region (frr::RECORD [(d, u, _)])
=>
{ my { m_def=>a, m_use=>b, r_def=>c, r_use=>d } = read_region d;
my { m_def=>e, m_use=>f, r_def=>g, r_use=>h } = write_region u;
{ m_def=>a@e, m_use=>b@f,
r_def=>c@g, r_use=>d@h
};
};
read_region (frr::REGIONS (x, y))
=>
{ my { m_def=>a, m_use=>b, r_def=>c, r_use=>d } = read_region x;
my { m_def=>e, m_use=>f, r_def=>g, r_use=>h } = read_region y;
{ m_def=>a@e, m_use=>b@f,
r_def=>c@g, r_use=>d@h
};
};
end
also
fun write_region frr::RW_MEM => { m_def=> [], m_use=> [], r_def=>rw, r_use=> [] };
write_region frr::RO_MEM => { m_def=> [], m_use=> [], r_def=>ro, r_use=> [] };
write_region frr::STACK => { m_def=> [], m_use=> [], r_def=>stack, r_use=> [] };
write_region frr::REAL => { m_def=> [], m_use=> [], r_def=>real, r_use=> [] };
write_region (frr::RVAR r) => { m_def=> [r], m_use=> [], r_def=> [], r_use=> [] };
write_region frr::STORELIST => { m_def=> [], m_use=> [], r_def=>storelist, r_use=> [] };
write_region (frr::MUTABLE (defs, uses))
=>
write_region defs;
write_region (frr::RECORD [(d, u, _)])
=>
{ my { m_def=>a, m_use=>b, r_def=>c, r_use=>d } = read_region d;
my { m_def=>e, m_use=>f, r_def=>g, r_use=>h } = write_region u;
{ m_def=>a@e, m_use=>b@f,
r_def=>c@g, r_use=>d@h
};
};
write_region (frr::REGIONS (x, y))
=>
{ my { m_def=>a, m_use=>b, r_def=>c, r_use=>d } = write_region x;
my { m_def=>e, m_use=>f, r_def=>g, r_use=>h } = write_region y;
{ m_def=>a@e, m_use=>b@f,
r_def=>c@g, r_use=>d@h
};
};
end;
fun is_safe_read frr::RW_MEM => FALSE;
is_safe_read frr::RO_MEM => FALSE;
is_safe_read frr::STACK => TRUE;
is_safe_read frr::REAL => TRUE;
is_safe_read (frr::RVAR r) => FALSE;
is_safe_read frr::STORELIST => FALSE;
is_safe_read (frr::MUTABLE _) => FALSE;
is_safe_read (frr::RECORD [(d, u, _)]) => is_safe_read d;
is_safe_read (frr::REGIONS (a, b)) => is_safe_read a and is_safe_read b;
is_safe_read _ => FALSE;
end;
fun is_trap_safe_read frr::RW_MEM => FALSE;
is_trap_safe_read frr::RO_MEM => TRUE;
is_trap_safe_read frr::STACK => FALSE;
is_trap_safe_read frr::REAL => TRUE;
is_trap_safe_read (frr::RVAR r) => TRUE;
is_trap_safe_read frr::STORELIST => FALSE;
is_trap_safe_read (frr::MUTABLE _) => FALSE;
is_trap_safe_read (frr::RECORD [(d, u, _)]) => is_trap_safe_read d;
is_trap_safe_read (frr::REGIONS (a, b)) => is_trap_safe_read a
and is_trap_safe_read b;
is_trap_safe_read _ => FALSE;
end;
fun is_safe_write frr::RW_MEM => FALSE;
is_safe_write frr::RO_MEM => TRUE;
is_safe_write frr::STACK => FALSE;
is_safe_write frr::REAL => TRUE;
is_safe_write (frr::RVAR r) => TRUE;
is_safe_write frr::STORELIST => FALSE;
is_safe_write (frr::MUTABLE _) => FALSE;
is_safe_write (frr::RECORD [(d, u, _)]) => is_safe_write d;
is_safe_write (frr::REGIONS (a, b)) => is_safe_write a and is_safe_write b;
is_safe_write _ => FALSE;
end;
fun is_trap_safe_write mem
=
is_safe_write mem;
trap_barrier = { def => [heap_allocation_pointer],
uses => [heap_allocation_pointer],
m_def => [],
m_use => [],
r_use => [],
r_def => []
};
};