pro64-contrib
[Top] [All Lists]

Layout of stack frame

To: pro64-contrib@xxxxxxxxxxx
Subject: Layout of stack frame
From: "Benedict R. Gaster" <benedict.gaster@xxxxxx>
Date: Tue, 31 Jul 2001 10:50:20 +0100
Organization: STMicroelectronics
Sender: owner-pro64-contrib@xxxxxxxxxxx
Hello,

We have been working on porting the Pro64 to a new risc style processor
and have for the last week or  so had the compiler generating code,
albeit not completly correct due to stack frame layout being wrong.

Our ABI states that, in general, a stack frame takes the form:

  |--------------------------------| Previous SP 8-byte aligned
  | Parameter Register Save Area |
  |--------------------------------| 8-byte aligned
  | Register Save Area                  |             |
  |--------------------------------|             | direction of stack
growth
  | Local variables Area                |            \/
  |--------------------------------|    <--- SP or FP, 8-byte aligned
  | Dynamic Variable Area            |
  |--------------------------------|
  | Argument Area (for calls)         |
  |---------------------------------| 8-byte aligned

The default stack alignment, set in data_layout.cxx, is 8-bytes, unlike
the IA64, which seems to be 16.

Currently compiling the following program, at -O0,:

int foo(int x, int y)
{
   int local = 100;

   return x + y + local;
}

produces the stackframe

|-----------------|
| SP-0: local        |
|-----------------|
| SP-8:   x           |
| SP-12: y           |
|-----------------| <------ SP after function prolog.

The problem is that this does not conform to our ABI, as the locals
appear before the formals!

For simplicity we are currently we are using at small stack frame model
(SMODEL_SMALL), which does not require a frame pointer

The Pro64 compiler builds the stack frame from a set of sub-segments, of
type SF_SEGMENT, again defined in data_layout.cxx.

How are these sections ordered?

Is it possible to change the ordering of these sections so that the
final stack frame calculations apply to our ABI rather than that of the
IA64?

thank you for any help on this subject.

cheers,

ben.


<Prev in Thread] Current Thread [Next in Thread>