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: AVR indirect_jump addresses limited to 16 bits


On Sat, Mar 19, 2005 at 06:37:54PM -0500, Paul Schlie wrote:

> - or possibly GCC may try to be clever by jumping to no-return attribute
>   function calls?

Such "trying to be clever" would most likely be optional.
Again, why is indirect_jump _mandatory_ on all machines?

Please, don't try to be too clever :) - just look at the GCC source
and try to figure out exactly what is indirect_jump used for, and how
much of this (if anything) matters for the AVR port.

If the address of a label is loaded into a register, then we have to
switch to a different section around that label:

	/* ... */
	jmp label
	.section .text_low,"ax",@progbits
label:
	jmp 1f
	.text
1:
	/* ... */

then it will be safe to load the address of the label into a register,
no need to do anything with the highest bits as pm_hh8(label) == 0:

	ldi r30,pm_lo8(label)
	ldi r31,pm_hi8(label)
	/* ... */
	ijmp	; PC <- 0:r31:r30

Note that this adds two jumps around the label, so we only want to
do it infrequently - if the address of the label is loaded into
a register (not if the only users of the label are direct jumps).

Thanks,
Marek


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