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]

RE: Memory layout (novice questions).


Mike> Why?  What you want to ask is a different question, one probably
Mike> better suited to comp.lang.c, but I don't know what that question is.
Mike> I'd rather answer your real question, than this one.  It might have a
Mike> better answer than this one.
	I think I didn't ask the question in a proper way, but most certainly THIS
is the place where I should ask it. I will explain below.

Virgil > there is no way to ask gcc to do this (please correct me if I am
Virgil > wrong).

Mike> Well, you can almost do this.  Put everything in a structure with the
Mike> exact layout you want, and then declare a variable of the structure
Mike> [.....]
Mike> portable, isn't documented, and won't work across targets, or across
Mike> compiler versions, unless you just have some more blind luck.

   I don't want to do this. What I want is to implement some kind of
optimization. As you all know, on some (most, I think) machines you can do
loads like
    load REGx, [SP+ xxxx]
where xxxx is an immediate value (usually a short one - on the architecture
I am working on, I only have 5 bits available). These kind of instructions
are used intensively to load/store local variables to/from registers.
Of course I would like to have as much variables as possible available at
short offsets from SP, and thus placing the shorter ones in front seems to
be a good idea. So what I actually want to do is sort the variables by size.
I don't think that GCC does that currently ( but of course I might be
wrong), so I wanted to implement it myself.

           Virgil.


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