Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

# Type-Based Alias Analysis

Oct00: Type-Based Alias Analysis

```<b>(a) </b>
double  u_m;
double  v_m;

typedef struct s {
int     n_m;
double* x_m;
double* a_m;
double* b_m;
} s;
void f(struct s* s)
{
int i;
for (i=0; i < s->n_m; ++i)
s->x_m[i] = (u_m * s->a_m[i]) + (v_m * s->b_m[i]);
}

<b>(b) </b>
.L9:
sll     \$3,\$5,3       	# Multiply i by 8
mul.d   \$f1,\$f3,\$f1   	# Multiply u_m * s->a_m[i]
mul.d   \$f0,\$f2,\$f0   	# Multiply v_m * s->b_m[i]
s.d     \$f1,0(\$3)     	# Store the sum into s->x_m[i]
slt     \$2,\$5,\$2      	# Subtract s->n_m from i
bnel    \$2,\$0,.L9     	# If i < s->n_m goto .L9

<b>(c) </b>
.L6:
mul.d   \$f1,\$f3,\$f1  	# Multiply u_m * s->a_m[i]
mul.d   \$f0,\$ff0  	# Multiply v_m * s->b_m[i]
addu    \$3,\$3,8      	# Increment pointer to s->b_m[i]
addu    \$4,\$4,8      	# Increment pointer to s->a_m[i]
s.d     \$f1,0(\$5)    	# Store the sum into s->x_m[i]
bne     \$2,\$0,.L6    	# If i < s->n_m goto .L6
addu    \$5,\$5,8      	# Increment pointer to s->x_m[i]

```

### More Insights

 To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.