This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Ada's use of mark_all_temps_used


Ada does:

/* Insert the code for GNAT_NODE at the position saved for that node. */

void
insert_code_for (gnat_node)
Node_Id gnat_node;
{
if (global_bindings_p ())
{
push_pending_elaborations ();
gnat_to_code (gnat_node);
Check_Elaboration_Code_Allowed (gnat_node);
insert_elaboration_list (get_gnu_tree (gnat_node));
pop_pending_elaborations ();
}
else
{
rtx insns;

do_pending_stack_adjust ();
start_sequence ();
mark_all_temps_used ();
gnat_to_code (gnat_node);
do_pending_stack_adjust ();
insns = get_insns ();
end_sequence ();
emit_insn_after (insns, RTL_EXPR_RTL (get_gnu_tree (gnat_node)));
}
}

I have a question, do you really mean to mark all temp slots, including those that had been allocated and freed already as used and kept?

mark_all_temps_used ()
{
struct temp_slot *p;

for (p = temp_slots; p; p = p->next)
{
p->in_use = p->keep = 1;
p->level = MIN (p->level, temp_slot_level);
}
}

It seems slightly beyond clean to do this. What if the compiler grabs a temp slot for pic or something after you freed a slot, and before you mark all temps used? Also, if the temp slot had been in use before but not now, why preserve the previous level? Isn't temp_slot_level enough?

I'm redoing the slot code and came across these interesting semantics.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]