Title: The Open64 Compiler
1The Open64 Compiler
2The Open64 Compiler
- A suite of optimizing compiler tools for
Linux/Intel IA-64 systems - C, C and Fortran77/90 OpenMP compilers
- Open to all researchers/developers in the
community - Can also be executed IA-32, under the NUE
emulator.
3Logical Compilation Model
4Intermediate Representation
- IR is called WHIRL
- Common interface between components
- Multiple languages and multiple targets
- Same IR, 5 levels of representation
- Continuous lowering as compilation progresses
- Optimization strategy tied to level
5Five levels of the WHIRL
- Very High (VH) Output by front-end back to
source, VHO. - High (H) IPA, LNO, PREOPT.
- Mid (M) WOPT (global scalar optimizer),
characteristics the target Arch. - Low (L) Register Variable Identification
- Very Low (VL) Before code generation.
6Dataflow Relationship Between Modules
7More Details The WHIRL
8The Very High Level Whirl
- The AST representation of the compiler
- Representation used after the frontends.
- The contents in this representation are store in
an intermediate file with extension .B - openf90 keep example.f90 gt example.B
Driver
Front Ends / C/C/Fortran
Stand Alone Inliner
Local Inter-procedural Analysis (IPL)
Global Inter-procedural Analysis
/Optimization (IPA)
AS / Linker
Backend (LNO) (WOPT) (CG)
Source Code
.B file
.o file
.I file
.B file
a.out
.s file
9Very High WHIRL IR
example.B
LOC 0 0 source files 1 "/nue/home/sgicomp/
example1.c" LOC 1 1 int main () LOC 1 2
FUNC_ENTRY lt1,20,maingt BLOCK END_BLOCK
BLOCK END_BLOCK BLOCK PRAGMA 0 120 ltnull-stgt 0
(0x0) PREAMBLE_END LOC 1 3 int a 0
I4INTCONST 0 (0x0) I4STID 0 lt2,1,agt
Tlt4,.predef_I4,4gt LOC 1 4 int b 2
I4INTCONST 2 (0x2) I4STID 0 lt2,2,bgt
Tlt4,.predef_I4,4gt LOC 1 5 LOC 1 6 if (a
b) IF I4I4LDID 0 lt2,1,agt Tlt4,.predef_I4,4gt
I4I4LDID 0 lt2,2,bgt Tlt4,.predef_I4,4gt I4I4EQ
THEN BLOCK LOC 1 7 b 1 I4INTCONST 1
(0x1) I4STID 0 lt2,2,bgt Tlt4,.predef_I4,4gt
END_BLOCK ELSE LOC 1 6 BLOCK LOC 1 8
else LOC 1 9 a 2 I4INTCONST 2 (0x2)
I4STID 0 lt2,1,agt Tlt4,.predef_I4,4gt END_BLOCK
END_IF RETURN END_BLOCK
example1.c int main () int a 0 int b
2 if (a b) b 1 else a
2
10VHLW Example of a Program
include ltstdlib.hgt include ltstdio.hgt define
COUNTINIT 1.0 void InitializeMatrix(double
A, int dimension) void InitializeVector(double
B, int dimension) void MatrixVectorMultiply(doub
le C, double A, double B, int dimension) void
OutputVector(double C, int dimension)
Note Example taken from the University of
Alberta, Canada.
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
11Compilation Example (cont.)
void InitializeMatrix(double B, int
dimension) int i double count 1.0
for(i0 iltdimensiondimension i) Bi
count
void MatrixVectorMultiply(double C, double A,
double B, int dimension) int i, j for(i0
iltdimension i) Ci 0.0
for(j0 jltdimension j) Ci Ci
AidimensionjBj
void InitializeVector(double B, int
dimension) int i double count 1.0
for(i0 iltdimension i) Bi
count
void OutputVector(double C, int dimension)
int i printf("C ") for(i0
iltdimension i) printf("g ",Ci)
printf("\n")
12Highest WHIRL Representation
Detailed VHLW
FUNC_ENTRY ltL1,I20,maingt 0x0x2b1c91d8,0
IDNAME O_0 ltL2,I1,argcgt 0x0x2b1c9200,0 IDNAME
O_0 ltL2,I2,argvgt 0x0x2b1c921c,1 BODY BLOCK
0x0x2b1c9248,0 END_BLOCK 0x0x2b1c9248 BLOCK
0x0x2b1c9274,1 END_BLOCK 0x0x2b1c9274 BLOCK
0x0x80ed668,2 PRAGMA 0 !120 ltnull-stgt CV(0)
(0x0) PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0
I4I4LDID O_0 A direct load of a 4 byte integer
into a 4 byte integer register with ofset of 0.
13Highest WHIRL Representation
FUNC_ENTRY ltL1,I20,maingt 0x0x2b1c91d8,0
IDNAME O_0 ltL2,I1,argcgt 0x0x2b1c9200,0 IDNAME
O_0 ltL2,I2,argvgt 0x0x2b1c921c,1 BODY BLOCK
0x0x2b1c9248,0 END_BLOCK 0x0x2b1c9248 BLOCK
0x0x2b1c9274,1 END_BLOCK 0x0x2b1c9274 BLOCK
0x0x80ed668,2 PRAGMA 0 !120 ltnull-stgt CV(0)
(0x0) PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0
I4INTCONST Access a 4 byte integer
constant. CV(2) The value of the constant is 2.
14Highest WHIRL Representation
FUNC_ENTRY ltL1,I20,maingt 0x0x2b1c91d8,0
IDNAME O_0 ltL2,I1,argcgt 0x0x2b1c9200,0 IDNAME
O_0 ltL2,I2,argvgt 0x0x2b1c921c,1 BODY BLOCK
0x0x2b1c9248,0 END_BLOCK 0x0x2b1c9248 BLOCK
0x0x2b1c9274,1 END_BLOCK 0x0x2b1c9274 BLOCK
0x0x80ed668,2 PRAGMA 0 !120 ltnull-stgt CV(0)
(0x0) PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0
I4I4NE Tests if two four byte values are not
equal.
15Highest WHIRL Representation
FUNC_ENTRY ltL1,I20,maingt 0x0x2b1c91d8,0
IDNAME O_0 ltL2,I1,argcgt 0x0x2b1c9200,0 IDNAME
O_0 ltL2,I2,argvgt 0x0x2b1c921c,1 BODY BLOCK
0x0x2b1c9248,0 END_BLOCK 0x0x2b1c9248 BLOCK
0x0x2b1c9274,1 END_BLOCK 0x0x2b1c9274 BLOCK
0x0x80ed668,2 PRAGMA 0 !120 ltnull-stgt CV(0)
(0x0) PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0
VCALL A call to a function that returns an item
of type void.
U8PARM An 8-byte unsigned parameter for the
function.
U8LDA Accesses the address, in bytes, of the
string. 0_0 Add offset of zero to the address.
16Highest WHIRL Representation
FUNC_ENTRY (main)
FUNC_ENTRY ltL1,I20,maingt 0x0x2b1c91d8,0
IDNAME O_0 ltL2,I1,argcgt 0x0x2b1c9200,0 IDNAME
O_0 ltL2,I2,argvgt 0x0x2b1c921c,1 BODY BLOCK
0x0x2b1c9248,0 END_BLOCK 0x0x2b1c9248 BLOCK
0x0x2b1c9274,1 END_BLOCK 0x0x2b1c9274 BLOCK
0x0x80ed668,2 PRAGMA 0 !120 ltnull-stgt CV(0)
(0x0) PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0
IDNAME (argc)
IDNAME (argv)
BLOCK
BLOCK
BLOCK
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
17Highest WHIRL Representation
FUNC_ENTRY (main)
PRAGMA 0 !120 ltnull-stgt CV(0) (0x0)
PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0 LO
C 1 21 exit(1) I4INTCONST CV(1) (0x1)
0x0x2b1c947c,8 I4PARM Flg(2)
TltI4,.predef_I4,A4gt by_value
0x0x2b1c9460,7 VCALL Flg(126) ltL1,I24,exitgt
flags 0x7e 0x0x2b1c9444,1 END_BLOCK
0x0x80ed698 ELSE BLOCK 0x0x80ed6c8,5
END_BLOCK 0x0x80ed6c8 END_IF LOC 1 22
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 ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
18Highest WHIRL Representation
NC_ENTRY (main)
PRAGMA 0 !120 ltnull-stgt CV(0) (0x0)
PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0 LO
C 1 21 exit(1) I4INTCONST CV(1) (0x1)
0x0x2b1c947c,8 I4PARM Flg(2)
TltI4,.predef_I4,A4gt by_value
0x0x2b1c9460,7 VCALL Flg(126) ltL1,I24,exitgt
flags 0x7e 0x0x2b1c9444,1 END_BLOCK
0x0x80ed698 ELSE BLOCK 0x0x80ed6c8,5
END_BLOCK 0x0x80ed6c8 END_IF LOC 1 22
BLOCK
BLOCK
BLOCK
IF
NE
BLOCK (THEN)
CV(2)
LDID (argc)
VCALL (printf)
VCALL (exit)
PARM
PARM
PARM
LDID (stderr)
LDA ltstringgt
CV(1)
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
19Highest WHIRL Representation
NC_ENTRY (main)
PRAGMA 0 !120 ltnull-stgt CV(0) (0x0)
PREAMBLE_END 0x0x2b1c92cc,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,3 I4I4LDID O_0 ltL2,I1,argcgt
TltI4,.predef_I4,A4gt 0x0x2b1c9334,0
I4INTCONST CV(2) (0x2) 0x0x2b1c9350,3 I4I4NE
0x0x2b1c9318,2 THEN BLOCK 0x0x80ed698,4
LOC 1 19 LOC 1 20 fprintf(stderr,"Syn
tax linear ltdimensiongt\n") U8U8LDID O_0
ltL1,I22,stderrgt TltI33,anon_ptr.,A8gt
0x0x2b1c93e0,1 U8PARM Flg(2)
TltI33,anon_ptr.,A8gt by_value
0x0x2b1c93c4,4 U8LDA O_0 ltL1,I23,(28_bytes)
_"Syntax_linear_ltdimensiongt\n\000"gt
TltI40,anon_ptr.,A8gt 0x0x2b1c9418,6 U8PARM
Flg(2) TltI37,anon_ptr.,A8gt by_value
0x0x2b1c93fc,5 VCALL Flg(126)
ltL1,I21,fprintfgt flags 0x7e 0x0x2b1c93a8,0 LO
C 1 21 exit(1) I4INTCONST CV(1) (0x1)
0x0x2b1c947c,8 I4PARM Flg(2)
TltI4,.predef_I4,A4gt by_value
0x0x2b1c9460,7 VCALL Flg(126) ltL1,I24,exitgt
flags 0x7e 0x0x2b1c9444,1 END_BLOCK
0x0x80ed698 ELSE BLOCK 0x0x80ed6c8,5
END_BLOCK 0x0x80ed6c8 END_IF LOC 1 22
BLOCK
BLOCK
BLOCK
IF
NE
BLOCK (THEN)
BLOCK (ELSE)
CV(2)
LDID (argc)
VCALL (printf)
VCALL (exit)
PARM
PARM
PARM
LDID (stderr)
LDA ltstringgt
CV(1)
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
20Highest WHIRL Representation
BLOCK
ELSE BLOCK 0x0x80ed6c8,5 END_BLOCK
0x0x80ed6c8 END_IF LOC 1 22 LOC 1 23
dimension atoi(argv1) U8U8LDID O_0
ltL2,I2,argvgt TltI29,anon_ptr.,A8gt
0x0x2b1c959c,3 U8U8ILOAD O_8
TltI37,anon_ptr.,A8gt TltI29,anon_ptr.,A8gt
0x0x2b1c9580,2 U8PARM Flg(2)
TltI37,anon_ptr.,A8gt by_value
0x0x2b1c9564,9 I4CALL Flg(126) ltL1,I25,atoigt
flags 0x7e 0x0x2b1c9548,2 I4I4LDID O_-1
ltL1,I19,.preg_return_valgt TltI4,.predef_I4,A4gt
0x0x2b1c95b8,5 I4STID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed788,4
I4I4LDID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed7a8,7
I4STID O_0 ltL2,I3,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1c94d4,6 LOC 1 24 LOC 1 25 A
(double )malloc(dimensiondimensionsizeof(double
)) I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c96e4,8
I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c9700,9 I4MPY
0x0x2b1c96c8,13 U8I4CVT 0x0x2b1c96ac,12
U8INTCONST CV(8) (0x8) 0x0x2b1c971c,14
U8MPY 0x0x2b1c9690,11 U8PARM Flg(2)
TltI9,.predef_U8,A8gt by_value
0x0x2b1c9674,10 U8CALL Flg(126)
ltL1,I26,mallocgt flags 0x7e 0x0x2b1c9658,3
U8U8LDID O_-1 ltL1,I19,.preg_return_valgt
TltI35,anon_ptr.,A8gt 0x0x2b1c9738,11 U8STID
O_265 ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt
__comma 0x0x80ed838,10 U8U8LDID O_265
ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt __comma
0x0x80ed858,13 U8STID O_0 ltL2,I4,Agt
TltI43,anon_ptr.,A8gt 0x0x2b1c95e4,12
IF
I4CALL (atoi)
PARM
BLOCK (THEN)
BLOCK (ELSE)
ILOAD
VCALL (printf)
VCALL (exit)
LDID (argv)
PARM
PARM
PARM
LDID (stderr)
LDA ltstringgt
CV(1)
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
21Highest WHIRL Representation
BLOCK
ELSE BLOCK 0x0x80ed6c8,5 END_BLOCK
0x0x80ed6c8 END_IF LOC 1 22 LOC 1 23
dimension atoi(argv1) U8U8LDID O_0
ltL2,I2,argvgt TltI29,anon_ptr.,A8gt
0x0x2b1c959c,3 U8U8ILOAD O_8
TltI37,anon_ptr.,A8gt TltI29,anon_ptr.,A8gt
0x0x2b1c9580,2 U8PARM Flg(2)
TltI37,anon_ptr.,A8gt by_value
0x0x2b1c9564,9 I4CALL Flg(126) ltL1,I25,atoigt
flags 0x7e 0x0x2b1c9548,2 I4I4LDID O_-1
ltL1,I19,.preg_return_valgt TltI4,.predef_I4,A4gt
0x0x2b1c95b8,5 I4STID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed788,4
I4I4LDID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed7a8,7
I4STID O_0 ltL2,I3,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1c94d4,6 LOC 1 24 LOC 1 25 A
(double )malloc(dimensiondimensionsizeof(double
)) I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c96e4,8
I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c9700,9 I4MPY
0x0x2b1c96c8,13 U8I4CVT 0x0x2b1c96ac,12
U8INTCONST CV(8) (0x8) 0x0x2b1c971c,14
U8MPY 0x0x2b1c9690,11 U8PARM Flg(2)
TltI9,.predef_U8,A8gt by_value
0x0x2b1c9674,10 U8CALL Flg(126)
ltL1,I26,mallocgt flags 0x7e 0x0x2b1c9658,3
U8U8LDID O_-1 ltL1,I19,.preg_return_valgt
TltI35,anon_ptr.,A8gt 0x0x2b1c9738,11 U8STID
O_265 ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt
__comma 0x0x80ed838,10 U8U8LDID O_265
ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt __comma
0x0x80ed858,13 U8STID O_0 ltL2,I4,Agt
TltI43,anon_ptr.,A8gt 0x0x2b1c95e4,12
IF
I4CALL (atoi)
STID (preg)
PARM
LDID (ret_val.)
BLOCK (THEN)
BLOCK (ELSE)
ILOAD
VCALL (printf)
VCALL (exit)
LDID (argv)
PARM
PARM
PARM
LDID (stderr)
LDA ltstringgt
CV(1)
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
22Highest WHIRL Representation
ELSE BLOCK 0x0x80ed6c8,5 END_BLOCK
0x0x80ed6c8 END_IF LOC 1 22 LOC 1 23
dimension atoi(argv1) U8U8LDID O_0
ltL2,I2,argvgt TltI29,anon_ptr.,A8gt
0x0x2b1c959c,3 U8U8ILOAD O_8
TltI37,anon_ptr.,A8gt TltI29,anon_ptr.,A8gt
0x0x2b1c9580,2 U8PARM Flg(2)
TltI37,anon_ptr.,A8gt by_value
0x0x2b1c9564,9 I4CALL Flg(126) ltL1,I25,atoigt
flags 0x7e 0x0x2b1c9548,2 I4I4LDID O_-1
ltL1,I19,.preg_return_valgt TltI4,.predef_I4,A4gt
0x0x2b1c95b8,5 I4STID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed788,4
I4I4LDID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed7a8,7
I4STID O_0 ltL2,I3,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1c94d4,6 LOC 1 24 LOC 1 25 A
(double )malloc(dimensiondimensionsizeof(double
)) I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c96e4,8
I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c9700,9 I4MPY
0x0x2b1c96c8,13 U8I4CVT 0x0x2b1c96ac,12
U8INTCONST CV(8) (0x8) 0x0x2b1c971c,14
U8MPY 0x0x2b1c9690,11 U8PARM Flg(2)
TltI9,.predef_U8,A8gt by_value
0x0x2b1c9674,10 U8CALL Flg(126)
ltL1,I26,mallocgt flags 0x7e 0x0x2b1c9658,3
U8U8LDID O_-1 ltL1,I19,.preg_return_valgt
TltI35,anon_ptr.,A8gt 0x0x2b1c9738,11 U8STID
O_265 ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt
__comma 0x0x80ed838,10 U8U8LDID O_265
ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt __comma
0x0x80ed858,13 U8STID O_0 ltL2,I4,Agt
TltI43,anon_ptr.,A8gt 0x0x2b1c95e4,12
I4CALL (atoi)
STID (preg)
STID (dimension)
PARM
LDID (ret_val.)
LDID (preg)
BLOCK (ELSE)
ILOAD
LDID (argv)
int main(int argc, char argv) int
dimension double A double B double
C if(argc ! 2)
fprintf(stderr,"Syntax linear ltdimensiongt\n")
exit(1) dimension atoi(argv1)
A (double )malloc(dimensiondimensionsizeof(d
ouble)) B (double )malloc(dimensionsizeof(d
ouble)) C (double )malloc(dimensionsizeof(d
ouble)) InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
23Highest WHIRL Representation
ELSE BLOCK 0x0x80ed6c8,5 END_BLOCK
0x0x80ed6c8 END_IF LOC 1 22 LOC 1 23
dimension atoi(argv1) U8U8LDID O_0
ltL2,I2,argvgt TltI29,anon_ptr.,A8gt
0x0x2b1c959c,3 U8U8ILOAD O_8
TltI37,anon_ptr.,A8gt TltI29,anon_ptr.,A8gt
0x0x2b1c9580,2 U8PARM Flg(2)
TltI37,anon_ptr.,A8gt by_value
0x0x2b1c9564,9 I4CALL Flg(126) ltL1,I25,atoigt
flags 0x7e 0x0x2b1c9548,2 I4I4LDID O_-1
ltL1,I19,.preg_return_valgt TltI4,.predef_I4,A4gt
0x0x2b1c95b8,5 I4STID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed788,4
I4I4LDID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed7a8,7
I4STID O_0 ltL2,I3,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1c94d4,6 LOC 1 24 LOC 1 25 A
(double )malloc(dimensiondimensionsizeof(double
)) I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c96e4,8
I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c9700,9 I4MPY
0x0x2b1c96c8,13 U8I4CVT 0x0x2b1c96ac,12
U8INTCONST CV(8) (0x8) 0x0x2b1c971c,14
U8MPY 0x0x2b1c9690,11 U8PARM Flg(2)
TltI9,.predef_U8,A8gt by_value
0x0x2b1c9674,10 U8CALL Flg(126)
ltL1,I26,mallocgt flags 0x7e 0x0x2b1c9658,3
U8U8LDID O_-1 ltL1,I19,.preg_return_valgt
TltI35,anon_ptr.,A8gt 0x0x2b1c9738,11 U8STID
O_265 ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt
__comma 0x0x80ed838,10 U8U8LDID O_265
ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt __comma
0x0x80ed858,13 U8STID O_0 ltL2,I4,Agt
TltI43,anon_ptr.,A8gt 0x0x2b1c95e4,12
U8CALL (malloc)
STID (dimension)
LDID (preg)
PARM
U8MPY
CV(8)
U8I4CVT
I4MPY
I4I4LDID (dimension)
I4I4LDID (dimension)
int main(int argc, char argv)
.. if(argc ! 2) fprintf(stderr,"Syn
tax linear ltdimensiongt\n") exit(1)
dimension atoi(argv1) A (double
)malloc(dimensiondimensionsizeof(double)) B
(double )malloc(dimensionsizeof(double)) C
(double )malloc(dimensionsizeof(double))
InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
24Highest WHIRL Representation
ELSE BLOCK 0x0x80ed6c8,5 END_BLOCK
0x0x80ed6c8 END_IF LOC 1 22 LOC 1 23
dimension atoi(argv1) U8U8LDID O_0
ltL2,I2,argvgt TltI29,anon_ptr.,A8gt
0x0x2b1c959c,3 U8U8ILOAD O_8
TltI37,anon_ptr.,A8gt TltI29,anon_ptr.,A8gt
0x0x2b1c9580,2 U8PARM Flg(2)
TltI37,anon_ptr.,A8gt by_value
0x0x2b1c9564,9 I4CALL Flg(126) ltL1,I25,atoigt
flags 0x7e 0x0x2b1c9548,2 I4I4LDID O_-1
ltL1,I19,.preg_return_valgt TltI4,.predef_I4,A4gt
0x0x2b1c95b8,5 I4STID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed788,4
I4I4LDID O_264 ltL1,I2,.preg_I4gt
TltI4,.predef_I4,A4gt __comma 0x0x80ed7a8,7
I4STID O_0 ltL2,I3,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1c94d4,6 LOC 1 24 LOC 1 25 A
(double )malloc(dimensiondimensionsizeof(double
)) I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c96e4,8
I4I4LDID O_0 ltL2,I3,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1c9700,9 I4MPY
0x0x2b1c96c8,13 U8I4CVT 0x0x2b1c96ac,12
U8INTCONST CV(8) (0x8) 0x0x2b1c971c,14
U8MPY 0x0x2b1c9690,11 U8PARM Flg(2)
TltI9,.predef_U8,A8gt by_value
0x0x2b1c9674,10 U8CALL Flg(126)
ltL1,I26,mallocgt flags 0x7e 0x0x2b1c9658,3
U8U8LDID O_-1 ltL1,I19,.preg_return_valgt
TltI35,anon_ptr.,A8gt 0x0x2b1c9738,11 U8STID
O_265 ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt
__comma 0x0x80ed838,10 U8U8LDID O_265
ltL1,I5,.preg_U8gt TltI35,anon_ptr.,A8gt __comma
0x0x80ed858,13 U8STID O_0 ltL2,I4,Agt
TltI43,anon_ptr.,A8gt 0x0x2b1c95e4,12
U8CALL (malloc)
STID (preg)
STID (A)
STID (dimension)
LDID (ret_val.)
LDID (preg)
LDID (preg)
PARM
U8MPY
CV(8)
U8I4CVT
I4MPY
I4I4LDID (dimension)
I4I4LDID (dimension)
int main(int argc, char argv)
.. if(argc ! 2) fprintf(stderr,"Syn
tax linear ltdimensiongt\n") exit(1)
dimension atoi(argv1) A (double
)malloc(dimensiondimensionsizeof(double)) B
(double )malloc(dimensionsizeof(double)) C
(double )malloc(dimensionsizeof(double))
InitializeMatrix(A, dimension)
InitializeVector(B, dimension)
MatrixVectorMultiply(C,A,B,dimension)
OutputVector(C,dimension) return 0
25Highest WHIRL Representation
FUNC_ENTRY (MatrixVectorMultiply)
IDNAME (C)
IDNAME (A)
IDNAME (B)
IDNAME (dimension)
BLOCK
BLOCK
BLOCK
LOC 1 52 void MatrixVectorMultiply(double C,
double A, double B, int dimension) LOC 1 53
FUNC_ENTRY ltL1,I29,MatrixVectorMultiplygt
0x0x2b1cad60,0 IDNAME O_0 ltL2,I1,Cgt
0x0x2b1cad90,0 IDNAME O_0 ltL2,I2,Agt
0x0x2b1cadac,1 IDNAME O_0 ltL2,I3,Bgt
0x0x2b1cadc8,2 IDNAME O_0 ltL2,I4,dimensiongt
0x0x2b1cade4,3 BODY BLOCK 0x0x2b1cae10,0
END_BLOCK 0x0x2b1cae10 BLOCK 0x0x2b1cae3c,1
END_BLOCK 0x0x2b1cae3c BLOCK 0x0x2b1cae68,2
PRAGMA 0 !120 ltnull-stgt CV(0) (0x0)
PREAMBLE_END 0x0x2b1cae94,0 LOC 1 54 int i,
j LOC 1 55 for(i0 iltdimension i)
void MatrixVectorMultiply(double C, double A,
double B, int dimension) int i, j for(i0
iltdimension i) Ci 0.0
for(j0 jltdimension j) Ci Ci
AidimensionjBj
26FUNC_ENTRY (MatrixVectorMultiply)
Highest WHIRL Representation
IDNAME (C)
IDNAME (A)
IDNAME (B)
IDNAME (dimension)
BLOCK
BLOCK
BLOCK
LOC 1 54 int i, j LOC 1 55 for(i0
iltdimension i) I4INTCONST CV(0) (0x0)
0x0x2b1caedc,4 I4STID O_0 ltL2,I5,igt
TltI4,.predef_I4,A4gt 0x0x2b1caec0,0 WHILE_DO
0x0x2b1caf08,3 I4I4LDID O_0
ltL2,I4,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1caf40,1 I4I4LDID O_0 ltL2,I5,igt
TltI4,.predef_I4,A4gt 0x0x2b1caf5c,2 I4I4GT
0x0x2b1caf24,5 BODY BLOCK 0x0x2b1caf88,4
LOC 1 56 LOC 1 57 Ci 0.0
F8CONST ltL1,I32,____0.000000000000000gt
0x0x2b1cafd0,6 U8U8LDID O_0 ltL2,I1,Cgt
TltI43,anon_ptr.,A8gt 0x0x2b1cb008,4
I8I4LDID O_0 ltL2,I5,igt TltI9,.predef_U8,A8gt
0x0x2b1cb05c,5 U8I8CVT 0x0x2b1cb040,9
U8INTCONST CV(8) (0x8) 0x0x2b1cb078,10
U8MPY 0x0x2b1cb024,8 U8ADD 0x0x2b1cafec,7
F8ISTORE O_0 TltI43,anon_ptr.,A8gt 0x0x2b1cafb4,3
void MatrixVectorMultiply(double C, double A,
double B, int dimension) int i, j for(i0
iltdimension i) Ci 0.0
for(j0 jltdimension j) Ci Ci
AidimensionjBj
27FUNC_ENTRY (MatrixVectorMultiply)
Highest WHIRL Representation
IDNAME (C)
IDNAME (A)
IDNAME (B)
IDNAME (dimension)
BLOCK
BLOCK
BLOCK
LOC 1 54 int i, j LOC 1 55 for(i0
iltdimension i) I4INTCONST CV(0) (0x0)
0x0x2b1caedc,4 I4STID O_0 ltL2,I5,igt
TltI4,.predef_I4,A4gt 0x0x2b1caec0,0 WHILE_DO
0x0x2b1caf08,3 I4I4LDID O_0
ltL2,I4,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1caf40,1 I4I4LDID O_0 ltL2,I5,igt
TltI4,.predef_I4,A4gt 0x0x2b1caf5c,2 I4I4GT
0x0x2b1caf24,5 BODY BLOCK 0x0x2b1caf88,4
LOC 1 56 LOC 1 57 Ci 0.0
F8CONST ltL1,I32,____0.000000000000000gt
0x0x2b1cafd0,6 U8U8LDID O_0 ltL2,I1,Cgt
TltI43,anon_ptr.,A8gt 0x0x2b1cb008,4
I8I4LDID O_0 ltL2,I5,igt TltI9,.predef_U8,A8gt
0x0x2b1cb05c,5 U8I8CVT 0x0x2b1cb040,9
U8INTCONST CV(8) (0x8) 0x0x2b1cb078,10
U8MPY 0x0x2b1cb024,8 U8ADD 0x0x2b1cafec,7
F8ISTORE O_0 TltI43,anon_ptr.,A8gt 0x0x2b1cafb4,3
void MatrixVectorMultiply(double C, double A,
double B, int dimension) int i, j for(i0
iltdimension i) Ci 0.0
for(j0 jltdimension j) Ci Ci
AidimensionjBj
28FUNC_ENTRY (MatrixVectorMultiply)
Highest WHIRL Representation
IDNAME (C)
IDNAME (A)
IDNAME (B)
IDNAME (dimension)
BLOCK
BLOCK
BLOCK
WHILE
GT
LDID (i)
LDID (dimension)
void MatrixVectorMultiply(double C, double A,
double B, int dimension) int i, j for(i0
iltdimension i) Ci 0.0
for(j0 jltdimension j) Ci Ci
AidimensionjBj
LOC 1 58 for(j0 jltdimension j)
I4INTCONST CV(0) (0x0) 0x0x2b1cb0c0,11 I4STID
O_0 ltL2,I6,jgt TltI4,.predef_I4,A4gt
0x0x2b1cb0a4,6 WHILE_DO 0x0x2b1cb0ec,5
I4I4LDID O_0 ltL2,I4,dimensiongt
TltI4,.predef_I4,A4gt 0x0x2b1cb124,7 I4I4LDID
O_0 ltL2,I6,jgt TltI4,.predef_I4,A4gt
0x0x2b1cb140,8 I4I4GT 0x0x2b1cb108,12
BODY BLOCK 0x0x2b1cb16c,6
29 LOC 1 59 Ci Ci AidimensionjB
j U8U8LDID O_0 ltL2,I1,Cgt
TltI43,anon_ptr.,A8gt 0x0x2b1cb208,11
I8I4LDID O_0 ltL2,I5,igt TltI9,.predef_U8,A8gt
0x0x2b1cb25c,12 U8I8CVT
0x0x2b1cb240,16 U8INTCONST CV(8) (0x8)
0x0x2b1cb278,17 U8MPY 0x0x2b1cb224,15
U8ADD 0x0x2b1cb1ec,14 F8F8ILOAD O_0
TltI11,.predef_F8,A8gt TltI43,anon_ptr.,A8gt
0x0x2b1cb1d0,10 U8U8LDID O_0 ltL2,I2,Agt
TltI43,anon_ptr.,A8gt 0x0x2b1cb2e8,14
I4I4LDID O_0 ltL2,I6,jgt TltI4,.predef_I4,A4gt
0x0x2b1cb358,15 I4I4LDID O_0
ltL2,I4,dimensiongt TltI4,.predef_I4,A4gt
0x0x2b1cb390,16 I4I4LDID O_0
ltL2,I5,igt TltI4,.predef_I4,A4gt 0x0x2b1cb3ac,17
I4MPY 0x0x2b1cb374,23 I4ADD
0x0x2b1cb33c,22 U8I4CVT
0x0x2b1cb320,21 U8INTCONST CV(8) (0x8)
0x0x2b1cb3c8,24 U8MPY
0x0x2b1cb304,20 U8ADD 0x0x2b1cb2cc,19
F8F8ILOAD O_0 TltI11,.predef_F8,A8gt
TltI43,anon_ptr.,A8gt 0x0x2b1cb2b0,13
U8U8LDID O_0 ltL2,I3,Bgt TltI43,anon_ptr.,A8gt
0x0x2b1cb41c,19 I8I4LDID O_0
ltL2,I6,jgt TltI9,.predef_U8,A8gt 0x0x2b1cb470,20
U8I8CVT 0x0x2b1cb454,27
U8INTCONST CV(8) (0x8) 0x0x2b1cb48c,28
U8MPY 0x0x2b1cb438,26 U8ADD
0x0x2b1cb400,25 F8F8ILOAD O_0
TltI11,.predef_F8,A8gt TltI43,anon_ptr.,A8gt
0x0x2b1cb3e4,18 F8MPY 0x0x2b1cb294,18
F8ADD 0x0x2b1cb1b4,13 U8U8LDID O_0
ltL2,I1,Cgt TltI43,anon_ptr.,A8gt 0x0x2b1cb4c4,21
I8I4LDID O_0 ltL2,I5,igt TltI9,.predef_U8,A8gt
0x0x2b1cb518,22 U8I8CVT
0x0x2b1cb4fc,31 U8INTCONST CV(8) (0x8)
0x0x2b1cb534,32 U8MPY 0x0x2b1cb4e0,30
U8ADD 0x0x2b1cb4a8,29 F8ISTORE O_0
TltI43,anon_ptr.,A8gt 0x0x2b1cb198,9 LABEL L2
Flg(0) 0x0x2b1cb560,0 I4I4LDID O_0
ltL2,I6,jgt TltI4,.predef_I4,A4gt 0x0x2b1cb5c4,24
LABEL L2 Flg(0) 0x0x2b1cb560,0 I4I4LDID
O_0 ltL2,I6,jgt TltI4,.predef_I4,A4gt
0x0x2b1cb5c4,24 I4INTCONST CV(1) (0x1)
0x0x2b1cb5e0,34 I4ADD 0x0x2b1cb5a8,33
I4STID O_0 ltL2,I6,jgt TltI4,.predef_I4,A4gt
0x0x2b1cb58c,23 END_BLOCK 0x0x2b1cb16c
30LOC 1 59 Ci Ci AidimensionjBj
BLOCK
F8ISTORE
F8ADD
F8MPY
F8F8ILOAD
U8ADD
U8MPY
LDID ( B )
U8I8CVT
CV(8)
LDID ( j )
31LOC 1 59 Ci Ci AidimensionjBj
BLOCK
F8ISTORE
F8ADD
F8MPY
F8F8ILOAD
U8ADD
U8MPY
LDID ( B )
U8I8CVT
CV(8)
LDID ( j )
load Bj
32LOC 1 59 Ci Ci AidimensionjBj
BLOCK
F8ISTORE
F8ADD
F8MPY
F8F8ILOAD
F8F8ILOAD
U8ADD
U8ADD
U8MPY
LDID ( B )
U8MPY
LDID ( A )
U8I8CVT
U8I4CVT
CV(8)
CV(8)
LDID ( j )
I4ADD
I4MPY
LDID ( j )
LDID ( i )
LDID (dimension)
load Aidimesionj
33LOC 1 59 Ci Ci AidimensionjBj
BLOCK
F8ISTORE
F8ADD
F8MPY
F8F8ILOAD
U8ADD
F8F8ILOAD
U8MPY
LDID ( C )
U8ADD
U8I8CVT
CV(8)
U8MPY
LDID ( B )
LDID ( i )
load Ci
U8I8CVT
CV(8)
LDID ( j )
34LOC 1 59 Ci Ci AidimensionjBj
BLOCK
F8ISTORE
I4STID ( j )
ADD
F8ADD
LDID ( j )
CV(1)
F8MPY
j
F8F8ILOAD
U8ADD
U8MPY
LDID ( B )
U8I8CVT
CV(8)
LDID ( j )
35FUNC_ENTRY (MatrixVectorMultiply)
IDNAME (C)
IDNAME (A)
IDNAME (B)
IDNAME (dimension)
BLOCK
BLOCK
BLOCK
WHILE
GT
LDID (I)
LDID (dimension)
Highest WHIRL Representation.
36WHIRL Lowering
- The following example will show you how the VHLW
is lowered to VLW - We will use an example to illustrate how arrays
are lowered in F90. - We will start with the Very High Level
Representation
37Very High WHIRL
FuncEntry (Main)
real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
Block (body)
F4Istore
F4Istore
A T3
C A 1
F4I4CVT
U8ArrayExp
I4ArrayExp
I8const 1000
U8Array Section
I4const 1000
I4ILoad
I8Triplet
U8LDA A
I8Const 1000
U8Array Section
I4Const 0
I4Const 1
I8Triplet
U8LDA T3
I4Const 0
I4Const 1
I8Const 1000
38VHLW (cont)
real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
FuncEntry (Main)
Block (body)
F4Istore
F4Istore
A T3
C A 1
F4ArrayExp
U8ArrayExp
F4Add
I4const 1000
I8const 1000
U8Array Section
F4F4ILoad
I8Triplet
U8LDA C
F4const 1.000
U8Array Section
I4Const 0
I4Const 1
I8Const 1000
I8Triplet
U8LDA A
I4Const 0
I4Const 1
I8Const 1000
39real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
HighWhirl
FuncEntry (Main)
Block (body)
Do_loop
Do_loop
Init
Comp
Incr
Body
Label
I8Stid i1
Block (body)
Idname i1
I8Stid i1
I4I8LE lt
I8Intconst 0
I8Intconst 999
I8I8LDID i1
I8Add
I8Stid
I8I8LDID i1
I8ntconst 1
F90 Array Lowering
AT3
U8Array
F4I4CVT
i1 do i10, 999, 1 A(i1) T3(i1)
end do
U8LDA A
I8Intconst 1000
I8I8LDID i1
I4I4ILoad
U8Array
U8LDA T3
I8Intconst 1000
I8I8LDID i1
40real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
HLW (cont..)
FuncEntry (Main)
Block (body)
Do_loop
Do_loop
Init
Comp
Incr
Body
Label
I8Stid i2
Block (body)
Idname i2
I8Stid i2
I4I8LE lt
I8Intconst 0
I8Intconst 999
I8I8LDID i2
I8Add
I8Stid
I8I8LDID i2
I8ntconst 1
I8ntconst 1
F90 Array Lowering
CA1
F4ADD
U8Array
i2 do i20, 999, 1 C(i2) A(i2) 1
end do
U8LDA C
I8Intconst 1000
I8I8LDID i2
F4F4ILoad
F4CONST 1.0
U8Array
U8LDA A
I8Intconst 1000
I8I8LDID i2
41real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
Mid- Whirl
FuncEntry (Main)
Block (body)
U8Stid rU8
I8Stid rI8
U8Stid rU8
I4Stid rI4
U8Stid rU8
..
r291
r264
r268
r269
r272
U8LDA A
I8IntConst 0
U8LDA T3
U8U8Ldid rU8
I8IntConst 1000
r291
Loop index i1
For loop cond.
Addresses of Arrays, Value of Constants are
loaded into pseudo Registers. Each pseudo
register has an ID associated with it. r291,
r264, r268,r269, r272 pseudo registers ID (symtab
entry)
42real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
MLW (cont..)
FuncEntry (Main)
Block (body)
Label L5
Label L5
Loop_Info
F4Istore
I8Stid
I8I8Ldid
I8Intconst 1000
U8U8Ldid
F4I8CVT
I8ADD
r264 (loop Index)
I8CVTL
I8Intconst 1
I8I8Ldid
A(i)T3(i) r269r268
ii1 r264 r264 1
U8U4ILoad
U8U8Ldid
- Operations are done on pseudo-registers
- Loops Lowered to branches
43real,dimension(1000)a real,dimension(1000)c a
(/(i,i1,1000)/) ca1 print ,c end
MLW (cont..)
FuncEntry (Main)
Block (body)
Label L5
Label L9
U8Stid
U8Stid
TrueBR L5
U8ADD
U8ADD
BI8NE
I8Intconst 4
I8I8Ldid
I8Intconst 4
I8I8Ldid
I4I4Ldid
I8I8LDID
A(i11) r269 r269 4 (move float address to
next four bytes)
T3(i11) r268 r268 4 (move int address to
next four bytes)
Loop Condition i1 lt 1000 r272
!264
44LLW c a 1
--------------------------------------------------
--------------------- // Block 3 Pred 9 Succ
11 -----------------------------------------------
------------------------ BB3 (length3) -- flags
0x0400, frequency 1 (heuristic) Scheduled
BB In linear order, BB_prev BB 9 BB_next
BB11 defreach_in 8,13,394-395,713,715,719,77
3,775-807,840-841,843-850,852-854,856 live_in
8,13,585,713,719,773-807,858-860,863-865
defreach_out 8,13,394-395,713,715,719,727,773,77
5-807,840-841,843-850,852-854,856 live_out
8,13,585,713,719,727,773-807,858-860,863-865
live_def 727 live_use 8 // Freq
1.000000 (heur) Prob 1.0 4ca1
0 GTN727(r14) - adds TN257(p0) (symC0)
GTN8(r7) scheduled start_bundle 7 - nop.i
TN257(p0) (0x0) scheduled 8 - nop.i
TN257(p0) (0x0) end_group scheduled
Allocating architecture registers to operations
on pseudo registers. Code basic blocks of low
level representation.
45Symbol Table (consist of a set of tables)
- Divided in
- Global Tables only (yellow)
- Local Tables only (blue)
- Local Global tables (Green)
- Type Table
- Symbol Table
- Value/Constants Table
- Scope Table
46Symbol Table
- ST_TAB (any symbol with a name)
- INITO_TAB (Initial Values to Objects)
- INITOV_TAB (Initial Values to field of Objects
- ST_ATTR_TAB (miscellaneous attributes with an
entry to the symbol table)
- PU_TAB (function/procedure/prototype)
- TY_TAB (type table)
- FLD_TAB (fields in the structure type)
- TYLIST_TAB (parameter type in a func. Prototype
declaration) - ARB_TAB (Dimension of Array types)
- TCON_TAB (non-integer constants)
- BLK_TAB (layout info block of data)
- INITV_TAB (for scalar components)
- STR_TAB (Strings are stored here)
47Example of Symbol Tables (VHLW)
SYMTAB for MAIN__ level 2,
st 9, label 2, VHLW
Symbols
1 A lt2,1gt Variable of type
.array. (29, KIND_ARRAY) Address 0(Alt2,1gt)
Alignment 4 bytes Flags 0x00000000,
XLOCAL Sclass AUTO 2 C lt2,2gt
Variable of type .array. (29, KIND_ARRAY) Addre
ss 0(Clt2,2gt) Alignment 4 bytes Flags 0x00000
000, XLOCAL Sclass AUTO 3 I
lt2,3gt Variable of type .predef_I4 (4,
I4) Address 0(Ilt2,3gt) Alignment 4
bytes Flags 0x00000000, XLOCAL Sclass
AUTO 5 t3 lt2,5gt Variable of type
.array. (30, KIND_ARRAY) Address 0(t3lt2,5gt)
Alignment 4 bytes Flags 0x00000008
initialized, XLOCAL Sclass PSTATIC 6
print,c lt2,6gt Name-only Address
0(print,clt2,6gt) Flags 0x00000000,
XLOCAL Sclass UNKNOWN 7 START_IO
lt2,7gt Name-only Address 0(START_IOlt2,7gt)
Flags 0x00000000, XLOCAL Sclass
UNKNOWN
48Dataflow Relationship Between ModulesCompiler
Analysis Optimization
49Compiler Analysis
- IPA Analysis Optimization
- Invoked with IPA flag
- Alias Analysis
- Array Section
- Inlining
- Cloning
- Dead function and Variable elimination
- Constant Propagation
50IPA Module
51Loop Nest Optimizer
- All Languages (including OpenMP)
- Loop level dependence analysis
- Loop level transformation
- Loop Fission, Fusion, Unroll, Jam, Interchange,
Tiling, etc - Based on a unified cost model /integrated with
software pipelining - Automatic parallelization
- Array privatization, Array Section Analsys,
OpenMP lowering. Integrated with automatic
methods.
52Loop Nest Optimizer
- Invoked with O3 flag
- Creates a loop-level dependence graph
- Each phase of the LNO updates the dependence
graph - It uses a hierarchical tests to look for
dependences (trivial tests, array bounds test,
gcd test and Omega test (SOE))
53LNO Dependence Graph in Open64
Partial Dep. Graph
program dep1 real a,b,c(100) read ,
a, b do i1,100 c(i) a / i
if (c(i-2) .le. 50) then a
c(i-3) / b 2.0 endif enddo
do i4,88 c(i) c(i4) / a enddo
do j1,100 print ,c(j)
enddo end program
PU graph MAIN__Printing an ARRAY_DIRECTED_GRAPH16
of type DEP Vertex 1 for Wn
0x0x8093688 Line5 filenamedep3.f Edge 1 to
vertex 2 has dep and Is_Must is 1 Vertex 2 for
Wn 0x0x8093768 Line7 filenamedep3.f (F4F4ILOAD
(U8ARRAY (U8LDA C) (100) ( (I) (-2))))
54Global Optimizer
- Invoked with O2 or O3 flag
- Based on SSA form (single static assignment) All
variables are only defined once throughout all
the program). - Converts IR to SSA form, performs optimizations,
translates back to IR - The PREOPT part responsible of creating the
control flow graph. - (CFG in basic block mode) BB structure
55SSA Form Example
- Phi regarded as def
- Each def dominates all its uses
- Many uses to one def
Non-SSA form
56Working with the compiler
- What you need to know
- Compiler written in C/C
- Compiler Structure
- How to Compiler / Install Compiler
- Whirl Specification Document
- Symbol Table Specification
- How to debug/ tools to work
57Compiler Structure
58How to Compile / Install
59How to use the compiler
- Type
- openf90 -ipa O2 O3 ltmyprogram.f90gt
- opencc -ipa O2 O3 ltmyprogram.cgt
- openCC -ipa O2 O3 ltmyprogram.cgt
60Whirl / Symtab documtation
61How to Debug the compiler
- Debugging can be done in several ways
- Debugging the source code directly
- Using DDD debugger
- Use tracing flags to export intermediate in ascii
- representation before/after a phase
- Save intermediate files and translate
- them to ascii. (using ir_b2a)
- Using tools to translate IR back to source
62Exporting the IR before/after a phase
- Compile with flag -wb,-trltphasegt
- Creates a file .t with tracing info.
- Compiler Phases
/ Front end phases / TP_SEMANTICS,
"SEM", "Semantic analyzer" , TP_IRB,
"IRB", "IR (WHIRL) builder" , /
Intermediate/utility phases / TP_IR_READ,
"IRR", "IR (WHIRL) reader/writer" ,
TP_WHIRL2FC, "WH2", "WHIRL to Fortran/C"
, TP_WHIRLSIMP, "SMP", "WHIRL
simplifier" , TP_REGION, "RGN",
"Region support" , TP_ORI,
"ORI", "Olimit Region Insertion" ,
TP_FEEDBACK, "FDB", "Feedback support"
, TP_VHO_LOWER, "VHO", "VHO lowering"
, TP_LOWER, "LOW", "WHIRL
lowering" , TP_LOWER90, "L90", "F90
WHIRL lowering" , / IPA/inlining phases /
TP_INLINE, "INL", "Inliner" ,
TP_IPL, "IPL", "IPA local summary
phase" , TP_IPA, "IPA", "IPA
analysis phase" , TP_IPO, "IPO",
"IPA optimization phase" , TP_IPM,
"IPM", "IPA miscellaneous" , / Global
optimizer / TP_ALIAS, "ALI",
"Alias/mod/ref analysis" , TP_WOPT1,
"OPT", "Global optimization" , TP_WOPT2,
"OP2", "More global optimization" ,
TP_WOPT3, "OP3", "Even more global
optimization" ,
/ Loop nest optimizer / TP_VECDD,
"VDD", "Vector data dependency analysis" ,
TP_LNOPT, "LNO", "Loop Nest
Optimization" , TP_LNOPT2, "LN2",
"More Loop Nest Optimization" , TP_LNOPT3,
"LN3", "Even more Loop Nest Optimization"
, / Code generator / TP_DATALAYOUT,
"LAY", "Data layout" , TP_CG,
"CGM", "Code Generator miscellaneous" ,
TP_CGEXP, "EXP", "Code generator
expansion" , TP_LOCALIZE, "LOC",
"Localize TNs" , TP_FIND_GLOB, "GLR",
"Find global register live ranges" , TP_EBO,
"EBO", "Extended Block Optimizer"
, TP_FLOWOPT, "FLW", "Control flow
optimization" , TP_HBF, "HBF",
"Hyperblock Formation" , TP_CGLOOP,
"LOP", "Code generator loop optimization" ,
TP_SWPIPE, "SWP", "Software pipelining"
, TP_SRA, "SRA", "SWP register
allocation" , TP_SCHED, "SCH",
"Scheduling" , TP_GCM, "GCM",
"Global code motion" , TP_GRA,
"GRA", "Global register allocation" ,
TP_ALLOC, "LRA", "Local register
allocation" , TP_PSGCM, "PSG",
"Post Schedule Global code motion" , TP_PQS,
"PQS", "Predicate query system" ,
TP_THR, "THR", "Tree-Height
Reduction" , TP_EMIT, "EMT",
"Code emission" ,
63How to access the compiler
- ssh groupltnumgt_at_lurch.cs.uh.edu
- Change your password.
- Follow installation/compilation instructions
- Install/Compile will require 4 hours.
- Check if it works with some test codes.
- Meet your project assistants.