public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Oddities in ARM (stack handling)
@ 2001-11-21 15:56 Adrian von Bidder
  2001-11-21 16:13 ` Nick Clifton
  2001-11-29  9:05 ` Adrian von Bidder
  0 siblings, 2 replies; 4+ messages in thread
From: Adrian von Bidder @ 2001-11-21 15:56 UTC (permalink / raw)
  To: gcc

Hi!

While debugging my membedded-pic (formerly disable-got by Vlad Lebedev)
patch I discovered that my patch also influences code generation with my
flag disabled. Damn.

To find out where to start: with patch, a function compiles with
frame_needed = 0, 3.0.2 vanilla compiles the function to frame_neede =
1.

So I wonder what influences the decision whether a given function needs
a frame pointer (the only point where frame_pointer_needed is set seems
to be in reload1.c, and I don't understand the explanation there. Also I
did not change that file).

Additionally - and this is the odditiy I'm speaking of in the subject -
the unchainged functions saves the registers with "stmfd {
everything..., pc }".

I wonder why to save the pc - it is never loaded, nor is the space
reserved on the stack ever needed.
 
greets from Zürich
-- vbi

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

* Re: Oddities in ARM (stack handling)
  2001-11-21 15:56 Oddities in ARM (stack handling) Adrian von Bidder
@ 2001-11-21 16:13 ` Nick Clifton
  2001-11-29  9:39   ` Nick Clifton
  2001-11-29  9:05 ` Adrian von Bidder
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2001-11-21 16:13 UTC (permalink / raw)
  To: Adrian von Bidder; +Cc: gcc

Hi Adrian,

> So I wonder what influences the decision whether a given function
> needs a frame pointer (the only point where frame_pointer_needed is
> set seems to be in reload1.c, and I don't understand the explanation
> there. Also I did not change that file).

The macro FRAME_POINTER_REQUIRED is also relevant.  (see arm.h)
 
> Additionally - and this is the odditiy I'm speaking of in the
> subject - the unchainged functions saves the registers with "stmfd { 
> everything..., pc }".
> 
> I wonder why to save the pc - it is never loaded, nor is the space
> reserved on the stack ever needed.

Because it creates a stack frame, as per the ARM Procedure Call
Standard.  The APCS says that frames are optional, so if the frame
pointer is not needed the stack frame is not created, but if the frame
pointer is needed then the code creates a valid stack frame.

Cheers
        Nick

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

* Oddities in ARM (stack handling)
  2001-11-21 15:56 Oddities in ARM (stack handling) Adrian von Bidder
  2001-11-21 16:13 ` Nick Clifton
@ 2001-11-29  9:05 ` Adrian von Bidder
  1 sibling, 0 replies; 4+ messages in thread
From: Adrian von Bidder @ 2001-11-29  9:05 UTC (permalink / raw)
  To: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Hi!

While debugging my membedded-pic (formerly disable-got by Vlad Lebedev)
patch I discovered that my patch also influences code generation with my
flag disabled. Damn.

To find out where to start: with patch, a function compiles with
frame_needed = 0, 3.0.2 vanilla compiles the function to frame_neede =
1.

So I wonder what influences the decision whether a given function needs
a frame pointer (the only point where frame_pointer_needed is set seems
to be in reload1.c, and I don't understand the explanation there. Also I
did not change that file).

Additionally - and this is the odditiy I'm speaking of in the subject -
the unchainged functions saves the registers with "stmfd {
everything..., pc }".

I wonder why to save the pc - it is never loaded, nor is the space
reserved on the stack ever needed.
 
greets from Zürich
-- vbi

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

* Re: Oddities in ARM (stack handling)
  2001-11-21 16:13 ` Nick Clifton
@ 2001-11-29  9:39   ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2001-11-29  9:39 UTC (permalink / raw)
  To: Adrian von Bidder; +Cc: gcc

Hi Adrian,

> So I wonder what influences the decision whether a given function
> needs a frame pointer (the only point where frame_pointer_needed is
> set seems to be in reload1.c, and I don't understand the explanation
> there. Also I did not change that file).

The macro FRAME_POINTER_REQUIRED is also relevant.  (see arm.h)
 
> Additionally - and this is the odditiy I'm speaking of in the
> subject - the unchainged functions saves the registers with "stmfd { 
> everything..., pc }".
> 
> I wonder why to save the pc - it is never loaded, nor is the space
> reserved on the stack ever needed.

Because it creates a stack frame, as per the ARM Procedure Call
Standard.  The APCS says that frames are optional, so if the frame
pointer is not needed the stack frame is not created, but if the frame
pointer is needed then the code creates a valid stack frame.

Cheers
        Nick

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

end of thread, other threads:[~2001-11-29 17:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-21 15:56 Oddities in ARM (stack handling) Adrian von Bidder
2001-11-21 16:13 ` Nick Clifton
2001-11-29  9:39   ` Nick Clifton
2001-11-29  9:05 ` Adrian von Bidder

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