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]

Questions about the SSA reversion for formal parameters


    Hi Everyone:

    A test code fragment below:

int fun(int* a, int b)
{
	int c,d;
	b = 0;
	b = d;
	*a = b;
	a = &d;
	*a = b;
	b = c;
	b = *a;
	a = &b;
	return *a;
}

    has been transformed into SSA like this in GCC4.3.X:

fun (a, b)
{
  int d;
  int c;
  int D.1561;
  int b.2;
  int b.1;
  int d.0;

<bb 2>:
  b ={v} 0;
  d.0_1 = d;
  b ={v} d.0_1;
  b.1_2 = b;
  *a_3(D) ={v} b.1_2;
  a_4 = &d;
  b.1_5 = b;
  *a_4 ={v} b.1_5;
  b ={v} c_6(D);
  b.2_7 = *a_4;
  b ={v} b.2_7;
  a_8 = &b;
  D.1561_9 = *a_8;
  return D.1561_9;

}

    I found that something unusual to the formal parameters of the
function 'fun'.
    If the parameter was a scalar, wherever it got a new definition,
no new SSA version for it was created,just like the formal 'b'. But
sometimes SSA revision for formal parameters do work well.

    So, I am confused.
    Why does the compiler not rewirte the scalar parameters into new
SSA vars this time ? Is that contradictory to the definition of SSA ?
    If reversion for formals is done, is there any direct way to map
the original formal parameters to its first SSA version when it is
used somewhere ? Just like the way map pointer parameter 'a' to its
first use 'a_3'.

   Thanks a lot!


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