[<<][staapl][>>][..]
Fri Oct 3 18:43:41 CEST 2008

gimple

void boo(int *a, int *b){
	int i;
	for (i = 0; i<100; i++){
		a[i] += b[i];
	}
}

the -tree-gimple option gives

boo (a, b)
{
  unsigned int i.0;
  unsigned int D.1200;
  int * D.1201;
  unsigned int i.1;
  unsigned int D.1203;
  int * D.1204;
  int D.1205;
  unsigned int i.2;
  unsigned int D.1207;
  int * D.1208;
  int D.1209;
  int D.1210;
  int i;

  i = 0;
  goto <D.1197>;
  <D.1196>:;
  i.0 = (unsigned int) i;
  D.1200 = i.0 * 4;
  D.1201 = a + D.1200;
  i.1 = (unsigned int) i;
  D.1203 = i.1 * 4;
  D.1204 = a + D.1203;
  D.1205 = *D.1204;
  i.2 = (unsigned int) i;
  D.1207 = i.2 * 4;
  D.1208 = b + D.1207;
  D.1209 = *D.1208;
  D.1210 = D.1205 + D.1209;
  *D.1201 = D.1210;
  i = i + 1;
  <D.1197>:;
  if (i <= 99)
    {
      goto <D.1196>;
    }
  else
    {
      goto <D.1198>;
    }
  <D.1198>:;
}


This is quite lowlevel.  It doesn't have any structured elements. Just
"goto", "if" and assignment.  Also, all derefs are direct.  I wonder
how this is then mapped to addressing modes.

The -tree-original option gives this:

;; Function boo (boo)
;; enabled by -tree-original


{
  int i;

    int i;
  i = 0;
  goto <D.1197>;
  <D.1196>:;
  *(a + (unsigned int) ((unsigned int) i * 4)) = *(a + (unsigned int) ((unsigned int) i * 4)) + *(b + (unsigned int) ((unsigned int) i * 4));
  i++ ;
  <D.1197>:;
  if (i <= 99) goto <D.1196>; else goto <D.1198>;
  <D.1198>:;
}

It also just has if + goto.



[Reply][About]
[<<][staapl][>>][..]