Related articles |
---|
SSA in the presence of procedure calls devriese@cs.tcd.ie (Edsko de Vries) (2006-09-28) |
Re: SSA in the presence of procedure calls dnovillo@redhat.com (Diego Novillo) (2006-09-30) |
Re: SSA in the presence of procedure calls dannyb@google.com (Daniel Berlin) (2006-09-30) |
From: | "Daniel Berlin" <dannyb@google.com> |
Newsgroups: | comp.compilers |
Date: | 30 Sep 2006 17:45:11 -0400 |
Organization: | Compilers Central |
References: | 06-09-156 |
Keywords: | SSA, GCC |
Posted-Date: | 30 Sep 2006 17:45:11 EDT |
Edsko de Vries wrote:
> I have been trying to find some references about this problem, but so
> far have found none. If anyone can provide me with any pointers (papers
> or books), I'd appreciate it.
>
> The problem is trying to convert a program to SSA form, in the presence
> of procedure calls. Consider the following example:
>
> int* global_a;
>
> void f()
> {
> *global_a = 2;
> }
>
> void g()
> {
> int a, b;
> global_a = &a;
> a = 1;
> f();
> b = a;
> }
>
> How do I translate g() into SSA form? The problem is, of course, the
> last assignment - what subscript do we give to a? Do we need to insert
> a phi-function after the call to f (since without interprocedural
> analysis we have no way of knowing whether f does or does not modify
> a)? Let me emphasize that I'm not looking for an interprocedural SSA: a
> "simple" intraprocedural SSA is okay, but I need to be able to deal
> with function calls.
>
> To my surprise, gcc simply generated
>
> a.0 = 1;
> f();
> b.0 = a.0;
Actually, you are using the wrong dump flags if that is all you saw.
In order to get this correct, we do *not* rename global variables.
What we do instead is to overlay a virtual ssa that describes the
aliasing and call-side effects.
use -fdump-tree-<whatever>-vops to see the virtual operands.
HTH,
Dan
Return to the
comp.compilers page.
Search the
comp.compilers archives again.