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: trying to understand file-static variables in arm-linux-gcc


>if that is right, i would have to create some kind of data structure (a ggc root?)
>per call to compile_file() instead of per call to rest_of_compilation().  this
>would track the minipool info for the whole file, so that a unified minipool
>could be generated.

Yes, that seems broadly right.  You will have to take care of the case when 
functions in the same compilation unit don't end up in the same place in the 
object file -- ie when __attribute__ ((section)) is in use; other than 
that I can't think of any major pitfalls, but then I'm not all that familiar 
with the constant pool code anyway.

Actually, the more interesting part of what you mentioned as far as I'm 
concerned would be the avoidance of extra load instructions at runtime, rather 
than just removing duplicated constant pool entries.  In other words, finding 
SYMBOL_REFs that address locations with a known relationship, so that in code 
like:

static int a = 1, b = 2;

f() { return a + b; }

you could substitute (symbol_ref "b") with (plus (symbol_ref "a") (const_int 4))
or something along those lines.  Ideally one would like that code fragment to 
generate code a bit like what you currently get from:

static struct { int a, b; } s = { 1, 2 };

g()
{
  return s.a + s.b;
}

p.


PGP signature


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