This is the mail archive of the cgen@sourceware.org mailing list for the CGEN 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: branch insn question


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.


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