public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* branch insn question
@ 2010-01-09 16:46 Dmitry Eremin-Solenikov
  2010-01-11  7:53 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-01-09 16:46 UTC (permalink / raw)
  To: cgen

Hello,

I've a small problem with branch instructions on my platorm (m68hc08).
All branch instructions are only short-ranged (signed 8bit offset).
The recommended way to handle this is to emit jump-over code: instead of
  beq _long_label
emit:
  bne .Lshort
  jmp _long_label
  .Lshort:

My question is: should this be handled somehow by cgen? Or this should
be completely done via gas relaxation? And what attributes should I use
on branch instructions in .cpu file?

Thank you.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: branch insn question
  2010-01-09 16:46 branch insn question Dmitry Eremin-Solenikov
@ 2010-01-11  7:53 ` Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2010-01-11  7:53 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov; +Cc: cgen

Dmitry Eremin-Solenikov wrote:
> Hello,
>
> I've a small problem with branch instructions on my platorm (m68hc08).
> All branch instructions are only short-ranged (signed 8bit offset).
> The recommended way to handle this is to emit jump-over code: instead of
>   beq _long_label
> emit:
>   bne .Lshort
>   jmp _long_label
>   .Lshort:
>
> My question is: should this be handled somehow by cgen? Or this should
> be completely done via gas relaxation? And what attributes should I use
> on branch instructions in .cpu file?
>
> Thank you.
>
>   

My first thought is that this should be handled at a higher layer than cgen.

OTOH, I can't quite disagree with adding macro-insns that implement 
jump-overs.
[Alas, macro insns at the moment are limited to simple 1->1 translations 
at the moment so that won't work;  I need to add support for 
multiple-insn macros,  I wouldn't wait for them for this though.]

As for how to handle this in gas, I think the standard 
copy-existing-port-and-cut-n-paste-n-tweak will work here.  Having not 
looked at gas relax support in awhile I just grepped for "relax" in the 
gas sources and found several promising starting points.  E.g. grep for 
TC_GENERIC_RELAX_TABLE.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-11  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-09 16:46 branch insn question Dmitry Eremin-Solenikov
2010-01-11  7:53 ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).