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]

Re: Emit jump insn in function prologue


Peter Leist <peterleist@googlemail.com> writes:

> can I use emit_cmp_and_jump_insns while creating the function prologue/epilogue?
> If I try, I always get an error at runtime
>
> func.c:33: internal compiler error: in make_edges, at cfgbuild.c:354
>
> I think this is because the jump doesn't get an JUMP_LABEL associated to it.
> Is there an other way at this pass to add loops to the code?

Using a general function like emit_cmp_and_jump_insns when generating
the prologue is somewhat risky, because emit_cmp_and_jump_insns expects
to be run before reload.  It freely calls functions like force_reg and
gen_reg_rtx which may not be used before reload.

In the function prologue you should know precisely which insns you want
to emit.  It will be safer in general to use emit_insn (gen_XXX ())
rather than to call a general routine.

I don't know of any existing cases where the prologue needs a jump, but
it should be easy enough to emit a jump insn and set JUMP_LABEL
yourself.

Ian


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