This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: What does PHI node mean? [GCC Internals Manual]


Cheng Renquan schrieb:
> From: Andrew Haley <aph@redhat.com>
>> It's an interesting point.  Do you think that the gccint manual should
>> assume some knowledge of how optimizing compilers work?
>> It's explained in
>> Advanced Compiler Design and Implementation, Steven Muchnick, ISBN 1558603204
>> and
>> http://en.wikipedia.org/wiki/Static_single_assignment_form
>> We have never to my knowledge included links to Wikipedia in gcc
>> documentation, but this might be a good time to start.
>>
>> Andrew.
> 
> Thank you, I've also found SSA 's meaning through its abbrev wikipedia entry,
> 
> http://en.wikipedia.org/wiki/SSA
> 
> but for PHI, I still did't find a good entry,
> 
> http://en.wikipedia.org/wiki/PHI
> 
> Someone know what PHI means, please tell, thank you. My native language
> is not English, sorry for my understanding, but if someone really know
> "PHI", please tell, I will thank you;
> 
> All through gccint manual, I only find one paragraph, looks like a
> definition for "PHI function" or "PHI node", but it also doesn't explain
> what "PHI" abbrev for? is "PHI" part of some word, or initial letter of
> three words?

PHI is Phi-Function where Phi stands for uppercase greek Phi, i.e. &Phi; in
HTML or \Phi in TeX. It's a concept rather that an abbrev.

Suppose you have C code like

if (a)
   x = 1;
else
   x = 2;

In SSA form each variable must not be set more than once (statically).
So new names are introduced for x like x_1 and x_2

if (a)
   x_1 = 1;
else
   x_2 = 2;

These two values have to be "merged" again to get x. The magic
which does (or expresses) this is denoted as PHI and called
"Phi-Function":

if (a)
   x_1 = 1;
else
   x_2 = 2;

x = PHI (x_1, x_2)

> I mean: if gccint has a terminology index or table, at least explain
> what it abbreviated for, maybe that would look better;
> just like any technology book has a term glossary, at the end;

Yes, a glossary would be great.

Georg


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