question on ssa representation of aggregates

Amker.Cheng amker.cheng@gmail.com
Fri Oct 22 09:56:00 GMT 2010


Hi :
   In paper "Memory SSA-A Unified Approach for Sparsely Representing
Memory Operations",
section 2.2, it says :

"Whenever possible, compiler will create symbolic names to represent distinct
regions inside aggregates(called structure field tags or SFT). For instance,
in Figure 2(b), GCC will create three SFT symbols for this structure, namely
SFT.0 for A.x, SFT.1 for A.b and SFT.2 for A.a"

I tried GCC4.4.1(mips target) with following piece of code,
-------------------------------start
struct tag_1
{
  int *i;
  int *j;
  int *x;
  int y;
}a;
struct tag_2
{
  struct tag_1 t1[100];
  int x[200];
  int *y;
}s;
int func(int **p)
{
    int *c = *p;
    if (a.y > 0)
      s.y = *p1;
    else
      *c = *s.y;

  return 0;
}
-------------------------------end
The "055t.alias" dumped are like,
-------------------------------start
func (int * * p)
{
  int * c;
  int * gp.2;
  int g.1;
  int D.1352;
  int * D.1351;
  int * D.1349;
  int * * p1.0;
  int D.1345;

<bb 2>:
  # VUSE <gp_12(D), a_13(D), arr_14(D), s_15(D), SMT.13_16(D)>
  c_2 = *p_1(D);
  # VUSE <a_13(D)>
  D.1345_3 = a.y;
  if (D.1345_3 > 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  # VUSE <p1_17(D)>
  p1.0_4 = p1;
  # VUSE <gp_12(D), a_13(D), arr_14(D), s_15(D), SMT.13_16(D)>
  D.1349_5 = *p1.0_4;
  # s_18 = VDEF <s_15(D)>
  s.y = D.1349_5;
  goto <bb 5>;

<bb 4>:
  # VUSE <s_15(D)>
  D.1351_6 = s.y;
  # VUSE <g_19(D), a_13(D), s_15(D), SMT.14_20(D)>
  D.1352_7 = *D.1351_6;
  # g_21 = VDEF <g_19(D)>
  # a_22 = VDEF <a_13(D)>
  # s_23 = VDEF <s_15(D)>
  # SMT.14_24 = VDEF <SMT.14_20(D)>
  *c_2 = D.1352_7;
-------------------------------end.

it seems structure a and s are treated as array variables, no SFT is created.

Did I miss anything or the implementation is different? Thanks.
-- 
Best Regards.



More information about the Gcc mailing list