public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* PPC optimizing question
@ 1999-05-01  3:52 Ralph Schmidt
  1999-05-01  8:30 ` David Edelsohn
  1999-05-31 21:36 ` Ralph Schmidt
  0 siblings, 2 replies; 6+ messages in thread
From: Ralph Schmidt @ 1999-05-01  3:52 UTC (permalink / raw)
  To: egcs

Can somebody explain me why egcs saves the LR
register and not simply does a

li 3,2
b O2 ?

for a simple void function or if the return
type is compatible i can't see a reason this
wouldn't be possible.


gcc -S -O2 -fomit-frame-pointer test4.c

typedef unsigned long ULONG ;

//register ULONG pc __asm("r11");


void	O2(int			Size)
{
}

void	O3(void)
{
  O2(2);
}


O2:
	blr

O3:
	stwu 1,-16(1)
	mflr 0
	stw 0,20(1)
	li 3,2
	bl O2
	lwz 0,20(1)
	mtlr 0
	la 1,16(1)
	blr


---
Ralph Schmidt,laire@popmail.owl.de(private),NextMail welcome 

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

* Re: PPC optimizing question
  1999-05-01  3:52 PPC optimizing question Ralph Schmidt
@ 1999-05-01  8:30 ` David Edelsohn
  1999-05-31 21:36   ` David Edelsohn
  1999-05-31 21:36 ` Ralph Schmidt
  1 sibling, 1 reply; 6+ messages in thread
From: David Edelsohn @ 1999-05-01  8:30 UTC (permalink / raw)
  To: laire; +Cc: egcs

	This is a general optimization question, not a PowerPC-specific
optimization question.  I believe this was discussed a few weeks ago,
possibly as part of tail recursion optimization?

David

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

* Re: PPC optimizing question
  1999-05-01  8:30 ` David Edelsohn
@ 1999-05-31 21:36   ` David Edelsohn
  0 siblings, 0 replies; 6+ messages in thread
From: David Edelsohn @ 1999-05-31 21:36 UTC (permalink / raw)
  To: laire; +Cc: egcs

	This is a general optimization question, not a PowerPC-specific
optimization question.  I believe this was discussed a few weeks ago,
possibly as part of tail recursion optimization?

David

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

* PPC optimizing question
  1999-05-01  3:52 PPC optimizing question Ralph Schmidt
  1999-05-01  8:30 ` David Edelsohn
@ 1999-05-31 21:36 ` Ralph Schmidt
  1 sibling, 0 replies; 6+ messages in thread
From: Ralph Schmidt @ 1999-05-31 21:36 UTC (permalink / raw)
  To: egcs

Can somebody explain me why egcs saves the LR
register and not simply does a

li 3,2
b O2 ?

for a simple void function or if the return
type is compatible i can't see a reason this
wouldn't be possible.


gcc -S -O2 -fomit-frame-pointer test4.c

typedef unsigned long ULONG ;

//register ULONG pc __asm("r11");


void	O2(int			Size)
{
}

void	O3(void)
{
  O2(2);
}


O2:
	blr

O3:
	stwu 1,-16(1)
	mflr 0
	stw 0,20(1)
	li 3,2
	bl O2
	lwz 0,20(1)
	mtlr 0
	la 1,16(1)
	blr


---
Ralph Schmidt,laire@popmail.owl.de(private),NextMail welcome

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

* Re: PPC optimizing question
  1999-05-01 16:01 Alex Rosenberg
@ 1999-05-31 21:36 ` Alex Rosenberg
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Rosenberg @ 1999-05-31 21:36 UTC (permalink / raw)
  To: egcs

> Can somebody explain me why egcs saves the LR
> register and not simply does a
>
> li 3,2
> b O2 ?
>
> for a simple void function or if the return
> type is compatible i can't see a reason this
> wouldn't be possible.

In the AIX (and Mac OS) runtime, this "tail call" optimization is illegal if
O2 might be exported. This usually limits this optimization to static
functions whose address is not taken.

+------------------------------------------------------------+
| Alexander M. Rosenberg           < mailto:alexr@_spies.com > |
| Nobody cares what I say. Remove the underscore to mail me. |

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

* Re: PPC optimizing question
@ 1999-05-01 16:01 Alex Rosenberg
  1999-05-31 21:36 ` Alex Rosenberg
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Rosenberg @ 1999-05-01 16:01 UTC (permalink / raw)
  To: egcs

> Can somebody explain me why egcs saves the LR
> register and not simply does a
>
> li 3,2
> b O2 ?
>
> for a simple void function or if the return
> type is compatible i can't see a reason this
> wouldn't be possible.

In the AIX (and Mac OS) runtime, this "tail call" optimization is illegal if
O2 might be exported. This usually limits this optimization to static
functions whose address is not taken.

+------------------------------------------------------------+
| Alexander M. Rosenberg           < mailto:alexr@_spies.com > |
| Nobody cares what I say. Remove the underscore to mail me. |

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

end of thread, other threads:[~1999-05-31 21:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-01  3:52 PPC optimizing question Ralph Schmidt
1999-05-01  8:30 ` David Edelsohn
1999-05-31 21:36   ` David Edelsohn
1999-05-31 21:36 ` Ralph Schmidt
1999-05-01 16:01 Alex Rosenberg
1999-05-31 21:36 ` Alex Rosenberg

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).