This is the mail archive of the 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: [PATCH][LTO] Remove all stmt fixup on readin

On Wed, 14 Jul 2010, Diego Novillo wrote:

> On 10-07-14 10:15 , Richard Guenther wrote:
> > 
> > This is the first step to a somewhat saner fixup for mismatched decls.
> > Something I promised that will be possible with MEM_REF.  So, here it is.
> > The key is to have all possibly conflicting (thus, non-automatic)
> > VAR_DECLs wrapped in a MEM_REF.  Something I do not (yet?) enforce
> > for all GIMPLE IL, so just make sure to wrap them during LTO stream
> > output.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC 2k6 build
> > tested.  Ok?
> So, the idea would be that we can now lookup the MEM_REF operand instead of
> having to rewrite the IL when we stream in?

The whole point is that previously if we had VAR and replaced that with
its prevailing (mismatching) definition we lost the original type VAR
had at the place of its use.  Thus the funny way of fixing that up by
deriving that original type from the stmt context somehow.

With a MEM_REF wrapped around VAR the original type is preserved
when it is important (as TREE_TYPE of the MEM_REF), and the type
of VAR inside a MEM_REF doesn't matter.

> Shouldn't we need to fixup the type for the MEM_REF?

It automatically gets fixed up via the type-merging and global fixup
of types.

Consider two modules with conflicting definitions:

int x;
int foo () { return x; }
float x;
float bar () { return x; }

we choose either the int x or the float x to be prevailing.  The
global fixup of types and symbols replaces (for example) the float
x in the syms streamer cache with the int one.  So when reading in
the return x stmt we simply see a return of an int x (and have no
way of knowing it was float at this stmt).  With MEM_REF we now

float bar () { return MEM_REF [&x]; }

with TREE_TYPE (MEM_REF) == float.  Thus the prevailing symbol
replacing will not change the type of the MEM_REF but it will
become a VIEW_CONVERTing access of the int x.  Basically
all MEM_REFs are no-op VIEW_CONVERTs and become real VIEW_CONVERTs
once you replace incompatible symbols into them.

I hope that makes things clear.


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