This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: protect label from being optimized
- From: Joern Rennecke <joernr at arc dot com>
- To: gcc at gcc dot gnu dot org
- Cc: iant at google dot com, kunalparmar at gmail dot com
- Date: Fri, 18 Apr 2008 15:51:22 +0100
- Subject: Re: protect label from being optimized
> Kunal Parmar <kunalparmar@gmail.com> writes:
>
> > Is this correct :
> > ret_label = gen_label_rtx ();
> > emit_move_insn (gen_rtx_REG (HImode, 7),
> > gen_rtx_LABEL_REF (VOIDmode,
> > ret_label));
> > emit_call_insn (gen_brc_call_simulate (addr, args_size));
> > emit_label (ret_label);
Ian Lance Taylor:
> It looks plausible.
It looks like a mis-optimization waiting to happen.
Nothing tells the compiler that it can't move an instruction
bewteen the call and the label.
You are better off generating the label or immediately emitting the
assembly for the label when you emit the assembly code for the call.