Preserving alias analysis information

Roberto COSTA roberto.costa@st.com
Tue Feb 20 13:54:00 GMT 2007


Zdenek Dvorak wrote:
> Hello,
> 
>>>> In principle, I don't see anything forbidding Zdenek's idea.
>>>> Unfortunately, what I avoided to mention is that TARGET_MEM_REF nodes 
>>>> are also transformed into pointer arithmetics
>>>> and the equivalent 
>>>> INDIRECT_REF memory access... therefore, this is not an option even only 
>>>> because of that.
>>> hmm... why you do that?  Could you please describe more precisely what
>>> are you trying to achieve?
>> Sure!
>> The short answer is that, though most GIMPLE tree codes closely match 
>> what is representable in the CIL bytecode, some do not; hence, such 
>> codes are "lowered" into equivalent expressions that directly match what 
>> is representable in the bytecode.
> 
> this seems quite close to what TARGET_MEM_REFs are designed for.  IMHO,
> the best way would be to lower the memory references to TARGET_MEM_REFs
> (*) just once, sometime quite late in the optimization pipeline (just after
> loop optimizations, for example), so that high-level optimizers/alias
> analysis see the easy to understand code, while at least the essential
> cleanups are performed on the lower level code.

Hi Zdenek,
but the only kind of TARGET_MEM_REFs we would really allow would be 
those with a base and no symbol, no index, no step, no offset... which 
look to me like INDIRECT_REFs!
But if it were possible to make TARGET_MEM_REF carry alias information 
that INDIRECT_REFs are not able to carry, then I think it would make 
sense to transform non-zero index ARRAY_REFs into this very simple form 
of TARGET_MEM_REFs plus some pointer arithmetics.

This is an excerpt of tree.def:

/* Low-level memory addressing.  Operands are SYMBOL (static or global
    variable), BASE (register), INDEX (register), STEP (integer constant),
    OFFSET (integer constant).  Corresponding address is
    SYMBOL + BASE + STEP * INDEX + OFFSET.  Only variations and values 
valid on
    the target are allowed.

    The sixth argument is the reference to the original memory access, which
    is preserved for the purposes of the RTL alias analysis.  The seventh
    argument is a tag representing results of the tree level alias 
analysis.  */

DEFTREECODE (TARGET_MEM_REF, "target_mem_ref", tcc_reference, 7)

Are you talking about the seventh argument?

Cheers,
Roberto

> 
> Zdenek
> 
> (*) or just the pointer arithmetics like you do now, if you have some
> reasons for avoiding TMRs, although then you have to rerun the pass once
> later to get rid of invalid forms that may be created by the optimizers.



More information about the Gcc mailing list