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: RTL


On Tue, 2003-09-30 at 05:10, Sruthy C.N wrote:
>     you told that stack is 16 byte aligned for the MMX/SSE/SSE2
> instructions..I can see that the structure and array declarations are
> also 16 byte aligned..is this also for the same purpose?..

This isn't specific enough.  Are you looking at compiler output or
compiler source code?  If you are looking at compiler output, then you
might be seeing various effects that may or may not be guaranteed.  You
might be getting 16-byte alignment by accident.  Using something like
__alignof() will give much more accurate answers than looking at
assembly code.  Also, alignment depends on the structure/array type
declarations, but since you haven't given me an example, I can't be sure
what you are seeing.  Providing a testcase is often the best way to ask
a question.  I can't emphasize that enough.

The following testcase for instance clearly shows that a structure with
one char has only 1 byte alignment.

struct foo { char c; };

int
main (void)
{
  struct foo bar;
  struct foo baz;

  printf ("%d\n", __alignof (bar));
  printf ("%p\n", &bar);
  printf ("%d\n", __alignof (baz));
  printf ("%p\n", &baz);
  return 0;
}


>     In the RTl file all the strings will be replaced by some *.LC0 *.LC1
> etc..where exactly is this strings stored? how  you are accessing it?

These are constant pool references.  Accesses to the constant pool are
target dependent.  The compiler collects string constants and other
constant data items that are too large to be instruction immediates,
eliminates duplicates, and then emits them into a read only data
section.  Many parts of this are target dependent.  Constant pool
entries are preceded by a label which is used for loading the constant
into registers, or copying it to some other part of memory.

If you look at the assembly output instead of the RTL, you can see the
constant pool items.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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