cmput 680 - compiler design and optimization1 cmput680 - fall 2006 topic 3: intermediate...
TRANSCRIPT
CMPUT 680 - Compiler Design and Optimization
1
CMPUT680 - Fall 2006
Topic 3: Intermediate Representation in the ORC José Nelson Amaralhttp://www.cs.ualberta.ca/~amaral/courses/680
CMPUT 680 - Compiler Design and Optimization
2
WHIRL
The Open Research Compiler (ORC) uses a tree-based intermediate representation called WHIRL,which stands for Winning Hierarchical IntermediateRepresentation Language.
CMPUT 680 - Compiler Design and Optimization
3
Compilation Example#include <stdlib.h>#include <stdio.h>#define COUNTINIT 1.0
void InitializeMatrix(double *A, int dimension);void InitializeVector(double *B, int dimension);void MatrixVectorMultiply(double *C, double *A, double *B, int dimension);void OutputVector(double *C, int dimension);
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
CMPUT 680 - Compiler Design and Optimization
4
Compilation Example (cont.)
void InitializeVector(double *B, int dimension){ int i; double count = 1.0; for(i=0 ; i<dimension ; i++) B[i] = count++;}
void InitializeMatrix(double *A, int dimension){ int i,j; double count = 1.0; for(i=0 ; i<dimension ; i++) for(j=0 ; j<dimension ; j++) A[i][I] = count++;}
void MatrixVectorMultiply(double *C, double *A, double *B, int dimension){ int i, j; for(i=0 ; i<dimension ; i++) { C[i] = 0.0; for(j=0 ; j<dimension ; j++) C[i] = C[i] + A[i*dimension+j]*B[j]; }}
void OutputVector(double *C, int dimension){ int i; printf("C = [ "); for(i=0 ; i<dimension ; i++) printf("%g ",C[i]); printf("]\n");}
CMPUT 680 - Compiler Design and Optimization
5
Highest WHIRL Representation
FUNC_ENTRY <L:1,I20,main> [0x0x2b1c91d8],MID=0 IDNAME O_0 <L:2,I1,argc> [0x0x2b1c9200],MID=0 IDNAME O_0 <L:2,I2,argv> [0x0x2b1c921c],MID=1BODY BLOCK [0x0x2b1c9248],MID=0 END_BLOCK [0x0x2b1c9248] BLOCK [0x0x2b1c9274],MID=1 END_BLOCK [0x0x2b1c9274] BLOCK [0x0x80ed668],MID=2 PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0
I4I4LDID O_0: A direct load of a 4 byte integer into a 4 byte integer register withofset of 0.
CMPUT 680 - Compiler Design and Optimization
6
Highest WHIRL Representation
FUNC_ENTRY <L:1,I20,main> [0x0x2b1c91d8],MID=0 IDNAME O_0 <L:2,I1,argc> [0x0x2b1c9200],MID=0 IDNAME O_0 <L:2,I2,argv> [0x0x2b1c921c],MID=1BODY BLOCK [0x0x2b1c9248],MID=0 END_BLOCK [0x0x2b1c9248] BLOCK [0x0x2b1c9274],MID=1 END_BLOCK [0x0x2b1c9274] BLOCK [0x0x80ed668],MID=2 PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0
I4INTCONST: Access a 4 byte integer constant.CV(2): The value of the constant is 2.
CMPUT 680 - Compiler Design and Optimization
7
Highest WHIRL Representation
FUNC_ENTRY <L:1,I20,main> [0x0x2b1c91d8],MID=0 IDNAME O_0 <L:2,I1,argc> [0x0x2b1c9200],MID=0 IDNAME O_0 <L:2,I2,argv> [0x0x2b1c921c],MID=1BODY BLOCK [0x0x2b1c9248],MID=0 END_BLOCK [0x0x2b1c9248] BLOCK [0x0x2b1c9274],MID=1 END_BLOCK [0x0x2b1c9274] BLOCK [0x0x80ed668],MID=2 PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0
I4I4NE: Tests if two four byte valuesare not equal.
CMPUT 680 - Compiler Design and Optimization
8
Highest WHIRL Representation
FUNC_ENTRY <L:1,I20,main> [0x0x2b1c91d8],MID=0 IDNAME O_0 <L:2,I1,argc> [0x0x2b1c9200],MID=0 IDNAME O_0 <L:2,I2,argv> [0x0x2b1c921c],MID=1BODY BLOCK [0x0x2b1c9248],MID=0 END_BLOCK [0x0x2b1c9248] BLOCK [0x0x2b1c9274],MID=1 END_BLOCK [0x0x2b1c9274] BLOCK [0x0x80ed668],MID=2 PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0
VCALL: A call to a function that returns an item of type void.
U8PARM: An 8-byte unsigned parameterfor the function.
U8LDA: Accesses the address, in bytes,of the string.0_0: Add offset of zero to the address.
CMPUT 680 - Compiler Design and Optimization
9
Highest WHIRL Representation
FUNC_ENTRY <L:1,I20,main> [0x0x2b1c91d8],MID=0 IDNAME O_0 <L:2,I1,argc> [0x0x2b1c9200],MID=0 IDNAME O_0 <L:2,I2,argv> [0x0x2b1c921c],MID=1BODY BLOCK [0x0x2b1c9248],MID=0 END_BLOCK [0x0x2b1c9248] BLOCK [0x0x2b1c9274],MID=1 END_BLOCK [0x0x2b1c9274] BLOCK [0x0x80ed668],MID=2 PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
FUNC_ENTRY(main)
IDNAME(argc)
IDNAME(argv)
BLOCK BLOCK BLOCK
CMPUT 680 - Compiler Design and Optimization
10
Highest WHIRL Representation
PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0LOC 1 21 exit(1); I4INTCONST CV(1) (0x1) [0x0x2b1c947c],MID=8 I4PARM Flg(2) T<I4,.predef_I4,A4> # by_value [0x0x2b1c9460],MID=7 VCALL Flg(126) <L:1,I24,exit> # flags 0x7e [0x0x2b1c9444],MID=1 END_BLOCK [0x0x80ed698] ELSE BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 }
FUNC_ENTRY(main)
IDNAME(argc)
IDNAME(argv)
BLOCK BLOCK BLOCK
IF
NE
CV(2) LDID(argc)
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
CMPUT 680 - Compiler Design and Optimization
11
Highest WHIRL Representation
PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0LOC 1 21 exit(1); I4INTCONST CV(1) (0x1) [0x0x2b1c947c],MID=8 I4PARM Flg(2) T<I4,.predef_I4,A4> # by_value [0x0x2b1c9460],MID=7 VCALL Flg(126) <L:1,I24,exit> # flags 0x7e [0x0x2b1c9444],MID=1 END_BLOCK [0x0x80ed698] ELSE BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 }
NC_ENTRY(main)
BLOCK BLOCK BLOCK
IF
NE
CV(2) LDID(argc)
BLOCK(THEN)
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
VCALL(printf)
VCALL(exit)
PARMPARM
LDID(stderr)
LDA<string>
PARM
CV(1)
CMPUT 680 - Compiler Design and Optimization
12
Highest WHIRL Representation
PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1c92cc],MID=0 LOC 1 14 double *A; LOC 1 15 double *B; LOC 1 16 double *C; LOC 1 17 LOC 1 18 if(argc != 2) IF [0x0x2b1c92f8],MID=3 I4I4LDID O_0 <L:2,I1,argc> T<I4,.predef_I4,A4> [0x0x2b1c9334],MID=0 I4INTCONST CV(2) (0x2) [0x0x2b1c9350],MID=3 I4I4NE [0x0x2b1c9318],MID=2 THEN BLOCK [0x0x80ed698],MID=4 LOC 1 19 { LOC 1 20 fprintf(stderr,"Syntax: linear <dimension>\n"); U8U8LDID O_0 <L:1,I22,stderr> T<I33,anon_ptr.,A8> [0x0x2b1c93e0],MID=1 U8PARM Flg(2) T<I33,anon_ptr.,A8> # by_value [0x0x2b1c93c4],MID=4 U8LDA O_0 <L:1,I23,(28_bytes)_"Syntax:_linear_<dimension>\n\000"> T<I40,anon_ptr.,A8> [0x0x2b1c9418],MID=6 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c93fc],MID=5 VCALL Flg(126) <L:1,I21,fprintf> # flags 0x7e [0x0x2b1c93a8],MID=0LOC 1 21 exit(1); I4INTCONST CV(1) (0x1) [0x0x2b1c947c],MID=8 I4PARM Flg(2) T<I4,.predef_I4,A4> # by_value [0x0x2b1c9460],MID=7 VCALL Flg(126) <L:1,I24,exit> # flags 0x7e [0x0x2b1c9444],MID=1 END_BLOCK [0x0x80ed698] ELSE BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 }
NC_ENTRY(main)
BLOCK BLOCK BLOCK
IF
NE
CV(2) LDID(argc)
BLOCK(THEN)
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
VCALL(printf)
VCALL(exit)
PARMPARM
LDID(stderr)
LDA<string>
PARM
CV(1)
BLOCK(ELSE)
CMPUT 680 - Compiler Design and Optimization
13
Highest WHIRL Representation ELSE
BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 } LOC 1 23 dimension = atoi(argv[1]); U8U8LDID O_0 <L:2,I2,argv> T<I29,anon_ptr.,A8> [0x0x2b1c959c],MID=3 U8U8ILOAD O_8 T<I37,anon_ptr.,A8> T<I29,anon_ptr.,A8> [0x0x2b1c9580],MID=2 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c9564],MID=9 I4CALL Flg(126) <L:1,I25,atoi> # flags 0x7e [0x0x2b1c9548],MID=2 I4I4LDID O_-1 <L:1,I19,.preg_return_val> T<I4,.predef_I4,A4> [0x0x2b1c95b8],MID=5 I4STID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed788],MID=4 I4I4LDID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed7a8],MID=7 I4STID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c94d4],MID=6 LOC 1 24 LOC 1 25 A = (double *)malloc(dimension*dimension*sizeof(double)); I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c96e4],MID=8 I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c9700],MID=9 I4MPY [0x0x2b1c96c8],MID=13 U8I4CVT [0x0x2b1c96ac],MID=12 U8INTCONST CV(8) (0x8) [0x0x2b1c971c],MID=14 U8MPY [0x0x2b1c9690],MID=11 U8PARM Flg(2) T<I9,.predef_U8,A8> # by_value [0x0x2b1c9674],MID=10 U8CALL Flg(126) <L:1,I26,malloc> # flags 0x7e [0x0x2b1c9658],MID=3 U8U8LDID O_-1 <L:1,I19,.preg_return_val> T<I35,anon_ptr.,A8> [0x0x2b1c9738],MID=11 U8STID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed838],MID=10 U8U8LDID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed858],MID=13 U8STID O_0 <L:2,I4,A> T<I43,anon_ptr.,A8> [0x0x2b1c95e4],MID=12
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
BLOCK
IF
BLOCK(THEN)
VCALL(printf)
VCALL(exit)
PARMPARM
LDID(stderr)
LDA<string>
PARM
CV(1)
BLOCK(ELSE)
I4CALL(atoi)
PARM
ILOAD
LDID(argv)
CMPUT 680 - Compiler Design and Optimization
14
Highest WHIRL Representation ELSE
BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 } LOC 1 23 dimension = atoi(argv[1]); U8U8LDID O_0 <L:2,I2,argv> T<I29,anon_ptr.,A8> [0x0x2b1c959c],MID=3 U8U8ILOAD O_8 T<I37,anon_ptr.,A8> T<I29,anon_ptr.,A8> [0x0x2b1c9580],MID=2 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c9564],MID=9 I4CALL Flg(126) <L:1,I25,atoi> # flags 0x7e [0x0x2b1c9548],MID=2 I4I4LDID O_-1 <L:1,I19,.preg_return_val> T<I4,.predef_I4,A4> [0x0x2b1c95b8],MID=5 I4STID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed788],MID=4 I4I4LDID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed7a8],MID=7 I4STID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c94d4],MID=6 LOC 1 24 LOC 1 25 A = (double *)malloc(dimension*dimension*sizeof(double)); I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c96e4],MID=8 I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c9700],MID=9 I4MPY [0x0x2b1c96c8],MID=13 U8I4CVT [0x0x2b1c96ac],MID=12 U8INTCONST CV(8) (0x8) [0x0x2b1c971c],MID=14 U8MPY [0x0x2b1c9690],MID=11 U8PARM Flg(2) T<I9,.predef_U8,A8> # by_value [0x0x2b1c9674],MID=10 U8CALL Flg(126) <L:1,I26,malloc> # flags 0x7e [0x0x2b1c9658],MID=3 U8U8LDID O_-1 <L:1,I19,.preg_return_val> T<I35,anon_ptr.,A8> [0x0x2b1c9738],MID=11 U8STID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed838],MID=10 U8U8LDID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed858],MID=13 U8STID O_0 <L:2,I4,A> T<I43,anon_ptr.,A8> [0x0x2b1c95e4],MID=12
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
BLOCK
IF
BLOCK(THEN)
VCALL(printf)
VCALL(exit)
PARMPARM
LDID(stderr)
LDA<string>
PARM
CV(1)
BLOCK(ELSE)
I4CALL(atoi)
PARM
ILOAD
LDID(argv)
STID(preg)
LDID(ret_val.)
CMPUT 680 - Compiler Design and Optimization
15
Highest WHIRL Representation ELSE
BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 } LOC 1 23 dimension = atoi(argv[1]); U8U8LDID O_0 <L:2,I2,argv> T<I29,anon_ptr.,A8> [0x0x2b1c959c],MID=3 U8U8ILOAD O_8 T<I37,anon_ptr.,A8> T<I29,anon_ptr.,A8> [0x0x2b1c9580],MID=2 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c9564],MID=9 I4CALL Flg(126) <L:1,I25,atoi> # flags 0x7e [0x0x2b1c9548],MID=2 I4I4LDID O_-1 <L:1,I19,.preg_return_val> T<I4,.predef_I4,A4> [0x0x2b1c95b8],MID=5 I4STID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed788],MID=4 I4I4LDID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed7a8],MID=7 I4STID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c94d4],MID=6 LOC 1 24 LOC 1 25 A = (double *)malloc(dimension*dimension*sizeof(double)); I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c96e4],MID=8 I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c9700],MID=9 I4MPY [0x0x2b1c96c8],MID=13 U8I4CVT [0x0x2b1c96ac],MID=12 U8INTCONST CV(8) (0x8) [0x0x2b1c971c],MID=14 U8MPY [0x0x2b1c9690],MID=11 U8PARM Flg(2) T<I9,.predef_U8,A8> # by_value [0x0x2b1c9674],MID=10 U8CALL Flg(126) <L:1,I26,malloc> # flags 0x7e [0x0x2b1c9658],MID=3 U8U8LDID O_-1 <L:1,I19,.preg_return_val> T<I35,anon_ptr.,A8> [0x0x2b1c9738],MID=11 U8STID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed838],MID=10 U8U8LDID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed858],MID=13 U8STID O_0 <L:2,I4,A> T<I43,anon_ptr.,A8> [0x0x2b1c95e4],MID=12
int main(int argc, char *argv[]){ int dimension; double *A; double *B; double *C;
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
BLOCK(ELSE)
I4CALL(atoi)
PARM
ILOAD
LDID(argv)
STID(preg)
LDID(ret_val.)
STID(dimension)
LDID(preg)
CMPUT 680 - Compiler Design and Optimization
16
Highest WHIRL Representation ELSE
BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 } LOC 1 23 dimension = atoi(argv[1]); U8U8LDID O_0 <L:2,I2,argv> T<I29,anon_ptr.,A8> [0x0x2b1c959c],MID=3 U8U8ILOAD O_8 T<I37,anon_ptr.,A8> T<I29,anon_ptr.,A8> [0x0x2b1c9580],MID=2 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c9564],MID=9 I4CALL Flg(126) <L:1,I25,atoi> # flags 0x7e [0x0x2b1c9548],MID=2 I4I4LDID O_-1 <L:1,I19,.preg_return_val> T<I4,.predef_I4,A4> [0x0x2b1c95b8],MID=5 I4STID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed788],MID=4 I4I4LDID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed7a8],MID=7 I4STID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c94d4],MID=6 LOC 1 24 LOC 1 25 A = (double *)malloc(dimension*dimension*sizeof(double)); I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c96e4],MID=8 I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c9700],MID=9 I4MPY [0x0x2b1c96c8],MID=13 U8I4CVT [0x0x2b1c96ac],MID=12 U8INTCONST CV(8) (0x8) [0x0x2b1c971c],MID=14 U8MPY [0x0x2b1c9690],MID=11 U8PARM Flg(2) T<I9,.predef_U8,A8> # by_value [0x0x2b1c9674],MID=10 U8CALL Flg(126) <L:1,I26,malloc> # flags 0x7e [0x0x2b1c9658],MID=3 U8U8LDID O_-1 <L:1,I19,.preg_return_val> T<I35,anon_ptr.,A8> [0x0x2b1c9738],MID=11 U8STID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed838],MID=10 U8U8LDID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed858],MID=13 U8STID O_0 <L:2,I4,A> T<I43,anon_ptr.,A8> [0x0x2b1c95e4],MID=12
int main(int argc, char *argv[]){ …..
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
STID(dimension)
LDID(preg)
U8CALL(malloc)
PARM
U8MPY
CV(8) U8I4CVT
I4MPY
I4I4LDID(dimension)
I4I4LDID(dimension)
CMPUT 680 - Compiler Design and Optimization
17
Highest WHIRL Representation ELSE
BLOCK [0x0x80ed6c8],MID=5 END_BLOCK [0x0x80ed6c8] END_IF LOC 1 22 } LOC 1 23 dimension = atoi(argv[1]); U8U8LDID O_0 <L:2,I2,argv> T<I29,anon_ptr.,A8> [0x0x2b1c959c],MID=3 U8U8ILOAD O_8 T<I37,anon_ptr.,A8> T<I29,anon_ptr.,A8> [0x0x2b1c9580],MID=2 U8PARM Flg(2) T<I37,anon_ptr.,A8> # by_value [0x0x2b1c9564],MID=9 I4CALL Flg(126) <L:1,I25,atoi> # flags 0x7e [0x0x2b1c9548],MID=2 I4I4LDID O_-1 <L:1,I19,.preg_return_val> T<I4,.predef_I4,A4> [0x0x2b1c95b8],MID=5 I4STID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed788],MID=4 I4I4LDID O_264 <L:1,I2,.preg_I4> T<I4,.predef_I4,A4> # __comma [0x0x80ed7a8],MID=7 I4STID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c94d4],MID=6 LOC 1 24 LOC 1 25 A = (double *)malloc(dimension*dimension*sizeof(double)); I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c96e4],MID=8 I4I4LDID O_0 <L:2,I3,dimension> T<I4,.predef_I4,A4> [0x0x2b1c9700],MID=9 I4MPY [0x0x2b1c96c8],MID=13 U8I4CVT [0x0x2b1c96ac],MID=12 U8INTCONST CV(8) (0x8) [0x0x2b1c971c],MID=14 U8MPY [0x0x2b1c9690],MID=11 U8PARM Flg(2) T<I9,.predef_U8,A8> # by_value [0x0x2b1c9674],MID=10 U8CALL Flg(126) <L:1,I26,malloc> # flags 0x7e [0x0x2b1c9658],MID=3 U8U8LDID O_-1 <L:1,I19,.preg_return_val> T<I35,anon_ptr.,A8> [0x0x2b1c9738],MID=11 U8STID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed838],MID=10 U8U8LDID O_265 <L:1,I5,.preg_U8> T<I35,anon_ptr.,A8> # __comma [0x0x80ed858],MID=13 U8STID O_0 <L:2,I4,A> T<I43,anon_ptr.,A8> [0x0x2b1c95e4],MID=12
int main(int argc, char *argv[]){ …..
if(argc != 2) { fprintf(stderr,"Syntax: linear <dimension>\n"); exit(1); } dimension = atoi(argv[1]);
A = (double *)malloc(dimension*dimension*sizeof(double)); B = (double *)malloc(dimension*sizeof(double)); C = (double *)malloc(dimension*sizeof(double)); InitializeMatrix(A, dimension); InitializeVector(B, dimension); MatrixVectorMultiply(C,A,B,dimension); OutputVector(C,dimension); return 0;}
STID(dimension)
LDID(preg)
U8CALL(malloc)
PARM
U8MPY
CV(8) U8I4CVT
I4MPY
I4I4LDID(dimension)
I4I4LDID(dimension)
STID(preg)
LDID(ret_val.)
STID(A)
LDID(preg)
CMPUT 680 - Compiler Design and Optimization
18
Highest WHIRL Representation
LOC 1 52 void MatrixVectorMultiply(double *C, double *A, double *B, int dimension) LOC 1 53 {FUNC_ENTRY <L:1,I29,MatrixVectorMultiply> [0x0x2b1cad60],MID=0 IDNAME O_0 <L:2,I1,C> [0x0x2b1cad90],MID=0 IDNAME O_0 <L:2,I2,A> [0x0x2b1cadac],MID=1 IDNAME O_0 <L:2,I3,B> [0x0x2b1cadc8],MID=2 IDNAME O_0 <L:2,I4,dimension> [0x0x2b1cade4],MID=3BODY BLOCK [0x0x2b1cae10],MID=0 END_BLOCK [0x0x2b1cae10] BLOCK [0x0x2b1cae3c],MID=1 END_BLOCK [0x0x2b1cae3c] BLOCK [0x0x2b1cae68],MID=2 PRAGMA ~0 !120 <null-st> CV(0) (0x0) # PREAMBLE_END [0x0x2b1cae94],MID=0 LOC 1 54 int i, j; LOC 1 55 for(i=0 ; i<dimension ; i++)
FUNC_ENTRY(MatrixVectorMultiply)
IDNAME(C)
IDNAME(A)
IDNAME(B)
IDNAME(dimension)
BLOCK
void MatrixVectorMultiply(double *C, double *A, double *B, int dimension){ int i, j; for(i=0 ; i<dimension ; i++) { C[i] = 0.0; for(j=0 ; j<dimension ; j++) C[i] = C[i] + A[i*dimension+j]*B[j]; }}
BLOCKBLOCK
CMPUT 680 - Compiler Design and Optimization
19
Highest WHIRL Representation
FUNC_ENTRY(MatrixVectorMultiply)
IDNAME(C)
IDNAME(A)
IDNAME(B)
IDNAME(dimension)
BLOCK
WHILE
GT
LDID(i)
LDID(dimension)
STID(i)
CV(0)
BLOCKBLOCK
LOC 1 54 int i, j; LOC 1 55 for(i=0 ; i<dimension ; i++) I4INTCONST CV(0) (0x0) [0x0x2b1caedc],MID=4 I4STID O_0 <L:2,I5,i> T<I4,.predef_I4,A4> [0x0x2b1caec0],MID=0 WHILE_DO [0x0x2b1caf08],MID=3 I4I4LDID O_0 <L:2,I4,dimension> T<I4,.predef_I4,A4> [0x0x2b1caf40],MID=1 I4I4LDID O_0 <L:2,I5,i> T<I4,.predef_I4,A4> [0x0x2b1caf5c],MID=2 I4I4GT [0x0x2b1caf24],MID=5 BODY BLOCK [0x0x2b1caf88],MID=4 LOC 1 56 { LOC 1 57 C[i] = 0.0; F8CONST <L:1,I32,____0.000000000000000> [0x0x2b1cafd0],MID=6 U8U8LDID O_0 <L:2,I1,C> T<I43,anon_ptr.,A8> [0x0x2b1cb008],MID=4 I8I4LDID O_0 <L:2,I5,i> T<I9,.predef_U8,A8> [0x0x2b1cb05c],MID=5 U8I8CVT [0x0x2b1cb040],MID=9 U8INTCONST CV(8) (0x8) [0x0x2b1cb078],MID=10 U8MPY [0x0x2b1cb024],MID=8 U8ADD [0x0x2b1cafec],MID=7 F8ISTORE O_0 T<I43,anon_ptr.,A8> [0x0x2b1cafb4],MID=3
void MatrixVectorMultiply(double *C, double *A, double *B, int dimension){ int i, j; for(i=0 ; i<dimension ; i++) { C[i] = 0.0; for(j=0 ; j<dimension ; j++) C[i] = C[i] + A[i*dimension+j]*B[j]; }}
CMPUT 680 - Compiler Design and Optimization
20
LOC 1 54 int i, j; LOC 1 55 for(i=0 ; i<dimension ; i++) I4INTCONST CV(0) (0x0) [0x0x2b1caedc],MID=4 I4STID O_0 <L:2,I5,i> T<I4,.predef_I4,A4> [0x0x2b1caec0],MID=0 WHILE_DO [0x0x2b1caf08],MID=3 I4I4LDID O_0 <L:2,I4,dimension> T<I4,.predef_I4,A4> [0x0x2b1caf40],MID=1 I4I4LDID O_0 <L:2,I5,i> T<I4,.predef_I4,A4> [0x0x2b1caf5c],MID=2 I4I4GT [0x0x2b1caf24],MID=5 BODY BLOCK [0x0x2b1caf88],MID=4 LOC 1 56 { LOC 1 57 C[i] = 0.0; F8CONST <L:1,I32,____0.000000000000000> [0x0x2b1cafd0],MID=6 U8U8LDID O_0 <L:2,I1,C> T<I43,anon_ptr.,A8> [0x0x2b1cb008],MID=4 I8I4LDID O_0 <L:2,I5,i> T<I9,.predef_U8,A8> [0x0x2b1cb05c],MID=5 U8I8CVT [0x0x2b1cb040],MID=9 U8INTCONST CV(8) (0x8) [0x0x2b1cb078],MID=10 U8MPY [0x0x2b1cb024],MID=8 U8ADD [0x0x2b1cafec],MID=7 F8ISTORE O_0 T<I43,anon_ptr.,A8> [0x0x2b1cafb4],MID=3
void MatrixVectorMultiply(double *C, double *A, double *B, int dimension){ int i, j; for(i=0 ; i<dimension ; i++) { C[i] = 0.0; for(j=0 ; j<dimension ; j++) C[i] = C[i] + A[i*dimension+j]*B[j]; }}
Highest WHIRL Representation
FUNC_ENTRY(MatrixVectorMultiply)
IDNAME(C)
IDNAME(A)
IDNAME(B)
IDNAME(dimension)
BLOCK
WHILE
GT
LDID(i)
LDID(dimension)
STID(i)
CV(0)
BLOCKBLOCK
F8ISTORE
U8ADD
U8MPY LDID(C)
U8I8CVT
LDID(i)
CV(8)
F8CONST(0.0)
BLOCK
CMPUT 680 - Compiler Design and Optimization
21
LOC 1 58 for(j=0 ; j<dimension ; j++) I4INTCONST CV(0) (0x0) [0x0x2b1cb0c0],MID=11 I4STID O_0 <L:2,I6,j> T<I4,.predef_I4,A4> [0x0x2b1cb0a4],MID=6 WHILE_DO [0x0x2b1cb0ec],MID=5 I4I4LDID O_0 <L:2,I4,dimension> T<I4,.predef_I4,A4> [0x0x2b1cb124],MID=7 I4I4LDID O_0 <L:2,I6,j> T<I4,.predef_I4,A4> [0x0x2b1cb140],MID=8 I4I4GT [0x0x2b1cb108],MID=12 BODY BLOCK [0x0x2b1cb16c],MID=6
void MatrixVectorMultiply(double *C, double *A, double *B, int dimension){ int i, j; for(i=0 ; i<dimension ; i++) { C[i] = 0.0; for(j=0 ; j<dimension ; j++) C[i] = C[i] + A[i*dimension+j]*B[j]; }}
Highest WHIRL Representation
FUNC_ENTRY(MatrixVectorMultiply)
IDNAME(C)
IDNAME(A)
IDNAME(B)
IDNAME(dimension)
BLOCK
WHILE
GT
LDID(i)
LDID(dimension)
STID(i)
CV(0)
BLOCKBLOCK
F8ISTORE
U8ADD
U8MPY LDID(C)
U8I8CVT
LDID(i)
CV(8)
F8CONST(0.0)
BLOCK
STID(j)
CV(0)
WHILE
GT
LDID(j)
LDID(dimension)
BLOCK
CMPUT 680 - Compiler Design and Optimization
22
LOC 1 59 C[i] = C[i] + A[i*dimension+j]*B[j]; U8U8LDID O_0 <L:2,I1,C> T<I43,anon_ptr.,A8> [0x0x2b1cb208],MID=11 I8I4LDID O_0 <L:2,I5,i> T<I9,.predef_U8,A8> [0x0x2b1cb25c],MID=12 U8I8CVT [0x0x2b1cb240],MID=16 U8INTCONST CV(8) (0x8) [0x0x2b1cb278],MID=17 U8MPY [0x0x2b1cb224],MID=15 U8ADD [0x0x2b1cb1ec],MID=14 F8F8ILOAD O_0 T<I11,.predef_F8,A8> T<I43,anon_ptr.,A8> [0x0x2b1cb1d0],MID=10 U8U8LDID O_0 <L:2,I2,A> T<I43,anon_ptr.,A8> [0x0x2b1cb2e8],MID=14 I4I4LDID O_0 <L:2,I6,j> T<I4,.predef_I4,A4> [0x0x2b1cb358],MID=15 I4I4LDID O_0 <L:2,I4,dimension> T<I4,.predef_I4,A4> [0x0x2b1cb390],MID=16 I4I4LDID O_0 <L:2,I5,i> T<I4,.predef_I4,A4> [0x0x2b1cb3ac],MID=17 I4MPY [0x0x2b1cb374],MID=23 I4ADD [0x0x2b1cb33c],MID=22 U8I4CVT [0x0x2b1cb320],MID=21 U8INTCONST CV(8) (0x8) [0x0x2b1cb3c8],MID=24 U8MPY [0x0x2b1cb304],MID=20 U8ADD [0x0x2b1cb2cc],MID=19 F8F8ILOAD O_0 T<I11,.predef_F8,A8> T<I43,anon_ptr.,A8> [0x0x2b1cb2b0],MID=13 U8U8LDID O_0 <L:2,I3,B> T<I43,anon_ptr.,A8> [0x0x2b1cb41c],MID=19 I8I4LDID O_0 <L:2,I6,j> T<I9,.predef_U8,A8> [0x0x2b1cb470],MID=20 U8I8CVT [0x0x2b1cb454],MID=27 U8INTCONST CV(8) (0x8) [0x0x2b1cb48c],MID=28 U8MPY [0x0x2b1cb438],MID=26 U8ADD [0x0x2b1cb400],MID=25 F8F8ILOAD O_0 T<I11,.predef_F8,A8> T<I43,anon_ptr.,A8> [0x0x2b1cb3e4],MID=18 F8MPY [0x0x2b1cb294],MID=18 F8ADD [0x0x2b1cb1b4],MID=13 U8U8LDID O_0 <L:2,I1,C> T<I43,anon_ptr.,A8> [0x0x2b1cb4c4],MID=21 I8I4LDID O_0 <L:2,I5,i> T<I9,.predef_U8,A8> [0x0x2b1cb518],MID=22 U8I8CVT [0x0x2b1cb4fc],MID=31 U8INTCONST CV(8) (0x8) [0x0x2b1cb534],MID=32 U8MPY [0x0x2b1cb4e0],MID=30 U8ADD [0x0x2b1cb4a8],MID=29 F8ISTORE O_0 T<I43,anon_ptr.,A8> [0x0x2b1cb198],MID=9 LABEL L2 Flg(0) [0x0x2b1cb560],MID=0 I4I4LDID O_0 <L:2,I6,j> T<I4,.predef_I4,A4> [0x0x2b1cb5c4],MID=24
LABEL L2 Flg(0) [0x0x2b1cb560],MID=0 I4I4LDID O_0 <L:2,I6,j> T<I4,.predef_I4,A4> [0x0x2b1cb5c4],MID=24 I4INTCONST CV(1) (0x1) [0x0x2b1cb5e0],MID=34 I4ADD [0x0x2b1cb5a8],MID=33 I4STID O_0 <L:2,I6,j> T<I4,.predef_I4,A4> [0x0x2b1cb58c],MID=23 END_BLOCK [0x0x2b1cb16c]
F8F8ILOAD
U8ADD
U8MPY LDID( B )
U8I8CVT
LDID( j )
CV(8)
F8F8ILOAD
U8ADD
U8MPY LDID( A )
U8I4CVT
I4ADD
CV(8)
I4MPY
LDID( i )
LDID(dimension)
LDID( j )
F8MPY F8F8ILOAD
U8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ADDU8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ISTORE
ADD
LDID( j )
CV(1)
I4STID( j )
BLOCK
LOC 1 59 C[i] = C[i] + A[i*dimension+j]*B[j];
F8F8ILOAD
U8ADD
U8MPY LDID( B )
U8I8CVT
LDID( j )
CV(8)
F8F8ILOAD
U8ADD
U8MPY LDID( A )
U8I4CVT
I4ADD
CV(8)
I4MPY
LDID( i )
LDID(dimension)
LDID( j )
F8MPY F8F8ILOAD
U8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ADDU8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ISTORE
ADD
LDID( j )
CV(1)
I4STID( j )
BLOCK
LOC 1 59 C[i] = C[i] + A[i*dimension+j]*B[j];
load B[j]
F8F8ILOAD
U8ADD
U8MPY LDID( B )
U8I8CVT
LDID( j )
CV(8)
F8F8ILOAD
U8ADD
U8MPY LDID( A )
U8I4CVT
I4ADD
CV(8)
I4MPY
LDID( i )
LDID(dimension)
LDID( j )
F8MPY F8F8ILOAD
U8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ADDU8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ISTORE
ADD
LDID( j )
CV(1)
I4STID( j )
BLOCK
LOC 1 59 C[i] = C[i] + A[i*dimension+j]*B[j];
load A[i*dimesion+j]
F8F8ILOAD
U8ADD
U8MPY LDID( B )
U8I8CVT
LDID( j )
CV(8)
F8F8ILOAD
U8ADD
U8MPY LDID( A )
U8I4CVT
I4ADD
CV(8)
I4MPY
LDID( i )
LDID(dimension)
LDID( j )
F8MPY F8F8ILOAD
U8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ADDU8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ISTORE
ADD
LDID( j )
CV(1)
I4STID( j )
BLOCK
LOC 1 59 C[i] = C[i] + A[i*dimension+j]*B[j];
load C[i]
F8F8ILOAD
U8ADD
U8MPY LDID( B )
U8I8CVT
LDID( j )
CV(8)
F8F8ILOAD
U8ADD
U8MPY LDID( A )
U8I4CVT
I4ADD
CV(8)
I4MPY
LDID( i )
LDID(dimension)
LDID( j )
F8MPY F8F8ILOAD
U8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ADDU8ADD
U8MPY LDID( C )
U8I8CVT
LDID( i )
CV(8)
F8ISTORE
ADD
LDID( j )
CV(1)
I4STID( j )
BLOCK
LOC 1 59 C[i] = C[i] + A[i*dimension+j]*B[j];
j++
F8ISTORE
U8ADD
U8MPY LDID(C)
U8I8CVT
LDID(i)
CV(8)
F8CONST(0.0)
BLOCK
WHILE
GT
LDID(I)
LDID(dimension)
BLOCK
IDNAME(C)
STID(j)
CV(0)
FUNC_ENTRY(MatrixVectorMultiply)
IDNAME(A)
IDNAME(B)
IDNAME(dimension)
BLOCK
WHILE
GT
LDID(I)
LDID(dimension)
STID(i)
CV(0)
BLOCKBLOCK
Highest WHIRL Representation.
GT
LDID(I)
LDID(dimension)
IDNAME(C)
STID(j)
CV(0)
FUNC_ENTRY(MatrixVectorMultiply)
IDNAME(A)
IDNAME(B)
IDNAME(dimension)
BLOCK
FALSEBR L4
GT
LDID(I)
LDID(dimension)
STID(i)
CV(0)
BLOCKBLOCK
STID(C)
LDID($r32)
STID(A)
LDID($r33)
STID(B)
LDID($r34)
STID(dimension)
LDID($r35)
U8I8CVT
U8ADD
U8MPY LDID(C)
LDID(i)
CV(8)
F8CONST(0.0)
LABEL L3F8ISTORE
FALSEBR L5
After five lowering steps.