Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
H
hostCompiledSimulation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
hostCompiledSimulation
Commits
ff4c6e4b
Commit
ff4c6e4b
authored
Aug 01, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
match_cfg.py working for adpcm and sieve perfectly
Signed-off-by:
Gaurav Kukreja
<
gaurav@gauravk.in
>
parent
1201ec2e
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
2682 additions
and
755 deletions
+2682
-755
Makefile
examples/Makefile
+2
-1
Makefile
examples/adpcm/app_dir/Makefile
+1
-1
Makefile
examples/adpcm/ir_c/Makefile
+1
-1
adpcm_IR.c
examples/adpcm/ir_c/adpcm_IR.c
+134
-198
my_ctop_IR.c
examples/adpcm/ir_c/my_ctop_IR.c
+42
-42
Makefile
examples/basicmath/app_dir/Makefile
+1
-1
Makefile
examples/basicmath/ir_c/Makefile
+3
-3
basicmath_small_truncated3_IR.c
examples/basicmath/ir_c/basicmath_small_truncated3_IR.c
+112
-84
isqrt_IR.c
examples/basicmath/ir_c/isqrt_IR.c
+3
-3
my_math_IR.c
examples/basicmath/ir_c/my_math_IR.c
+27
-27
Makefile
examples/crc32/app_dir/Makefile
+1
-1
Makefile
examples/crc32/ir_c/Makefile
+1
-1
crc_32_IR.c
examples/crc32/ir_c/crc_32_IR.c
+48
-58
Makefile
examples/sha/app_dir/Makefile
+1
-1
Makefile
examples/sha/ir_c/Makefile
+2
-2
my_mem_IR.c
examples/sha/ir_c/my_mem_IR.c
+24
-26
sha_IR.c
examples/sha/ir_c/sha_IR.c
+225
-247
cfg_isc.py
instrument/cfg_isc.py
+2
-2
basicmath_small_truncated3_IR.c
...rument/examples/basicmath/basicmath_small_truncated3_IR.c
+179
-0
cubic_IR.c
instrument/examples/basicmath/cubic_IR.c
+116
-0
isqrt_IR.c
instrument/examples/basicmath/isqrt_IR.c
+107
-0
my_math_IR.c
instrument/examples/basicmath/my_math_IR.c
+625
-0
rad2deg_IR.c
instrument/examples/basicmath/rad2deg_IR.c
+43
-0
crc_32_IR.c
instrument/examples/crc32/crc_32_IR.c
+251
-0
crc_top_IR.c
instrument/examples/crc32/crc_top_IR.c
+33
-0
my_mem_IR.c
instrument/examples/sha/my_mem_IR.c
+92
-0
sha_IR.c
instrument/examples/sha/sha_IR.c
+536
-0
sha_driver_IR.c
instrument/examples/sha/sha_driver_IR.c
+33
-0
match_cfg.py
instrument/match_cfg.py
+37
-56
No files found.
examples/Makefile
View file @
ff4c6e4b
...
...
@@ -2,8 +2,9 @@ include ../Makefile.macros
include
Makefile.macros
#EXAMPLES = sieve crc32 adpcm sha basicmath
EXAMPLES
=
crc32 basicmath
#EXAMPLES = sha sieve
EXAMPLES
=
adpcm
#EXAMPLES = sha
STARTADR
=
0x10000214
# Space separated list of all C files in APPDIR
...
...
examples/adpcm/app_dir/Makefile
View file @
ff4c6e4b
...
...
@@ -7,7 +7,7 @@ include ../../Makefile.macros
APP1
=
my_ctop
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
IRDUMP
=
1
#defined - dump IR files, undefined - don't.
#PRINT = 1 #if defined and PHASE defined, include soft-float lib. fprintf uses floating point
...
...
examples/adpcm/ir_c/Makefile
View file @
ff4c6e4b
...
...
@@ -11,7 +11,7 @@ APP1 = my_ctop_IR
#PHASE = final #when not defined, CC = gcc. otherwise cc = ppc-gcc
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-g
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-g
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
#IRDUMP = 1 #defined - dump IR files, undefined - don't.
#PRINT = 1 #if defined and PHASE defined, include soft-float lib. fprintf uses floating point
...
...
examples/adpcm/ir_c/adpcm_IR.c
View file @
ff4c6e4b
...
...
@@ -82,12 +82,14 @@ static int stepsizeTable[89] = {
void
adpcm_coder
(
short
indata
[],
char
outdata
[],
int
len
,
struct
adpcm_state
*
state
)
{
int
valpred_58
;
int
delta_56
;
int
step_55
;
int
step_54
;
int
valpred_53
;
uintptr_t
ivtmp_47
;
int
valpred_43
;
int
index_42
;
int
index_40
;
int
delta_39
;
int
step_38
;
int
step_37
;
int
valpred_36
;
uintptr_t
ivtmp_30
;
int
bufferstep
;
int
outputbuffer
;
int
index
;
...
...
@@ -107,26 +109,26 @@ adpcm_coderbb_2:
if
(
len
>
0
)
goto
adpcm_coderbb_3
;
else
goto
adpcm_coderbb_2
4
;
// # SUCC: 3 [91.0%] (true,exec) 2
4
[9.0%] (false,exec)
goto
adpcm_coderbb_2
1
;
// # SUCC: 3 [91.0%] (true,exec) 2
1
[9.0%] (false,exec)
adpcm_coderbb_3:
// # PRED: 2 [91.0%] (true,exec)
outp
=
outdata
;
ivtmp_
47
=
0
;
ivtmp_
30
=
0
;
bufferstep
=
1
;
// # SUCC: 4 [100.0%] (fallthru,exec)
adpcm_coderbb_4:
// # PRED:
21 [91.0%] (dfs_back,
true,exec) 3 [100.0%] (fallthru,exec)
diff
=
(
int
)
*
(
short
int
*
)((
uintptr_t
)
indata
+
(
uintptr_t
)
ivtmp_
47
)
-
valpred
;
// # PRED:
18 [91.0%] (
true,exec) 3 [100.0%] (fallthru,exec)
diff
=
(
int
)
*
(
short
int
*
)((
uintptr_t
)
indata
+
(
uintptr_t
)
ivtmp_
30
)
-
valpred
;
if
(
diff
<
0
)
goto
adpcm_coderbb_5
;
else
goto
adpcm_coderbb_2
5
;
// # SUCC: 5 [27.0%] (true,exec) 2
5
[73.0%] (false,exec)
goto
adpcm_coderbb_2
2
;
// # SUCC: 5 [27.0%] (true,exec) 2
2
[73.0%] (false,exec)
adpcm_coderbb_2
5
:
adpcm_coderbb_2
2
:
// # PRED: 4 [73.0%] (false,exec)
sign
=
0
;
goto
adpcm_coderbb_6
;
...
...
@@ -139,15 +141,15 @@ adpcm_coderbb_5:
// # SUCC: 6 [100.0%] (fallthru,exec)
adpcm_coderbb_6:
// # PRED: 2
5
[100.0%] (fallthru) 5 [100.0%] (fallthru,exec)
// # PRED: 2
2
[100.0%] (fallthru) 5 [100.0%] (fallthru,exec)
vpdiff
=
step
>>
3
;
if
(
diff
>=
step
)
goto
adpcm_coderbb_7
;
else
goto
adpcm_coderbb_2
6
;
// # SUCC: 7 [50.0%] (true,exec) 2
6
[50.0%] (false,exec)
goto
adpcm_coderbb_2
3
;
// # SUCC: 7 [50.0%] (true,exec) 2
3
[50.0%] (false,exec)
adpcm_coderbb_2
6
:
adpcm_coderbb_2
3
:
// # PRED: 6 [50.0%] (false,exec)
delta
=
0
;
goto
adpcm_coderbb_8
;
...
...
@@ -161,9 +163,9 @@ adpcm_coderbb_7:
// # SUCC: 8 [100.0%] (fallthru,exec)
adpcm_coderbb_8:
// # PRED: 2
6
[100.0%] (fallthru) 7 [100.0%] (fallthru,exec)
step_
54
=
step
>>
1
;
if
(
diff
>=
step_
54
)
// # PRED: 2
3
[100.0%] (fallthru) 7 [100.0%] (fallthru,exec)
step_
37
=
step
>>
1
;
if
(
diff
>=
step_
37
)
goto
adpcm_coderbb_9
;
else
goto
adpcm_coderbb_10
;
...
...
@@ -172,14 +174,14 @@ adpcm_coderbb_8:
adpcm_coderbb_9:
// # PRED: 8 [50.0%] (true,exec)
delta
=
delta
|
2
;
diff
=
diff
-
step_
54
;
vpdiff
=
vpdiff
+
step_
54
;
diff
=
diff
-
step_
37
;
vpdiff
=
vpdiff
+
step_
37
;
// # SUCC: 10 [100.0%] (fallthru,exec)
adpcm_coderbb_10:
// # PRED: 8 [50.0%] (false,exec) 9 [100.0%] (fallthru,exec)
step_
55
=
step_54
>>
1
;
if
(
diff
>=
step_
55
)
step_
38
=
step_37
>>
1
;
if
(
diff
>=
step_
38
)
goto
adpcm_coderbb_11
;
else
goto
adpcm_coderbb_12
;
...
...
@@ -188,7 +190,7 @@ adpcm_coderbb_10:
adpcm_coderbb_11:
// # PRED: 10 [50.0%] (true,exec)
delta
=
delta
|
1
;
vpdiff
=
vpdiff
+
step_
55
;
vpdiff
=
vpdiff
+
step_
38
;
// # SUCC: 12 [100.0%] (fallthru,exec)
adpcm_coderbb_12:
...
...
@@ -201,98 +203,68 @@ adpcm_coderbb_12:
adpcm_coderbb_13:
// # PRED: 12 [50.0%] (true,exec)
valpred_
53
=
valpred
-
vpdiff
;
valpred_
36
=
valpred
-
vpdiff
;
goto
adpcm_coderbb_15
;
// # SUCC: 15 [100.0%] (fallthru,exec)
adpcm_coderbb_14:
// # PRED: 12 [50.0%] (false,exec)
valpred_
53
=
vpdiff
+
valpred
;
valpred_
36
=
vpdiff
+
valpred
;
// # SUCC: 15 [100.0%] (fallthru,exec)
adpcm_coderbb_15:
// # PRED: 13 [100.0%] (fallthru,exec) 14 [100.0%] (fallthru,exec)
valpred_58
=
(
valpred_53
>-
32768
)
?
valpred_53
:-
32768
;
valpred
=
(
valpred_58
<
32767
)
?
valpred_58
:
32767
;
delta_56
=
delta
|
sign
;
index
=
indexTable
[
delta_56
]
+
index
;
if
(
index
<
0
)
goto
adpcm_coderbb_27
;
else
valpred_43
=
(
valpred_36
>-
32768
)
?
valpred_36
:-
32768
;
valpred
=
(
valpred_43
<
32767
)
?
valpred_43
:
32767
;
delta_39
=
delta
|
sign
;
index_40
=
indexTable
[
delta_39
]
+
index
;
index_42
=
(
index_40
>
0
)
?
index_40
:
0
;
index
=
(
index_42
<
88
)
?
index_42
:
88
;
step
=
stepsizeTable
[
index
];
if
(
bufferstep
!=
0
)
goto
adpcm_coderbb_16
;
// # SUCC: 27 [27.0%] (true,exec) 16 [73.0%] (false,exec)
adpcm_coderbb_27:
// # PRED: 15 [27.0%] (true,exec)
index
=
0
;
goto
adpcm_coderbb_17
;
// # SUCC: 17 [100.0%] (fallthru)
adpcm_coderbb_16:
// # PRED: 15 [73.0%] (false,exec)
if
(
index
>
88
)
goto
adpcm_coderbb_28
;
else
goto
adpcm_coderbb_17
;
// # SUCC:
28 [68.5%] (true,exec) 17 [31.5
%] (false,exec)
// # SUCC:
16 [50.0%] (true,exec) 17 [50.0
%] (false,exec)
adpcm_coderbb_
28
:
// # PRED: 1
6 [68.5
%] (true,exec)
index
=
88
;
adpcm_coderbb_
16
:
// # PRED: 1
5 [50.0
%] (true,exec)
outputbuffer
=
delta_39
<<
4
&
255
;
goto
adpcm_coderbb_18
;
// # SUCC: 18 [100.0%] (fallthru)
// # SUCC: 18 [100.0%] (fallthru
,exec
)
adpcm_coderbb_17:
// # PRED: 16 [31.5%] (false,exec) 27 [100.0%] (fallthru)
// # PRED: 15 [50.0%] (false,exec)
*
outp
=
(
signed
char
)
delta_39
&
15
|
(
signed
char
)
outputbuffer
;
outp
=
(
uintptr_t
)
outp
+
1
;
// # SUCC: 18 [100.0%] (fallthru,exec)
adpcm_coderbb_18:
// # PRED: 17 [100.0%] (fallthru,exec) 28 [100.0%] (fallthru)
step
=
stepsizeTable
[
index
];
if
(
bufferstep
!=
0
)
goto
adpcm_coderbb_19
;
else
goto
adpcm_coderbb_20
;
// # SUCC: 19 [50.0%] (true,exec) 20 [50.0%] (false,exec)
adpcm_coderbb_19:
// # PRED: 18 [50.0%] (true,exec)
outputbuffer
=
delta_56
<<
4
&
255
;
goto
adpcm_coderbb_21
;
// # SUCC: 21 [100.0%] (fallthru,exec)
adpcm_coderbb_20:
// # PRED: 18 [50.0%] (false,exec)
*
outp
=
(
signed
char
)
delta_56
&
15
|
(
signed
char
)
outputbuffer
;
outp
=
(
uintptr_t
)
outp
+
1
;
// # SUCC: 21 [100.0%] (fallthru,exec)
adpcm_coderbb_21:
// # PRED: 19 [100.0%] (fallthru,exec) 20 [100.0%] (fallthru,exec)
bufferstep
=
bufferstep
^
1
;
// # PRED: 16 [100.0%] (fallthru,exec) 17 [100.0%] (fallthru,exec)
bufferstep
=
bufferstep
==
0
;
len
=
len
+
-
1
;
ivtmp_
47
=
ivtmp_47
+
2
;
ivtmp_
30
=
ivtmp_30
+
2
;
if
(
len
!=
0
)
goto
adpcm_coderbb_4
;
else
goto
adpcm_coderbb_
22
;
// # SUCC: 4 [91.0%] (
dfs_back,true,exec) 22
[9.0%] (false,exec)
goto
adpcm_coderbb_
19
;
// # SUCC: 4 [91.0%] (
true,exec) 19
[9.0%] (false,exec)
adpcm_coderbb_
22
:
// # PRED:
21
[9.0%] (false,exec)
adpcm_coderbb_
19
:
// # PRED:
18
[9.0%] (false,exec)
if
(
bufferstep
==
0
)
goto
adpcm_coderbb_2
3
;
goto
adpcm_coderbb_2
0
;
else
goto
adpcm_coderbb_2
4
;
// # SUCC: 2
3 [67.0%] (true,exec) 24
[33.0%] (false,exec)
goto
adpcm_coderbb_2
1
;
// # SUCC: 2
0 [67.0%] (true,exec) 21
[33.0%] (false,exec)
adpcm_coderbb_2
3
:
// # PRED:
22
[67.0%] (true,exec)
adpcm_coderbb_2
0
:
// # PRED:
19
[67.0%] (true,exec)
*
outp
=
(
signed
char
)
(
signed
char
)
outputbuffer
;
// # SUCC: 2
4
[100.0%] (fallthru,exec)
// # SUCC: 2
1
[100.0%] (fallthru,exec)
adpcm_coderbb_2
4
:
// # PRED:
22 [33.0%] (false,exec) 23
[100.0%] (fallthru,exec) 2 [9.0%] (false,exec)
adpcm_coderbb_2
1
:
// # PRED:
19 [33.0%] (false,exec) 20
[100.0%] (fallthru,exec) 2 [9.0%] (false,exec)
state
->
valprev
=
(
short
int
)
(
short
int
)
valpred
;
state
->
index
=
(
char
)
(
char
)
index
;
return
;
...
...
@@ -303,11 +275,12 @@ adpcm_coderbb_24:
void
adpcm_decoder
(
char
indata
[],
short
int
outdata
[],
int
len
,
struct
adpcm_state
*
state
)
{
int
valpred_113
;
int
delta_112
;
int
valpred_111
;
uintptr_t
ivtmp_101
;
short
int
prephitmp_86
;
int
index_86
;
int
valpred_85
;
int
delta_83
;
int
index_82
;
int
valpred_81
;
uintptr_t
ivtmp_71
;
int
bufferstep
;
int
inputbuffer
;
int
index
;
...
...
@@ -319,87 +292,77 @@ void adpcm_decoder(char indata[], short int outdata[], int len, struct adpcm_sta
adpcm_decoderbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
valpred_
11
1
=
state
->
valprev
;
valpred_
8
1
=
state
->
valprev
;
index
=
state
->
index
;
step
=
stepsizeTable
[
index
];
if
(
len
>
0
)
goto
adpcm_decoderbb_4
;
else
goto
adpcm_decoderbb_3
;
// # SUCC: 4 [91.0%] (true,exec) 3 [9.0%] (false,exec)
else
goto
adpcm_decoderbb_18
;
// # SUCC: 3 [91.0%] (true,exec) 18 [9.0%] (false,exec)
adpcm_decoderbb_3:
// # PRED: 2 [9.0%] (false,exec)
prephitmp_86
=
(
short
int
)
valpred_111
;
goto
adpcm_decoderbb_22
;
// # SUCC: 22 [100.0%] (fallthru,exec)
adpcm_decoderbb_4:
// # PRED: 2 [91.0%] (true,exec)
inp
=
indata
;
ivtmp_
10
1
=
0
;
ivtmp_
7
1
=
0
;
bufferstep
=
0
;
// # SUCC:
5
[100.0%] (fallthru,exec)
// # SUCC:
4
[100.0%] (fallthru,exec)
adpcm_decoderbb_
5
:
// # PRED:
21 [100.0%] (fallthru,dfs_back,exec) 4
[100.0%] (fallthru,exec)
adpcm_decoderbb_
4
:
// # PRED:
17 [100.0%] (fallthru,dfs_back,exec) 3
[100.0%] (fallthru,exec)
if
(
bufferstep
!=
0
)
goto
adpcm_decoderbb_
6
;
goto
adpcm_decoderbb_
5
;
else
goto
adpcm_decoderbb_
7
;
// # SUCC:
6 [50.0%] (true,exec) 7
[50.0%] (false,exec)
goto
adpcm_decoderbb_
6
;
// # SUCC:
5 [50.0%] (true,exec) 6
[50.0%] (false,exec)
adpcm_decoderbb_
6
:
// # PRED:
5
[50.0%] (true,exec)
adpcm_decoderbb_
5
:
// # PRED:
4
[50.0%] (true,exec)
delta
=
inputbuffer
&
15
;
goto
adpcm_decoderbb_
8
;
// # SUCC:
8
[100.0%] (fallthru,exec)
goto
adpcm_decoderbb_
7
;
// # SUCC:
7
[100.0%] (fallthru,exec)
adpcm_decoderbb_
7
:
// # PRED:
5
[50.0%] (false,exec)
adpcm_decoderbb_
6
:
// # PRED:
4
[50.0%] (false,exec)
inputbuffer
=
(
int
)
*
inp
;
inp
=
(
uintptr_t
)
inp
+
1
;
delta
=
inputbuffer
>>
4
&
15
;
// # SUCC:
8
[100.0%] (fallthru,exec)
// # SUCC:
7
[100.0%] (fallthru,exec)
adpcm_decoderbb_8:
// # PRED: 6 [100.0%] (fallthru,exec) 7 [100.0%] (fallthru,exec)
index
=
indexTable
[
delta
]
+
index
;
if
(
index
<
0
)
goto
adpcm_decoderbb_23
;
adpcm_decoderbb_7:
// # PRED: 5 [100.0%] (fallthru,exec) 6 [100.0%] (fallthru,exec)
index_82
=
indexTable
[
delta
]
+
index
;
index_86
=
(
index_82
>
0
)
?
index_82
:
0
;
index
=
(
index_86
<
88
)
?
index_86
:
88
;
delta_83
=
delta
&
7
;
vpdiff
=
step
>>
3
;
if
(
delta_83
&
4
!=
0
)
goto
adpcm_decoderbb_8
;
else
goto
adpcm_decoderbb_9
;
// # SUCC:
23 [27.0%] (true,exec) 9 [73
.0%] (false,exec)
// # SUCC:
8 [50.0%] (true,exec) 9 [50
.0%] (false,exec)
adpcm_decoderbb_23:
// # PRED: 8 [27.0%] (true,exec)
index
=
0
;
goto
adpcm_decoderbb_10
;
// # SUCC: 10 [100.0%] (fallthru)
adpcm_decoderbb_8:
// # PRED: 7 [50.0%] (true,exec)
vpdiff
=
vpdiff
+
step
;
// # SUCC: 9 [100.0%] (fallthru,exec)
adpcm_decoderbb_9:
// # PRED: 8 [73.0%] (false,exec)
if
(
index
>
88
)
goto
adpcm_decoderbb_24
;
else
// # PRED: 7 [50.0%] (false,exec) 8 [100.0%] (fallthru,exec)
if
(
delta_83
&
2
!=
0
)
goto
adpcm_decoderbb_10
;
// # SUCC: 24 [68.5%] (true,exec) 10 [31.5%] (false,exec)
adpcm_decoderbb_24:
// # PRED: 9 [68.5%] (true,exec)
index
=
88
;
goto
adpcm_decoderbb_11
;
// # SUCC: 11 [100.0%] (fallthru)
else
goto
adpcm_decoderbb_11
;
// # SUCC: 10 [50.0%] (true,exec) 11 [50.0%] (false,exec)
adpcm_decoderbb_10:
// # PRED: 9 [31.5%] (false,exec) 23 [100.0%] (fallthru)
// # PRED: 9 [50.0%] (true,exec)
vpdiff
=
vpdiff
+
(
step
>>
1
);
// # SUCC: 11 [100.0%] (fallthru,exec)
adpcm_decoderbb_11:
// # PRED: 10 [100.0%] (fallthru,exec) 24 [100.0%] (fallthru)
delta_112
=
delta
&
7
;
vpdiff
=
step
>>
3
;
if
(
delta_112
&
4
!=
0
)
// # PRED: 9 [50.0%] (false,exec) 10 [100.0%] (fallthru,exec)
if
(
delta_83
&
1
!=
0
)
goto
adpcm_decoderbb_12
;
else
goto
adpcm_decoderbb_13
;
...
...
@@ -407,12 +370,12 @@ adpcm_decoderbb_11:
adpcm_decoderbb_12:
// # PRED: 11 [50.0%] (true,exec)
vpdiff
=
vpdiff
+
step
;
vpdiff
=
vpdiff
+
(
step
>>
2
)
;
// # SUCC: 13 [100.0%] (fallthru,exec)
adpcm_decoderbb_13:
// # PRED: 11 [50.0%] (false,exec) 12 [100.0%] (fallthru,exec)
if
(
delta
_112
&
2
!=
0
)
if
(
delta
&
8
!=
0
)
goto
adpcm_decoderbb_14
;
else
goto
adpcm_decoderbb_15
;
...
...
@@ -420,65 +383,38 @@ adpcm_decoderbb_13:
adpcm_decoderbb_14:
// # PRED: 13 [50.0%] (true,exec)
vpdiff
=
vpdiff
+
(
step
>>
1
);
// # SUCC: 15 [100.0%] (fallthru,exec)
valpred
=
valpred_81
-
vpdiff
;
goto
adpcm_decoderbb_16
;
// # SUCC: 16 [100.0%] (fallthru,exec)
adpcm_decoderbb_15:
// # PRED: 13 [50.0%] (false,exec) 14 [100.0%] (fallthru,exec)
if
(
delta_112
&
1
!=
0
)
goto
adpcm_decoderbb_16
;
else
goto
adpcm_decoderbb_17
;
// # SUCC: 16 [50.0%] (true,exec) 17 [50.0%] (false,exec)
// # PRED: 13 [50.0%] (false,exec)
valpred
=
vpdiff
+
valpred_81
;
// # SUCC: 16 [100.0%] (fallthru,exec)
adpcm_decoderbb_16:
// # PRED: 15 [50.0%] (true,exec)
vpdiff
=
vpdiff
+
(
step
>>
2
);
// # SUCC: 17 [100.0%] (fallthru,exec)
adpcm_decoderbb_17:
// # PRED: 15 [50.0%] (false,exec) 16 [100.0%] (fallthru,exec)
if
(
delta
&
8
!=
0
)
goto
adpcm_decoderbb_18
;
else
goto
adpcm_decoderbb_19
;
// # SUCC: 18 [50.0%] (true,exec) 19 [50.0%] (false,exec)
adpcm_decoderbb_18:
// # PRED: 17 [50.0%] (true,exec)
valpred
=
valpred_111
-
vpdiff
;
goto
adpcm_decoderbb_20
;
// # SUCC: 20 [100.0%] (fallthru,exec)
adpcm_decoderbb_19:
// # PRED: 17 [50.0%] (false,exec)
valpred
=
vpdiff
+
valpred_111
;
// # SUCC: 20 [100.0%] (fallthru,exec)
adpcm_decoderbb_20:
// # PRED: 18 [100.0%] (fallthru,exec) 19 [100.0%] (fallthru,exec)
valpred_113
=
(
valpred
>-
32768
)
?
valpred
:-
32768
;
valpred_111
=
(
valpred_113
<
32767
)
?
valpred_113
:
32767
;
// # PRED: 14 [100.0%] (fallthru,exec) 15 [100.0%] (fallthru,exec)
valpred_85
=
(
valpred
>-
32768
)
?
valpred
:-
32768
;
valpred_81
=
(
valpred_85
<
32767
)
?
valpred_85
:
32767
;
step
=
stepsizeTable
[
index
];
prephitmp_86
=
(
short
int
)
valpred_111
;
*
(
short
int
*
)((
uintptr_t
)
outdata
+
(
uintptr_t
)
ivtmp_101
)
=
prephitmp_86
;
*
(
short
int
*
)((
uintptr_t
)
outdata
+
(
uintptr_t
)
ivtmp_71
)
=
(
short
int
)
(
short
int
)
valpred_81
;
len
=
len
+
-
1
;
ivtmp_
101
=
ivtmp_10
1
+
2
;
ivtmp_
71
=
ivtmp_7
1
+
2
;
if
(
len
!=
0
)
goto
adpcm_decoderbb_
21
;
goto
adpcm_decoderbb_
17
;
else
goto
adpcm_decoderbb_
22
;
// # SUCC:
21 [91.0%] (true,exec) 22
[9.0%] (false,exec)
adpcm_decoderbb_
21
:
// # PRED:
20
[91.0%] (true,exec)
bufferstep
=
bufferstep
^
1
;
goto
adpcm_decoderbb_
5
;
// # SUCC:
5
[100.0%] (fallthru,dfs_back,exec)
adpcm_decoderbb_
22
:
// # PRED:
20 [9.0%] (false,exec) 3 [100.0%] (fallthru
,exec)
state
->
valprev
=
prephitmp_86
;
goto
adpcm_decoderbb_
18
;
// # SUCC:
17 [91.0%] (true,exec) 18
[9.0%] (false,exec)
adpcm_decoderbb_
17
:
// # PRED:
16
[91.0%] (true,exec)
bufferstep
=
bufferstep
==
0
;
goto
adpcm_decoderbb_
4
;
// # SUCC:
4
[100.0%] (fallthru,dfs_back,exec)
adpcm_decoderbb_
18
:
// # PRED:
16 [9.0%] (false,exec) 2 [9.0%] (false
,exec)
state
->
valprev
=
(
short
int
)
(
short
int
)
valpred_81
;
state
->
index
=
(
char
)
(
char
)
index
;
return
;
// # SUCC: EXIT [100.0%]
...
...
examples/adpcm/ir_c/my_ctop_IR.c
View file @
ff4c6e4b
...
...
@@ -33,14 +33,14 @@ struct adpcm_state coder_1_state;
int
main
()
{
long
unsigned
int
end_
62
;
long
unsigned
int
end_61
;
long
unsigned
int
end_
60
;
int
i_59
;
long
unsigned
int
start_
56
;
uintptr_t
ivtmp_
50
;
int
D_22
45
;
uintptr_t
ivtmp_
44
;
long
unsigned
int
end_
46
;
int
i_45
;
long
unsigned
int
end_
44
;
long
unsigned
int
end_43
;
long
unsigned
int
start_
40
;
uintptr_t
ivtmp_
34
;
int
D_22
29
;
uintptr_t
ivtmp_
28
;
long
unsigned
int
count
;
long
unsigned
int
end
;
long
unsigned
int
start
;
...
...
@@ -53,21 +53,21 @@ mainbb_2:
ARR_SIZE_0
=
ARR_SIZE
;
j
=
ARR_SIZE_0
/
10240
;
if
(
j
!=
0
)
goto
mainbb_1
3
;
goto
mainbb_1
4
;
else
goto
mainbb_7
;
// # SUCC: 1
3
[91.0%] (true,exec) 7 [9.0%] (false,exec)
// # SUCC: 1
4
[91.0%] (true,exec) 7 [9.0%] (false,exec)
mainbb_1
3
:
mainbb_1
4
:
// # PRED: 2 [91.0%] (true,exec)
end_
61
=
0
;
end_
43
=
0
;
count
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
mainbb_3:
// # PRED: 13 [100.0%] (fallthru) 14 [100.0%] (fallthru)
end_
62
=
end_61
+
10240
;
if
(
end_
61
<
end_62
)
end_
46
=
end_43
+
10240
;
if
(
end_
43
<
end_46
)
goto
mainbb_4
;
else
goto
mainbb_6
;
...
...
@@ -75,36 +75,36 @@ mainbb_3:
mainbb_4:
// # PRED: 3 [99.0%] (true,exec)
i_
59
=
(
int
)
end_61
;
ivtmp_
50
=
(
uintptr_t
)
&
in_Data
[
i_59
];
end_
60
=
end_61
;
i_
45
=
(
int
)
end_43
;
ivtmp_
34
=
(
uintptr_t
)
&
in_Data
[
i_45
];
end_
44
=
end_43
;
// # SUCC: 5 [100.0%] (fallthru,exec)
mainbb_5:
// # PRED: 5 [99.0%] (
dfs_back,
true,exec) 4 [100.0%] (fallthru,exec)
pcmdata
[
end_
60
-
end_61
]
=
*
(
short
int
*
)((
uintptr_t
)
ivtmp_50
);
i_
59
=
i_59
+
1
;
end_
60
=
(
long
unsigned
int
)
i_59
;
ivtmp_
50
=
ivtmp_50
+
2
;
if
(
end_
60
<
end_62
)
// # PRED: 5 [99.0%] (true,exec) 4 [100.0%] (fallthru,exec)
pcmdata
[
end_
44
-
end_43
]
=
*
(
short
int
*
)((
uintptr_t
)
ivtmp_34
);
i_
45
=
i_45
+
1
;
end_
44
=
(
long
unsigned
int
)
i_45
;
ivtmp_
34
=
ivtmp_34
+
2
;
if
(
end_
44
<
end_46
)
goto
mainbb_5
;
else
goto
mainbb_6
;
// # SUCC: 5 [99.0%] (
dfs_back,
true,exec) 6 [1.0%] (false,exec)
// # SUCC: 5 [99.0%] (true,exec) 6 [1.0%] (false,exec)
mainbb_6:
// # PRED: 5 [1.0%] (false,exec) 3 [1.0%] (false,exec)
adpcm_coder
(
&
pcmdata
,
&
adpcmdata
,
10240
,
&
coder_1_state
);
count
=
count
+
1
;
if
(
j
>
count
)
goto
mainbb_1
4
;
goto
mainbb_1
3
;
else
goto
mainbb_7
;
// # SUCC: 1
4 [91.0%] (dfs_back,
true,exec) 7 [9.0%] (false,exec)
// # SUCC: 1
3 [91.0%] (
true,exec) 7 [9.0%] (false,exec)
mainbb_1
4
:
// # PRED: 6 [91.0%] (
dfs_back,
true,exec)
end_
61
=
end_62
;
mainbb_1
3
:
// # PRED: 6 [91.0%] (true,exec)
end_
43
=
end_46
;
goto
mainbb_3
;
// # SUCC: 3 [100.0%] (fallthru)
...
...
@@ -118,9 +118,9 @@ mainbb_7:
mainbb_8:
// # PRED: 7 [61.0%] (true,exec)
start
=
j
*
10240
;
start
_40
=
j
*
10240
;
end
=
ARR_SIZE
;
if
(
start
<
end
)
if
(
start
_40
<
end
)
goto
mainbb_9
;
else
goto
mainbb_11
;
...
...
@@ -128,27 +128,27 @@ mainbb_8:
mainbb_9:
// # PRED: 8 [99.0%] (true,exec)
i
=
(
int
)
start
;
ivtmp_
44
=
(
uintptr_t
)
&
in_Data
[
i
];
D_22
45
=
(
int
)
end
;
start
_56
=
start
;
i
=
(
int
)
start
_40
;
ivtmp_
28
=
(
uintptr_t
)
&
in_Data
[
i
];
D_22
29
=
(
int
)
end
;
start
=
start_40
;
// # SUCC: 10 [100.0%] (fallthru,exec)
mainbb_10:
// # PRED: 10 [99.0%] (
dfs_back,
true,exec) 9 [100.0%] (fallthru,exec)
pcmdata
[
start
_56
-
start
]
=
*
(
short
int
*
)((
uintptr_t
)
ivtmp_44
);
// # PRED: 10 [99.0%] (true,exec) 9 [100.0%] (fallthru,exec)
pcmdata
[
start
-
start_40
]
=
*
(
short
int
*
)((
uintptr_t
)
ivtmp_28
);
i
=
i
+
1
;
start
_56
=
(
long
unsigned
int
)
i
;
ivtmp_
44
=
ivtmp_44
+
2
;
if
(
i
!=
D_22
45
)
start
=
(
long
unsigned
int
)
i
;
ivtmp_
28
=
ivtmp_28
+
2
;
if
(
i
!=
D_22
29
)
goto
mainbb_10
;
else
goto
mainbb_11
;
// # SUCC: 10 [99.0%] (
dfs_back,
true,exec) 11 [1.0%] (false,exec)
// # SUCC: 10 [99.0%] (true,exec) 11 [1.0%] (false,exec)
mainbb_11:
// # PRED: 10 [1.0%] (false,exec) 8 [1.0%] (false,exec)
adpcm_coder
(
&
pcmdata
,
&
adpcmdata
,
(
int
)
(
end
-
start
),
&
coder_1_state
);
adpcm_coder
(
&
pcmdata
,
&
adpcmdata
,
(
int
)
(
end
-
start
_40
),
&
coder_1_state
);
// # SUCC: 12 [100.0%] (fallthru,exec)
mainbb_12:
...
...
examples/basicmath/app_dir/Makefile
View file @
ff4c6e4b
...
...
@@ -10,7 +10,7 @@ TRUNCAPP1 = basicmath_small_truncated3
MATH
=
my_math
#when libsource, COPTS is as per lib source compilation. Uncomment paths, VPATH in that case
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
ifdef
PHASE
...
...
examples/basicmath/ir_c/Makefile
View file @
ff4c6e4b
...
...
@@ -10,7 +10,7 @@ TRUNCAPP1 = basicmath_small_truncated3_IR
MATH
=
my_math
#when libsource, COPTS is as per lib source compilation. Uncomment paths, VPATH in that case
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
ifdef
PHASE
...
...
@@ -48,7 +48,7 @@ OFILE2 = ${APP2}.${OEXT}
DEBUGFILE1
=
${
DEBUGAPP
}
.c rad2deg.c cubic_debug.c isqrt.c
DEBUGOFILE1
=
${
DEBUGAPP
}
.
${
OEXT
}
OBJDIR
=
.
/objdir
OBJDIR
=
.
#### mathlib source paths and names
#MY_MPATH1=/home/local/grimlock/suhas/libm_some_sources/math
...
...
@@ -63,7 +63,7 @@ MATHFILES1 = w_acos.c s_cos.c w_pow.c w_sqrt.c
MATHFILES2
=
e_acos.c e_pow.c e_sqrt.c k_cos.c k_sin.c e_rem_pio2.c k_rem_pio2.c
MATHFILES3
=
s_scalbn.c s_floor.c s_copysign.c s_fabs.c s_nan.c
all
:
basicmath_small_my_math_trunc
all
:
basicmath_small_my_math_trunc
objdump_small_my_math_trunc
test
:
./
$(TRUNCOFILE1MYMATH)
...
...
examples/basicmath/ir_c/basicmath_small_truncated3_IR.c
View file @
ff4c6e4b
...
...
@@ -23,17 +23,23 @@ double Xangle[2];
int
main
(
void
)
{
double
X_6
8
;
uintptr_t
ivtmp_
64
;
uintptr_t
ivtmp_5
5
;
double
X_6
2
;
uintptr_t
ivtmp_
58
;
uintptr_t
ivtmp_5
4
;
uintptr_t
ivtmp_50
;
double
Xangle_I_lsm_42
;
double
Xangle_I_lsm_41
;
uintptr_t
ivtmp_46
;
uintptr_t
ivtmp_37
;
uintptr_t
ivtmp_32
;
double
Xangle_I_lsm_24
;
double
Xangle_I_lsm_23
;
struct
int_sqrt
q
;
int
i
;
int
solutions
;
double
X
;
double
x
[
3
];
double
d1
;
double
c1
;
double
b1
;
double
a1
;
mainbb_2:
...
...
@@ -42,107 +48,129 @@ mainbb_2:
SolveCubic
(
1.0e+0
,
-
4.5e+0
,
1.7e+1
,
-
3.0e+1
,
&
solutions
,
&
x
);
SolveCubic
(
1.0e+0
,
-
3.5e+0
,
2.2e+1
,
-
3.1e+1
,
&
solutions
,
&
x
);
SolveCubic
(
1.0e+0
,
-
1.36999999999999992894572642398998141288757324219e+1
,
1.0e+0
,
-
3.5e+1
,
&
solutions
,
&
x
);
ivtmp_
64
=
0
;
ivtmp_
58
=
0
;
a1
=
3.0e+0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
goto
mainbb_9
;
// # SUCC: 9 [100.0%] (fallthru,exec)
mainbb_3:
// # PRED: 3 [75.0%] (dfs_back,true,exec) 2 [100.0%] (fallthru,exec)
SolveCubic
(
a1
,
1.0e+1
,
5.0e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.0e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.0e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.0e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.5e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.5e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.5e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
5.5e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.0e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.0e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.0e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.0e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.5e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.5e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.5e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
1.0e+1
,
6.5e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.0e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.0e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.0e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.0e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.5e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.5e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.5e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
5.5e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.0e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.0e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.0e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.0e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.5e+0
,
-
1.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.5e+0
,
-
2.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.5e+0
,
-
3.0e+0
,
&
solutions
,
&
x
);
SolveCubic
(
a1
,
9.0e+0
,
6.5e+0
,
-
4.0e+0
,
&
solutions
,
&
x
);
a1
=
a1
+
1.0e+0
;
ivtmp_64
=
ivtmp_64
+
1
;
if
(
ivtmp_64
!=
3
)
// # PRED: 3 [91.0%] (true,exec) 5 [100.0%] (fallthru,exec)
SolveCubic
(
a1
,
b1
,
c1
,
d1
,
&
solutions
,
&
x
);
d1
=
d1
-
1.0e+0
;
ivtmp_46
=
ivtmp_46
+
1
;
if
(
ivtmp_46
!=
4
)
goto
mainbb_3
;
else
goto
mainbb_
10
;
// # SUCC: 3 [
75.0%] (dfs_back,true,exec) 10 [25
.0%] (false,exec)
goto
mainbb_
4
;
// # SUCC: 3 [
91.0%] (true,exec) 4 [9
.0%] (false,exec)
mainbb_10:
// # PRED: 3 [25.0%] (false,exec)
mainbb_4:
// # PRED: 3 [9.0%] (false,exec)
c1
=
c1
+
5.0e-1
;
ivtmp_50
=
ivtmp_50
+
1
;
if
(
ivtmp_50
!=
4
)
goto
mainbb_5
;
else
goto
mainbb_6
;
// # SUCC: 5 [91.0%] (true,exec) 6 [9.0%] (false,exec)
mainbb_5:
// # PRED: 4 [91.0%] (true,exec) 7 [100.0%] (fallthru,exec)
ivtmp_46
=
0
;
d1
=
-
1.0e+0
;
goto
mainbb_3
;
// # SUCC: 3 [100.0%] (fallthru,exec)
mainbb_6:
// # PRED: 4 [9.0%] (false,exec)
b1
=
b1
-
1.0e+0
;
ivtmp_54
=
ivtmp_54
+
1
;
if
(
ivtmp_54
!=
2
)
goto
mainbb_7
;
else
goto
mainbb_8
;
// # SUCC: 7 [91.0%] (true,exec) 8 [9.0%] (false,exec)
mainbb_7:
// # PRED: 6 [91.0%] (true,exec) 9 [100.0%] (fallthru,exec)
ivtmp_50
=
0
;
c1
=
5.0e+0
;
goto
mainbb_5
;
// # SUCC: 5 [100.0%] (fallthru,exec)
mainbb_8:
// # PRED: 6 [9.0%] (false,exec)
a1
=
a1
+
1.0e+0
;
ivtmp_58
=
ivtmp_58
+
1
;
if
(
ivtmp_58
!=
3
)
goto
mainbb_9
;
else
goto
mainbb_16
;
// # SUCC: 9 [75.0%] (true,exec) 16 [25.0%] (false,exec)
mainbb_9:
// # PRED: 8 [75.0%] (true,exec) 2 [100.0%] (fallthru,exec)
ivtmp_54
=
0
;
b1
=
1.0e+1
;
goto
mainbb_7
;
// # SUCC: 7 [100.0%] (fallthru,exec)
mainbb_16:
// # PRED: 8 [25.0%] (false,exec)
i
=
0
;
// # SUCC:
4
[100.0%] (fallthru)
// # SUCC:
10
[100.0%] (fallthru)
mainbb_
4
:
// # PRED:
4 [98.0%] (dfs_back,true,exec) 10
[100.0%] (fallthru)
mainbb_
10
:
// # PRED:
10 [98.1%] (true,exec) 16
[100.0%] (fallthru)
usqrt
((
long
unsigned
int
)
i
,
&
q
);
i
=
i
+
1
;
if
(
i
!=
51
)
goto
mainbb_
4
;
goto
mainbb_
10
;
else
goto
mainbb_
5
;
// # SUCC:
4 [98.0%] (dfs_back,true,exec) 5 [2.0
%] (false,exec)
goto
mainbb_
11
;
// # SUCC:
10 [98.1%] (true,exec) 11 [1.9
%] (false,exec)
mainbb_5:
// # PRED: 4 [2.0%] (false,exec)
mainbb_11:
// # PRED: 10 [1.9%] (false,exec)
//Invalid sum of outgoing probabilities 0.0%
usqrt
(
1072497001
,
&
q
);
ivtmp_
55
=
0
;
ivtmp_
37
=
0
;
X
=
0
.
0
;
// # SUCC:
6 [100.0%]
(fallthru,exec)
// # SUCC:
12
(fallthru,exec)
mainbb_
6
:
// # PRED:
6 [99.0%] (dfs_back,true,exec) 5 [100.0%]
(fallthru,exec)
Xangle_I_lsm_
42
=
(
X
*
3.14159265358979311599796346854418516159057617188e+0
)
/
1.8e+2
;
mainbb_
12
:
// # PRED:
12 [99.0%] (true,exec) 11
(fallthru,exec)
Xangle_I_lsm_
24
=
(
X
*
3.14159265358979311599796346854418516159057617188e+0
)
/
1.8e+2
;
X
=
X
+
1.0e+0
;
ivtmp_
55
=
ivtmp_55
+
1
;
if
(
ivtmp_
55
!=
361
)
goto
mainbb_
6
;
ivtmp_
37
=
ivtmp_37
+
1
;
if
(
ivtmp_
37
!=
361
)
goto
mainbb_
12
;
else
goto
mainbb_
7
;
// # SUCC:
6 [99.0%] (dfs_back,true,exec) 7
[1.0%] (false,exec)
goto
mainbb_
13
;
// # SUCC:
12 [99.0%] (true,exec) 13
[1.0%] (false,exec)
mainbb_
7
:
// # PRED:
6
[1.0%] (false,exec)
mainbb_
13
:
// # PRED:
12
[1.0%] (false,exec)
//Invalid sum of outgoing probabilities 0.0%
Xangle
[
0
]
=
Xangle_I_lsm_
42
;
ivtmp_
50
=
0
;
X_6
8
=
0
.
0
;
// # SUCC:
8
(fallthru,exec)
mainbb_
8
:
// # PRED:
8 [91.0%] (dfs_back,true,exec) 7
(fallthru,exec)
Xangle_I_lsm_
41
=
(
X_68
*
1.8e+2
)
/
3.14159265358979311599796346854418516159057617188e+0
;
X_6
8
=
X_68
+
1.74532925199432954743716805978692718781530857086e-2
;
ivtmp_
50
=
ivtmp_50
+
1
;
if
(
ivtmp_
50
!=
361
)
goto
mainbb_
8
;
Xangle
[
0
]
=
Xangle_I_lsm_
24
;
ivtmp_
32
=
0
;
X_6
2
=
0
.
0
;
// # SUCC:
14
(fallthru,exec)
mainbb_
14
:
// # PRED:
14 [91.0%] (true,exec) 13
(fallthru,exec)
Xangle_I_lsm_
23
=
(
X_62
*
1.8e+2
)
/
3.14159265358979311599796346854418516159057617188e+0
;
X_6
2
=
X_62
+
1.74532925199432954743716805978692718781530857086e-2
;
ivtmp_
32
=
ivtmp_32
+
1
;
if
(
ivtmp_
32
!=
361
)
goto
mainbb_
14
;
else
goto
mainbb_
9
;
// # SUCC:
8 [91.0%] (dfs_back,true,exec) 9
[9.0%] (false,exec)
goto
mainbb_
15
;
// # SUCC:
14 [91.0%] (true,exec) 15
[9.0%] (false,exec)
mainbb_
9
:
// # PRED:
8
[9.0%] (false,exec)
Xangle
[
1
]
=
Xangle_I_lsm_
41
;
mainbb_
15
:
// # PRED:
14
[9.0%] (false,exec)
Xangle
[
1
]
=
Xangle_I_lsm_
23
;
return
0
;
// # SUCC: EXIT [100.0%]
...
...
examples/basicmath/ir_c/isqrt_IR.c
View file @
ff4c6e4b
...
...
@@ -69,7 +69,7 @@ usqrtbb_2:
// # SUCC: 3 [100.0%] (fallthru,exec)
usqrtbb_3:
// # PRED: 5 [9
6.9%] (dfs_back,
true,exec) 2 [100.0%] (fallthru,exec)
// # PRED: 5 [9
7.0%] (
true,exec) 2 [100.0%] (fallthru,exec)
D_2427
=
r
<<
2
;
r
=
(
x
>>
30
)
+
D_2427
;
x
=
x
<<
2
;
...
...
@@ -94,10 +94,10 @@ usqrtbb_5:
goto
usqrtbb_3
;
else
goto
usqrtbb_6
;
// # SUCC: 3 [9
6.9%] (dfs_back,true,exec) 6 [3.1
%] (false,exec)
// # SUCC: 3 [9
7.0%] (true,exec) 6 [3.0
%] (false,exec)
usqrtbb_6:
// # PRED: 5 [3.
1
%] (false,exec)
// # PRED: 5 [3.
0
%] (false,exec)
*
(
long
unsigned
int
*
)
q
=
a
;
return
;
// # SUCC: EXIT [100.0%]
...
...
examples/basicmath/ir_c/my_math_IR.c
View file @
ff4c6e4b
...
...
@@ -371,20 +371,20 @@ struct Pair1 pow_LkUpTbl[POWCNT] = {
long
double
sqrt
(
long
double
in
)
{
uintptr_t
ivtmp_
43
;
uintptr_t
ivtmp_
32
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2171
;
sqrtbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_
43
=
(
uintptr_t
)
&
sQrt_LkUpTbl
[
0
].
input
;
ivtmp_
32
=
(
uintptr_t
)
&
sQrt_LkUpTbl
[
0
].
input
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
sqrtbb_3:
// # PRED: 6 [99.0%] (
dfs_back,
true,exec) 2 [100.0%] (fallthru,exec)
D_2171
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_
43
);
// # PRED: 6 [99.0%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2171
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_
32
);
if
(
D_2171
+
2.00000000000000004163336342344337026588618755341e-3
>=
in
!=
0
)
goto
sqrtbb_4
;
else
...
...
@@ -408,12 +408,12 @@ sqrtbb_5:
sqrtbb_6:
// # PRED: 3 [50.0%] (false,exec) 4 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_
43
=
ivtmp_43
+
16
;
ivtmp_
32
=
ivtmp_32
+
16
;
if
(
i
!=
163
)
goto
sqrtbb_3
;
else
goto
sqrtbb_8
;
// # SUCC: 3 [99.0%] (
dfs_back,
true,exec) 8 [1.0%] (false,exec)
// # SUCC: 3 [99.0%] (true,exec) 8 [1.0%] (false,exec)
sqrtbb_8:
// # PRED: 6 [1.0%] (false,exec)
...
...
@@ -430,20 +430,20 @@ sqrtbb_7:
long
double
acos
(
long
double
in
)
{
uintptr_t
ivtmp_
86
;
uintptr_t
ivtmp_
64
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2190
;
acosbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_
86
=
(
uintptr_t
)
&
aCos_LkUpTbl
[
0
].
input
;
ivtmp_
64
=
(
uintptr_t
)
&
aCos_LkUpTbl
[
0
].
input
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
acosbb_3:
// # PRED: 6 [95.
1%] (dfs_back,
true,exec) 2 [100.0%] (fallthru,exec)
D_2190
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_
86
);
// # PRED: 6 [95.
5%] (
true,exec) 2 [100.0%] (fallthru,exec)
D_2190
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_
64
);
if
(
D_2190
+
2.00000000000000004163336342344337026588618755341e-3
>=
in
!=
0
)
goto
acosbb_4
;
else
...
...
@@ -467,15 +467,15 @@ acosbb_5:
acosbb_6:
// # PRED: 3 [50.0%] (false,exec) 4 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_
86
=
ivtmp_86
+
16
;
ivtmp_
64
=
ivtmp_64
+
16
;
if
(
i
!=
21
)
goto
acosbb_3
;
else
goto
acosbb_8
;
// # SUCC: 3 [95.
1%] (dfs_back,true,exec) 8 [4.9
%] (false,exec)
// # SUCC: 3 [95.
5%] (true,exec) 8 [4.5
%] (false,exec)
acosbb_8:
// # PRED: 6 [4.
9
%] (false,exec)
// # PRED: 6 [4.
5
%] (false,exec)
rValue
=
0
.
0
;
// # SUCC: 7 [100.0%] (fallthru)
...
...
@@ -489,20 +489,20 @@ acosbb_7:
long
double
cos
(
long
double
in
)
{
uintptr_t
ivtmp_
128
;
uintptr_t
ivtmp_
95
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2209
;
cosbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_
128
=
(
uintptr_t
)
&
cos_LkUpTbl
[
0
].
input
;
ivtmp_
95
=
(
uintptr_t
)
&
cos_LkUpTbl
[
0
].
input
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
cosbb_3:
// # PRED: 6 [98.4%] (
dfs_back,
true,exec) 2 [100.0%] (fallthru,exec)
D_2209
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_
128
);
// # PRED: 6 [98.4%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2209
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_
95
);
if
(
D_2209
+
2.00000000000000004163336342344337026588618755341e-3
>=
in
!=
0
)
goto
cosbb_4
;
else
...
...
@@ -526,12 +526,12 @@ cosbb_5:
cosbb_6:
// # PRED: 3 [50.0%] (false,exec) 4 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_
128
=
ivtmp_128
+
16
;
ivtmp_
95
=
ivtmp_95
+
16
;
if
(
i
!=
63
)
goto
cosbb_3
;
else
goto
cosbb_8
;
// # SUCC: 3 [98.4%] (
dfs_back,
true,exec) 8 [1.6%] (false,exec)
// # SUCC: 3 [98.4%] (true,exec) 8 [1.6%] (false,exec)
cosbb_8:
// # PRED: 6 [1.6%] (false,exec)
...
...
@@ -548,7 +548,7 @@ cosbb_7:
long
double
pow
(
long
double
in1
,
long
double
in2
)
{
uintptr_t
ivtmp_1
70
;
uintptr_t
ivtmp_1
26
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2238
;
...
...
@@ -556,13 +556,13 @@ long double pow(long double in1, long double in2) {
powbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_1
70
=
(
uintptr_t
)
&
pow_LkUpTbl
[
0
].
input1
;
ivtmp_1
26
=
(
uintptr_t
)
&
pow_LkUpTbl
[
0
].
input1
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
powbb_3:
// # PRED: 8 [98.
7%] (dfs_back,
true,exec) 2 [100.0%] (fallthru,exec)
D_2229
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_1
70
);
// # PRED: 8 [98.
8%] (
true,exec) 2 [100.0%] (fallthru,exec)
D_2229
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_1
26
);
if
(
D_2229
+
2.00000000000000004163336342344337026588618755341e-3
>=
in1
!=
0
)
goto
powbb_4
;
else
...
...
@@ -579,7 +579,7 @@ powbb_4:
powbb_5:
// # PRED: 4 [50.0%] (true,exec)
D_2238
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_1
70
+
8
);
D_2238
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_1
26
+
8
);
if
(
D_2238
+
2.00000000000000004163336342344337026588618755341e-3
>=
in2
!=
0
)
goto
powbb_6
;
else
...
...
@@ -603,15 +603,15 @@ powbb_7:
powbb_8:
// # PRED: 3 [50.0%] (false,exec) 4 [50.0%] (false,exec) 5 [50.0%] (false,exec) 6 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_1
70
=
ivtmp_170
+
24
;
ivtmp_1
26
=
ivtmp_126
+
24
;
if
(
i
!=
79
)
goto
powbb_3
;
else
goto
powbb_10
;
// # SUCC: 3 [98.
7%] (dfs_back,true,exec) 10 [1.3
%] (false,exec)
// # SUCC: 3 [98.
8%] (true,exec) 10 [1.2
%] (false,exec)
powbb_10:
// # PRED: 8 [1.
3
%] (false,exec)
// # PRED: 8 [1.
2
%] (false,exec)
rValue
=
0
.
0
;
// # SUCC: 9 [100.0%] (fallthru)
...
...
examples/crc32/app_dir/Makefile
View file @
ff4c6e4b
...
...
@@ -5,7 +5,7 @@ APP1 = crc_top
#PHASE = final #when not defined, CC = gcc. otherwise cc = ppc-gcc
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
IRDUMP
=
1
#1 - dump IR files, 0 - don't.
#PRINT = 1 #if defined and PHASE defined, include soft-float lib. fprintf uses floating point
...
...
examples/crc32/ir_c/Makefile
View file @
ff4c6e4b
...
...
@@ -5,7 +5,7 @@ APP1 = crc_top_IR
#PHASE = final #when not defined, CC = gcc. otherwise cc = ppc-gcc
TREEDUMP
=
#-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
IRDUMP
=
1
#1 - dump IR files, 0 - don't.
...
...
examples/crc32/ir_c/crc_32_IR.c
View file @
ff4c6e4b
...
...
@@ -143,63 +143,59 @@ updateCRC32bb_2:
Boolean_T
crc32file
(
char
*
name
,
DWORD
*
crc
,
long
int
*
charcnt
)
{
long
int
D_212
2
;
DWORD
prephitmp_67
;
long
unsigned
int
temp_5
2
;
long
unsigned
int
temp_50
;
register
DWORD
oldcrc32
;
unsigned
int
ARR_SIZE_0
;
long
unsigned
int
D_2020
;
DWORD
D_2019
;
UNS_32_BITS
D_2018
;
char
D_2012
;
long
int
D_2009
;
crc32filebb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
*
charcnt
=
0
;
ARR_SIZE_0
=
ARR_SIZE
;
if
(
ARR_SIZE_0
!=
0
)
goto
crc32filebb_3
;
if
(
ARR_SIZE
!=
0
)
goto
crc32filebb_6
;
else
goto
crc32filebb_7
;
// # SUCC: 3 [91.0%] (true,exec) 7 [9.0%] (false,exec)
crc32filebb_7:
// # PRED: 2 [9.0%] (false,exec)
prephitmp_67
=
0
;
goto
crc32filebb_6
;
// # SUCC: 6 [100.0%] (fallthru)
// # SUCC: 6 [91.0%] (true,exec) 7 [9.0%] (false,exec)
crc32filebb_
3
:
crc32filebb_
6
:
// # PRED: 2 [91.0%] (true,exec)
D_2122
=
(
long
int
)
ARR_SIZE_0
;
D_2020
=
0
;
D_2009
=
0
;
temp_50
=
1
;
temp_52
=
0
;
oldcrc32
=
4294967295
;
// # SUCC:
4 [100.0%] (fallthru,exec
)
// # SUCC:
3 [100.0%] (fallthru
)
crc32filebb_4:
// # PRED: 4 [91.0%] (dfs_back,true,exec) 3 [100.0%] (fallthru,exec)
D_2012
=
*
(
char
*
)((
uintptr_t
)
name
+
D_2020
);
D_2009
=
D_2009
+
1
;
*
charcnt
=
D_2009
;
crc32filebb_3:
// # PRED: 5 [100.0%] (fallthru) 6 [100.0%] (fallthru)
D_2012
=
*
(
char
*
)((
uintptr_t
)
name
+
temp_52
);
*
charcnt
=
(
long
int
)
(
long
int
)
temp_50
;
D_2018
=
crc_32_tab
[((
long
unsigned
int
)
D_2012
^
oldcrc32
)
&
255
];
D_2019
=
oldcrc32
>>
8
;
oldcrc32
=
D_2018
^
D_2019
;
D_2020
=
(
long
unsigned
int
)
D_2009
;
if
(
D_2009
!=
D_2122
)
goto
crc32filebb_4
;
else
D_2020
=
temp_50
+
1
;
if
(
ARR_SIZE
>
temp_50
)
goto
crc32filebb_5
;
// # SUCC: 4 [91.0%] (dfs_back,true,exec) 5 [9.0%] (false,exec)
else
goto
crc32filebb_4
;
// # SUCC: 5 [91.0%] (true,exec) 4 [9.0%] (false,exec)
crc32filebb_5:
// # PRED: 4 [9.0%] (false,exec)
prephitmp_67
=
~
oldcrc32
;
// # SUCC: 6 [100.0%] (fallthru,exec)
// # PRED: 3 [91.0%] (true,exec)
temp_52
=
temp_50
;
temp_50
=
D_2020
;
goto
crc32filebb_3
;
// # SUCC: 3 [100.0%] (fallthru)
crc32filebb_6:
// # PRED: 5 [100.0%] (fallthru,exec) 7 [100.0%] (fallthru)
*
crc
=
prephitmp_67
;
crc32filebb_7:
// # PRED: 2 [9.0%] (false,exec)
oldcrc32
=
4294967295
;
// # SUCC: 4 [100.0%] (fallthru)
crc32filebb_4:
// # PRED: 3 [9.0%] (false,exec) 7 [100.0%] (fallthru)
*
crc
=
oldcrc32
=
~
oldcrc32
;
return
0
;
// # SUCC: EXIT [100.0%]
...
...
@@ -208,8 +204,7 @@ crc32filebb_6:
DWORD
crc32buf
(
char
*
buf
,
size_t
len
)
{
uintptr_t
ivtmp_120
;
DWORD
prephitmp_109
;
uintptr_t
ivtmp_76
;
register
DWORD
oldcrc32
;
DWORD
D_2036
;
UNS_32_BITS
D_2035
;
...
...
@@ -217,43 +212,38 @@ DWORD crc32buf(char *buf, size_t len) {
crc32bufbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
if
(
len
!=
0
)
goto
crc32bufbb_
6
;
goto
crc32bufbb_
5
;
else
goto
crc32bufbb_
7
;
// # SUCC:
6 [91.0%] (true,exec) 7
[9.0%] (false,exec)
goto
crc32bufbb_
6
;
// # SUCC:
5 [91.0%] (true,exec) 6
[9.0%] (false,exec)
crc32bufbb_
7
:
crc32bufbb_
6
:
// # PRED: 2 [9.0%] (false,exec)
prephitmp_109
=
0
;
goto
crc32bufbb_
5
;
// # SUCC:
5
[100.0%] (fallthru)
oldcrc32
=
4294967295
;
goto
crc32bufbb_
4
;
// # SUCC:
4
[100.0%] (fallthru)
crc32bufbb_
6
:
crc32bufbb_
5
:
// # PRED: 2 [91.0%] (true,exec)
ivtmp_
120
=
0
;
ivtmp_
76
=
0
;
oldcrc32
=
4294967295
;
// # SUCC: 3 [100.0%] (fallthru)
crc32bufbb_3:
// # PRED:
6 [100.0%] (fallthru) 3 [91.0%] (dfs_back,true,exec
)
D_2035
=
crc_32_tab
[(
oldcrc32
^
(
long
unsigned
int
)
*
(
char
*
)((
uintptr_t
)
buf
+
(
uintptr_t
)
ivtmp_
120
))
&
255
];
// # PRED:
3 [91.0%] (true,exec) 5 [100.0%] (fallthru
)
D_2035
=
crc_32_tab
[(
oldcrc32
^
(
long
unsigned
int
)
*
(
char
*
)((
uintptr_t
)
buf
+
(
uintptr_t
)
ivtmp_
76
))
&
255
];
D_2036
=
oldcrc32
>>
8
;
oldcrc32
=
D_2035
^
D_2036
;
ivtmp_
120
=
ivtmp_120
+
1
;
if
(
len
!=
ivtmp_120
)
ivtmp_
76
=
ivtmp_76
+
1
;
if
(
ivtmp_76
!=
len
)
goto
crc32bufbb_3
;
else
goto
crc32bufbb_4
;
// # SUCC: 3 [91.0%] (
dfs_back,
true,exec) 4 [9.0%] (false,exec)
// # SUCC: 3 [91.0%] (true,exec) 4 [9.0%] (false,exec)
crc32bufbb_4:
// # PRED: 3 [9.0%] (false,exec)
prephitmp_109
=
~
oldcrc32
;
// # SUCC: 5 [100.0%] (fallthru,exec)
crc32bufbb_5:
// # PRED: 4 [100.0%] (fallthru,exec) 7 [100.0%] (fallthru)
return
prephitmp_109
;
// # PRED: 3 [9.0%] (false,exec) 6 [100.0%] (fallthru)
return
~
oldcrc32
;
// # SUCC: EXIT [100.0%]
}
...
...
examples/sha/app_dir/Makefile
View file @
ff4c6e4b
...
...
@@ -21,7 +21,7 @@ APP2 = sha_driver_create_input_array
#PHASE = final #when not defined, CC = gcc. otherwise cc = ppc-gcc
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
DEBUG
=
-g
IRDUMP
=
1
#1 - dump IR files, 0 - don't.
#PRINT = 1 #if defined and PHASE defined, include soft-float lib. fprintf uses floating point
...
...
examples/sha/ir_c/Makefile
View file @
ff4c6e4b
...
...
@@ -20,8 +20,8 @@ APP2 = sha_driver_create_input_array_IR
#PHASE = final #when not defined, CC = gcc. otherwise cc = ppc-gcc
TREEDUMP
=
-fdump-tree-all-blocks-details
OPT
=
-O
2
#is O3 in original MiBench download. Use O3 for final testing
#
TREEDUMP = -fdump-tree-all-blocks-details
OPT
=
-O
1
#is O3 in original MiBench download. Use O3 for final testing
OPT
+=
-fno-optimize-sibling-calls
#don't optimise for tail calls, only turn on for ppc
DEBUG
=
-g
#IRDUMP = 1 #1 - dump IR files, 0 - don't.
...
...
examples/sha/ir_c/my_mem_IR.c
View file @
ff4c6e4b
...
...
@@ -22,7 +22,7 @@ Last modified - 17 Nov 2012
void
*
my_memcpy
(
void
*
dest
,
const
void
*
src
,
size_t
count
)
{
uintptr_t
ivtmp_
3
3
;
uintptr_t
ivtmp_
2
3
;
my_memcpybb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
...
...
@@ -34,18 +34,18 @@ my_memcpybb_2:
my_memcpybb_5:
// # PRED: 2 [91.0%] (true,exec)
ivtmp_
3
3
=
0
;
ivtmp_
2
3
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
my_memcpybb_3:
// # PRED: 3 [91.0%] (
dfs_back,
true,exec) 5 [100.0%] (fallthru)
*
(
char
*
)((
uintptr_t
)
dest
+
(
uintptr_t
)
ivtmp_
33
)
=
*
(
char
*
)((
uintptr_t
)
src
+
(
uintptr_t
)
ivtmp_3
3
);
ivtmp_
33
=
ivtmp_3
3
+
1
;
if
(
ivtmp_
3
3
!=
count
)
// # PRED: 3 [91.0%] (true,exec) 5 [100.0%] (fallthru)
*
(
char
*
)((
uintptr_t
)
dest
+
(
uintptr_t
)
ivtmp_
23
)
=
*
(
char
*
)((
uintptr_t
)
src
+
(
uintptr_t
)
ivtmp_2
3
);
ivtmp_
23
=
ivtmp_2
3
+
1
;
if
(
ivtmp_
2
3
!=
count
)
goto
my_memcpybb_3
;
else
goto
my_memcpybb_4
;
// # SUCC: 3 [91.0%] (
dfs_back,
true,exec) 4 [9.0%] (false,exec)
// # SUCC: 3 [91.0%] (true,exec) 4 [9.0%] (false,exec)
my_memcpybb_4:
// # PRED: 3 [9.0%] (false,exec) 2 [9.0%] (false,exec)
...
...
@@ -57,35 +57,33 @@ my_memcpybb_4:
void
*
my_memset
(
void
*
s
,
int
c
,
size_t
n
)
{
uintptr_t
ivtmp_77
;
char
pretmp_66
;
uintptr_t
ivtmp_56
;
my_memsetbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
if
(
n
!=
0
)
goto
my_memsetbb_3
;
else
goto
my_memsetbb_5
;
// # SUCC: 3 [91.0%] (true,exec) 5 [9.0%] (false,exec)
else
goto
my_memsetbb_4
;
// # SUCC: 5 [91.0%] (true,exec) 4 [9.0%] (false,exec)
my_memsetbb_
3
:
my_memsetbb_
5
:
// # PRED: 2 [91.0%] (true,exec)
pretmp_66
=
(
char
)
c
;
ivtmp_77
=
0
;
// # SUCC: 4 [100.0%] (fallthru,exec)
ivtmp_56
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
my_memsetbb_
4
:
// # PRED:
4 [91.0%] (dfs_back,true,exec) 3 [100.0%] (fallthru,exec
)
*
(
char
*
)((
uintptr_t
)
s
+
(
uintptr_t
)
ivtmp_
77
)
=
pretmp_66
;
ivtmp_
77
=
ivtmp_77
+
1
;
if
(
ivtmp_
77
!=
n
)
goto
my_memsetbb_
4
;
my_memsetbb_
3
:
// # PRED:
3 [91.0%] (true,exec) 5 [100.0%] (fallthru
)
*
(
char
*
)((
uintptr_t
)
s
+
(
uintptr_t
)
ivtmp_
56
)
=
(
char
)
(
char
)
c
;
ivtmp_
56
=
ivtmp_56
+
1
;
if
(
ivtmp_
56
!=
n
)
goto
my_memsetbb_
3
;
else
goto
my_memsetbb_
5
;
// # SUCC:
4 [91.0%] (dfs_back,true,exec) 5
[9.0%] (false,exec)
goto
my_memsetbb_
4
;
// # SUCC:
3 [91.0%] (true,exec) 4
[9.0%] (false,exec)
my_memsetbb_
5
:
// # PRED:
4
[9.0%] (false,exec) 2 [9.0%] (false,exec)
my_memsetbb_
4
:
// # PRED:
3
[9.0%] (false,exec) 2 [9.0%] (false,exec)
return
(
uintptr_t
)
s
;
// # SUCC: EXIT [100.0%]
...
...
examples/sha/ir_c/sha_IR.c
View file @
ff4c6e4b
...
...
@@ -51,45 +51,39 @@ extern unsigned int ARR_SIZE;
static
void
sha_transform
(
SHA_INFO
*
sha_info
)
{
LONG
D_187
;
LONG
A_185
;
uintptr_t
ivtmp_171
;
uintptr_t
ivtmp_170
;
LONG
A_169
;
LONG
D_168
;
LONG
A_167
;
LONG
D_166
;
LONG
E_165
;
LONG
E_164
;
LONG
D_163
;
LONG
D_162
;
LONG
D_161
;
LONG
B_160
;
LONG
B_159
;
LONG
A_158
;
LONG
A_157
;
LONG
A_156
;
LONG
A_155
;
LONG
B_154
;
LONG
E_153
;
LONG
E_152
;
LONG
D_151
;
LONG
B_150
;
LONG
A_149
;
LONG
A_148
;
LONG
C_147
;
LONG
temp_146
;
LONG
D_138
;
LONG
C_137
;
LONG
temp_136
;
LONG
C_133
;
LONG
temp_132
;
LONG
C_129
;
uintptr_t
D_2984
;
uintptr_t
ivtmp_121
;
uintptr_t
ivtmp_113
;
uintptr_t
D_2961
;
uintptr_t
ivtmp_105
;
LONG
A_133
;
LONG
E_132
;
LONG
D_131
;
LONG
B_130
;
LONG
A_129
;
LONG
E_128
;
LONG
D_127
;
LONG
B_126
;
LONG
A_125
;
LONG
E_124
;
LONG
E_123
;
LONG
D_122
;
LONG
D_121
;
LONG
B_120
;
LONG
B_119
;
LONG
A_118
;
LONG
A_117
;
uintptr_t
ivtmp_116
;
uintptr_t
ivtmp_115
;
LONG
C_114
;
LONG
temp_113
;
LONG
C_105
;
LONG
temp_104
;
LONG
C_101
;
LONG
temp_100
;
LONG
C_97
;
uintptr_t
ivtmp_94
;
uintptr_t
ivtmp_93
;
uintptr_t
D_2941
;
uintptr_t
ivtmp_79
;
uintptr_t
ivtmp_71
;
uintptr_t
D_2918
;
uintptr_t
ivtmp_63
;
LONG
W
[
80
];
LONG
E
;
LONG
D
;
...
...
@@ -100,182 +94,175 @@ static void sha_transform(SHA_INFO *sha_info) {
sha_transformbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
W
[
0
]
=
sha_info
->
data
[
0
];
W
[
1
]
=
sha_info
->
data
[
1
];
W
[
2
]
=
sha_info
->
data
[
2
];
W
[
3
]
=
sha_info
->
data
[
3
];
W
[
4
]
=
sha_info
->
data
[
4
];
W
[
5
]
=
sha_info
->
data
[
5
];
W
[
6
]
=
sha_info
->
data
[
6
];
W
[
7
]
=
sha_info
->
data
[
7
];
W
[
8
]
=
sha_info
->
data
[
8
];
W
[
9
]
=
sha_info
->
data
[
9
];
W
[
10
]
=
sha_info
->
data
[
10
];
W
[
11
]
=
sha_info
->
data
[
11
];
W
[
12
]
=
sha_info
->
data
[
12
];
W
[
13
]
=
sha_info
->
data
[
13
];
W
[
14
]
=
sha_info
->
data
[
14
];
W
[
15
]
=
sha_info
->
data
[
15
];
ivtmp_121
=
(
uintptr_t
)
&
W
[
13
];
ivtmp_105
=
(
uintptr_t
)
&
W
;
D_2984
=
ivtmp_105
+
308
;
ivtmp_94
=
(
uintptr_t
)
sha_info
;
ivtmp_93
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
sha_transformbb_3:
// # PRED: 3 [98.4%] (dfs_back,true,exec) 2 [100.0%] (fallthru,exec)
*
(
LONG
*
)((
uintptr_t
)
ivtmp_121
+
12
)
=
((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_121
+
(
int
)
4294967276
)
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_121
))
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_121
+
(
int
)
4294967252
))
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_121
+
(
int
)
4294967244
);
ivtmp_121
=
ivtmp_121
+
4
;
if
(
ivtmp_121
!=
D_2984
)
// # PRED: 3 [94.1%] (true,exec) 2 [100.0%] (fallthru,exec)
*
(
LONG
*
)((
uintptr_t
)
&
W
+
(
uintptr_t
)
ivtmp_93
)
=
*
(
LONG
*
)((
uintptr_t
)
ivtmp_94
+
28
);
ivtmp_93
=
ivtmp_93
+
4
;
ivtmp_94
=
ivtmp_94
+
4
;
if
(
ivtmp_93
!=
64
)
goto
sha_transformbb_3
;
else
goto
sha_transformbb_4
;
// # SUCC: 3 [9
8.4%] (dfs_back,true,exec) 4 [1.6
%] (false,exec)
// # SUCC: 3 [9
4.1%] (true,exec) 4 [5.9
%] (false,exec)
sha_transformbb_4:
// # PRED: 3 [1.6%] (false,exec)
A
=
sha_info
->
digest
[
0
];
B
=
sha_info
->
digest
[
1
];
C
=
sha_info
->
digest
[
2
];
D
=
sha_info
->
digest
[
3
];
E
=
sha_info
->
digest
[
4
];
A_155
=
A
;
ivtmp_113
=
0
;
// # PRED: 3 [5.9%] (false,exec)
ivtmp_79
=
(
uintptr_t
)
&
W
[
13
];
ivtmp_63
=
(
uintptr_t
)
&
W
;
D_2941
=
ivtmp_63
+
308
;
// # SUCC: 5 [100.0%] (fallthru,exec)
sha_transformbb_5:
// # PRED: 11 [100.0%] (fallthru) 4 [100.0%] (fallthru,exec)
temp
=
(((
*
(
LONG
*
)((
uintptr_t
)
&
W
+
(
uintptr_t
)
ivtmp_113
)
+
1518500249
)
+
E
)
+
((
A_155
<<
27
)
|
(
A_155
>>
(
sizeof
(
A_155
)
*
CHAR_BIT
-
27
))))
+
(
~
B
&
D
|
C
&
B
);
C_129
=
(
B
<<
2
)
|
(
B
>>
(
sizeof
(
B
)
*
CHAR_BIT
-
2
));
ivtmp_113
=
ivtmp_113
+
4
;
A_185
=
temp
;
B
=
A_155
;
D_187
=
C
;
E
=
D
;
if
(
ivtmp_113
!=
80
)
goto
sha_transformbb_11
;
// # PRED: 5 [98.5%] (true,exec) 4 [100.0%] (fallthru,exec)
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
12
)
=
((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
(
int
)
4294967276
)
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
))
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
(
int
)
4294967252
))
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
(
int
)
4294967244
);
ivtmp_79
=
ivtmp_79
+
4
;
if
(
ivtmp_79
!=
D_2941
)
goto
sha_transformbb_5
;
else
goto
sha_transformbb_6
;
// # SUCC: 11 [95.0%] (dfs_back,true,exec) 6 [5.0%] (false,exec)
sha_transformbb_11:
// # PRED: 5 [95.0%] (dfs_back,true,exec)
D
=
D_187
;
C
=
C_129
;
A_155
=
A_185
;
goto
sha_transformbb_5
;
// # SUCC: 5 [100.0%] (fallthru)
// # SUCC: 5 [98.5%] (true,exec) 6 [1.5%] (false,exec)
sha_transformbb_6:
// # PRED: 5 [5.0%] (false,exec)
D_2961
=
ivtmp_105
+
80
;
ivtmp_171
=
ivtmp_105
;
E_153
=
D
;
D_161
=
C
;
B_154
=
A_155
;
A_156
=
temp
;
// # PRED: 5 [1.5%] (false,exec)
A
=
sha_info
->
digest
[
0
];
B
=
sha_info
->
digest
[
1
];
C
=
sha_info
->
digest
[
2
];
D
=
sha_info
->
digest
[
3
];
E
=
sha_info
->
digest
[
4
];
A_133
=
A
;
ivtmp_71
=
0
;
// # SUCC: 7 [100.0%] (fallthru,exec)
sha_transformbb_7:
// # PRED: 12 [100.0%] (fallthru) 6 [100.0%] (fallthru,exec)
temp_132
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_171
+
80
)
+
1859775393
)
+
E_153
)
+
((
A_156
<<
27
)
|
(
A_156
>>
(
sizeof
(
A_156
)
*
CHAR_BIT
-
27
))))
+
((
C_129
^
B_154
)
^
D_161
);
C_133
=
(
B_154
<<
2
)
|
(
B_154
>>
(
sizeof
(
B_154
)
*
CHAR_BIT
-
2
));
ivtmp_171
=
ivtmp_171
+
4
;
A_148
=
temp_132
;
B_154
=
A_156
;
D_138
=
C_129
;
E_153
=
D_161
;
if
(
ivtmp_171
!=
D_2961
)
goto
sha_transformbb_12
;
// # PRED: 13 [100.0%] (fallthru) 6 [100.0%] (fallthru,exec)
temp
=
(((
*
(
LONG
*
)((
uintptr_t
)
&
W
+
(
uintptr_t
)
ivtmp_71
)
+
1518500249
)
+
E
)
+
((
A_133
<<
27
)
|
(
A_133
>>
(
sizeof
(
A_133
)
*
CHAR_BIT
-
27
))))
+
(
~
B
&
D
|
C
&
B
);
C_97
=
(
B
<<
2
)
|
(
B
>>
(
sizeof
(
B
)
*
CHAR_BIT
-
2
));
ivtmp_71
=
ivtmp_71
+
4
;
if
(
ivtmp_71
!=
80
)
goto
sha_transformbb_13
;
else
goto
sha_transformbb_14
;
// # SUCC: 12 [95.0%] (dfs_back,true,exec) 14 [5.0%] (false,exec)
sha_transformbb_14:
// # PRED: 7 [5.0%] (false,exec)
ivtmp_170
=
ivtmp_105
;
E_164
=
D_161
;
D_162
=
C_129
;
B_159
=
A_156
;
A_157
=
temp_132
;
goto
sha_transformbb_8
;
// # SUCC: 8 [100.0%] (fallthru)
goto
sha_transformbb_8
;
// # SUCC: 13 [95.2%] (true,exec) 8 [4.8%] (false,exec)
sha_transformbb_12:
// # PRED: 7 [95.0%] (dfs_back,true,exec)
D_161
=
D_138
;
C_129
=
C_133
;
A_156
=
A_148
;
sha_transformbb_13:
// # PRED: 7 [95.2%] (true,exec)
E
=
D
;
D
=
C
;
C
=
C_97
;
B
=
A_133
;
A_133
=
temp
;
goto
sha_transformbb_7
;
// # SUCC: 7 [100.0%] (fallthru)
sha_transformbb_13:
// # PRED: 8 [95.0%] (dfs_back,true,exec)
D_162
=
D_166
;
C_133
=
C_137
;
A_157
=
A_169
;
// # SUCC: 8 [100.0%] (fallthru)
sha_transformbb_8:
// # PRED: 13 [100.0%] (fallthru) 14 [100.0%] (fallthru)
temp_136
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_170
+
160
)
+
(
int
)
2400959708
)
+
E_164
)
+
((
A_157
<<
27
)
|
(
A_157
>>
(
sizeof
(
A_157
)
*
CHAR_BIT
-
27
))))
+
((
D_162
|
C_133
)
&
B_159
|
D_162
&
C_133
);
C_137
=
(
B_159
<<
2
)
|
(
B_159
>>
(
sizeof
(
B_159
)
*
CHAR_BIT
-
2
));
ivtmp_170
=
ivtmp_170
+
4
;
A_169
=
temp_136
;
B_159
=
A_157
;
D_166
=
C_133
;
E_164
=
D_162
;
if
(
ivtmp_170
!=
D_2961
)
goto
sha_transformbb_13
;
// # PRED: 7 [4.8%] (false,exec)
D_2918
=
ivtmp_63
+
80
;
ivtmp_116
=
ivtmp_63
;
E_132
=
D
;
D_131
=
C
;
B_130
=
A_133
;
A_129
=
temp
;
// # SUCC: 9 [100.0%] (fallthru,exec)
sha_transformbb_9:
// # PRED: 14 [100.0%] (fallthru) 8 [100.0%] (fallthru,exec)
temp_100
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_116
+
80
)
+
1859775393
)
+
E_132
)
+
((
A_129
<<
27
)
|
(
A_129
>>
(
sizeof
(
A_129
)
*
CHAR_BIT
-
27
))))
+
((
C_97
^
B_130
)
^
D_131
);
C_101
=
(
B_130
<<
2
)
|
(
B_130
>>
(
sizeof
(
B_130
)
*
CHAR_BIT
-
2
));
ivtmp_116
=
ivtmp_116
+
4
;
if
(
ivtmp_116
!=
D_2918
)
goto
sha_transformbb_14
;
else
goto
sha_transformbb_16
;
// # SUCC: 1
3 [95.0%] (dfs_back,true,exec) 16 [5.0
%] (false,exec)
// # SUCC: 1
4 [95.2%] (true,exec) 16 [4.8
%] (false,exec)
sha_transformbb_16:
// # PRED: 8 [5.0%] (false,exec)
E_165
=
D_162
;
D_163
=
C_133
;
B_160
=
A_157
;
A_158
=
temp_136
;
// # PRED: 9 [4.8%] (false,exec)
ivtmp_115
=
ivtmp_63
;
E_128
=
D_131
;
D_127
=
C_97
;
B_126
=
A_129
;
A_125
=
temp_100
;
goto
sha_transformbb_10
;
// # SUCC: 10 [100.0%] (fallthru)
sha_transformbb_14:
// # PRED: 9 [95.2%] (true,exec)
E_132
=
D_131
;
D_131
=
C_97
;
C_97
=
C_101
;
B_130
=
A_129
;
A_129
=
temp_100
;
goto
sha_transformbb_9
;
// # SUCC: 9 [100.0%] (fallthru)
sha_transformbb_9:
sha_transformbb_15:
// # PRED: 10 [95.2%] (true,exec)
E_128
=
D_127
;
D_127
=
C_101
;
C_101
=
C_105
;
B_126
=
A_125
;
A_125
=
temp_104
;
// # SUCC: 10 [100.0%] (fallthru)
sha_transformbb_10:
// # PRED: 15 [100.0%] (fallthru) 16 [100.0%] (fallthru)
temp_146
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_105
+
240
)
+
(
int
)
3395469782
)
+
E_165
)
+
((
A_158
<<
27
)
|
(
A_158
>>
(
sizeof
(
A_158
)
*
CHAR_BIT
-
27
))))
+
((
C_137
^
B_160
)
^
D_163
);
C_147
=
(
B_160
<<
2
)
|
(
B_160
>>
(
sizeof
(
B_160
)
*
CHAR_BIT
-
2
));
ivtmp_105
=
ivtmp_105
+
4
;
A_167
=
temp_146
;
B_160
=
A_158
;
D_168
=
C_137
;
E_165
=
D_163
;
if
(
D_2961
!=
ivtmp_105
)
temp_104
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_115
+
160
)
+
(
int
)
2400959708
)
+
E_128
)
+
((
A_125
<<
27
)
|
(
A_125
>>
(
sizeof
(
A_125
)
*
CHAR_BIT
-
27
))))
+
((
D_127
|
C_101
)
&
B_126
|
D_127
&
C_101
);
C_105
=
(
B_126
<<
2
)
|
(
B_126
>>
(
sizeof
(
B_126
)
*
CHAR_BIT
-
2
));
ivtmp_115
=
ivtmp_115
+
4
;
if
(
ivtmp_115
!=
D_2918
)
goto
sha_transformbb_15
;
else
goto
sha_transformbb_1
7
;
// # SUCC: 15 [95.
0%] (dfs_back,true,exec) 17 [5.0
%] (false,exec)
goto
sha_transformbb_1
8
;
// # SUCC: 15 [95.
2%] (true,exec) 18 [4.8
%] (false,exec)
sha_transformbb_15:
// # PRED: 9 [95.0%] (dfs_back,true,exec)
D_163
=
D_168
;
C_137
=
C_147
;
A_158
=
A_167
;
goto
sha_transformbb_9
;
// # SUCC: 9 [100.0%] (fallthru)
sha_transformbb_18:
// # PRED: 10 [4.8%] (false,exec)
E_123
=
D_127
;
D_121
=
C_101
;
B_119
=
A_125
;
A_117
=
temp_104
;
// # SUCC: 11 [100.0%] (fallthru)
sha_transformbb_11:
// # PRED: 17 [100.0%] (fallthru) 18 [100.0%] (fallthru)
temp_113
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_63
+
240
)
+
(
int
)
3395469782
)
+
E_123
)
+
((
A_117
<<
27
)
|
(
A_117
>>
(
sizeof
(
A_117
)
*
CHAR_BIT
-
27
))))
+
((
C_105
^
B_119
)
^
D_121
);
C_114
=
(
B_119
<<
2
)
|
(
B_119
>>
(
sizeof
(
B_119
)
*
CHAR_BIT
-
2
));
ivtmp_63
=
ivtmp_63
+
4
;
if
(
ivtmp_63
!=
D_2918
)
goto
sha_transformbb_17
;
else
goto
sha_transformbb_19
;
// # SUCC: 17 [95.2%] (true,exec) 19 [4.8%] (false,exec)
sha_transformbb_17:
// # PRED: 9 [5.0%] (false,exec)
E_152
=
D_163
;
D_151
=
C_137
;
B_150
=
A_158
;
A_149
=
temp_146
;
// # SUCC: 10 [100.0%] (fallthru)
// # PRED: 11 [95.2%] (true,exec)
E_123
=
D_121
;
D_121
=
C_105
;
C_105
=
C_114
;
B_119
=
A_117
;
A_117
=
temp_113
;
goto
sha_transformbb_11
;
// # SUCC: 11 [100.0%] (fallthru)
sha_transformbb_19:
// # PRED: 11 [4.8%] (false,exec)
E_124
=
D_121
;
D_122
=
C_105
;
B_120
=
A_117
;
A_118
=
temp_113
;
// # SUCC: 12 [100.0%] (fallthru)
sha_transformbb_1
0
:
// # PRED: 1
7
[100.0%] (fallthru)
sha_info
->
digest
[
0
]
=
A_1
49
+
A
;
sha_info
->
digest
[
1
]
=
B_1
5
0
+
sha_info
->
digest
[
1
];
sha_info
->
digest
[
2
]
=
C_1
47
+
sha_info
->
digest
[
2
];
sha_info
->
digest
[
3
]
=
D_1
51
+
sha_info
->
digest
[
3
];
sha_info
->
digest
[
4
]
=
E_1
52
+
sha_info
->
digest
[
4
];
sha_transformbb_1
2
:
// # PRED: 1
9
[100.0%] (fallthru)
sha_info
->
digest
[
0
]
=
A_1
18
+
A
;
sha_info
->
digest
[
1
]
=
B_1
2
0
+
sha_info
->
digest
[
1
];
sha_info
->
digest
[
2
]
=
C_1
14
+
sha_info
->
digest
[
2
];
sha_info
->
digest
[
3
]
=
D_1
22
+
sha_info
->
digest
[
3
];
sha_info
->
digest
[
4
]
=
E_1
24
+
sha_info
->
digest
[
4
];
return
;
// # SUCC: EXIT [100.0%]
...
...
@@ -303,7 +290,7 @@ sha_initbb_2:
void
sha_print
(
SHA_INFO
*
sha_info
)
{
sha_printbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
printf
(
&
"%08lx %08lx %08lx %08lx %08lx
\n
"
[
0
],
sha_info
->
digest
[
0
],
sha_info
->
digest
[
1
],
sha_info
->
digest
[
2
],
sha_info
->
digest
[
3
],
sha_info
->
digest
[
4
]);
//[tail call]
printf
(
&
"%08lx %08lx %08lx %08lx %08lx
\n
"
[
0
],
sha_info
->
digest
[
0
],
sha_info
->
digest
[
1
],
sha_info
->
digest
[
2
],
sha_info
->
digest
[
3
],
sha_info
->
digest
[
4
]);
return
;
// # SUCC: EXIT [100.0%]
...
...
@@ -312,7 +299,7 @@ sha_printbb_2:
void
sha_final
(
SHA_INFO
*
sha_info
)
{
int
count_2
90
;
int
count_2
03
;
LONG
hi_bit_count
;
LONG
lo_bit_count
;
int
count
;
...
...
@@ -325,8 +312,8 @@ sha_finalbb_2:
count
=
(
int
)
(
lo_bit_count
>>
3
)
&
63
;
D_2806
=
&
sha_info
->
data
;
*
(
BYTE
*
)(
(
uintptr_t
)
D_2806
+
(
unsigned
int
)
count
)
=
128
;
count_2
90
=
count
+
1
;
if
(
count_2
90
>
56
)
count_2
03
=
count
+
1
;
if
(
count_2
03
>
56
)
goto
sha_finalbb_3
;
else
goto
sha_finalbb_4
;
...
...
@@ -334,7 +321,7 @@ sha_finalbb_2:
sha_finalbb_3:
// # PRED: 2 [39.0%] (true,exec)
my_memset
(
D_2806
+
(
unsigned
int
)
count_2
90
,
0
,
(
size_t
)
(
64
-
count_290
));
my_memset
(
D_2806
+
(
unsigned
int
)
count_2
03
,
0
,
(
size_t
)
(
64
-
count_203
));
sha_transform
(
sha_info
);
my_memset
(
D_2806
,
0
,
56
);
goto
sha_finalbb_5
;
...
...
@@ -342,14 +329,14 @@ sha_finalbb_3:
sha_finalbb_4:
// # PRED: 2 [61.0%] (false,exec)
my_memset
(
D_2806
+
(
unsigned
int
)
count_2
90
,
0
,
(
size_t
)
(
56
-
count_290
));
my_memset
(
D_2806
+
(
unsigned
int
)
count_2
03
,
0
,
(
size_t
)
(
56
-
count_203
));
// # SUCC: 5 [100.0%] (fallthru,exec)
sha_finalbb_5:
// # PRED: 3 [100.0%] (fallthru,exec) 4 [100.0%] (fallthru,exec)
sha_info
->
data
[
14
]
=
hi_bit_count
;
sha_info
->
data
[
15
]
=
lo_bit_count
;
sha_transform
(
sha_info
);
//[tail call]
sha_transform
(
sha_info
);
return
;
// # SUCC: EXIT [100.0%]
...
...
@@ -358,23 +345,21 @@ sha_finalbb_5:
void
sha_update
(
SHA_INFO
*
sha_info
,
BYTE
*
buffer
,
int
count
)
{
uintptr_t
D_3211
;
uintptr_t
ivtmp_337
;
int
D_3197
;
uintptr_t
D_3194
;
size_t
prephitmp_324
;
long
unsigned
int
prephitmp_322
;
uintptr_t
D_3104
;
uintptr_t
ivtmp_232
;
int
D_3090
;
uintptr_t
D_3087
;
LONG
*
D_2796
;
long
unsigned
int
D_2788
;
long
unsigned
int
count_1
;
LONG
D_2786
;
sha_updatebb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
D_2786
=
sha_info
->
count_lo
;
prephitmp_324
=
(
size_t
)
count
;
D_2788
=
prephitmp_324
<<
3
;
prephitmp_322
=
D_2788
+
D_2786
;
if
(
D_2786
>
prephitmp_322
)
count_1
=
(
long
unsigned
int
)
count
;
D_2788
=
count_1
<<
3
;
if
(
D_2786
>
D_2788
+
D_2786
)
goto
sha_updatebb_3
;
else
goto
sha_updatebb_4
;
...
...
@@ -383,13 +368,12 @@ sha_updatebb_2:
sha_updatebb_3:
// # PRED: 2 [50.0%] (true,exec)
sha_info
->
count_hi
=
sha_info
->
count_hi
+
1
;
prephitmp_322
=
D_2788
+
sha_info
->
count_lo
;
// # SUCC: 4 [100.0%] (fallthru,exec)
sha_updatebb_4:
// # PRED: 2 [50.0%] (false,exec) 3 [100.0%] (fallthru,exec)
sha_info
->
count_lo
=
prephitmp_322
;
sha_info
->
count_hi
=
(
prephitmp_324
>>
29
)
+
sha_info
->
count_hi
;
sha_info
->
count_lo
=
D_2788
+
sha_info
->
count_lo
;
sha_info
->
count_hi
=
(
count_1
>>
29
)
+
sha_info
->
count_hi
;
if
(
count
>
63
)
goto
sha_updatebb_5
;
else
...
...
@@ -399,32 +383,32 @@ sha_updatebb_4:
sha_updatebb_5:
// # PRED: 4 [91.0%] (true,exec)
D_2796
=
&
sha_info
->
data
;
ivtmp_
337
=
0
;
ivtmp_
232
=
0
;
// # SUCC: 6 [100.0%] (fallthru,exec)
sha_updatebb_6:
// # PRED: 6 [91.0%] (
dfs_back,
true,exec) 5 [100.0%] (fallthru,exec)
D_3
211
=
ivtmp_337
+
(
uintptr_t
)
buffer
;
my_memcpy
(
D_2796
,
D_3
211
,
64
);
// # PRED: 6 [91.0%] (true,exec) 5 [100.0%] (fallthru,exec)
D_3
104
=
ivtmp_232
+
(
uintptr_t
)
buffer
;
my_memcpy
(
D_2796
,
D_3
104
,
64
);
sha_transform
(
sha_info
);
ivtmp_
337
=
ivtmp_337
+
64
;
if
((
int
)
(
prephitmp_324
-
ivtmp_337
)
>
63
)
ivtmp_
232
=
ivtmp_232
+
64
;
if
((
int
)
(
count_1
-
ivtmp_232
)
>
63
)
goto
sha_updatebb_6
;
else
goto
sha_updatebb_7
;
// # SUCC: 6 [91.0%] (
dfs_back,
true,exec) 7 [9.0%] (false,exec)
// # SUCC: 6 [91.0%] (true,exec) 7 [9.0%] (false,exec)
sha_updatebb_7:
// # PRED: 6 [9.0%] (false,exec)
D_3
194
=
prephitmp_324
+
(
int
)
4294967232
>>
6
;
buffer
=
(
uintptr_t
)
buffer
+
(
D_3
194
+
1
)
*
64
;
D_3
197
=
count
+
-
64
;
prephitmp_324
=
(
size_t
)
(
D_3197
+
(
int
)
D_3194
*
-
64
)
;
D_3
087
=
(
count_1
+
(
int
)
4294967232
)
/
64
;
buffer
=
(
uintptr_t
)
buffer
+
(
D_3
087
+
1
)
*
64
;
D_3
090
=
count
+
-
64
;
count
=
D_3090
+
(
int
)
D_3087
*
-
64
;
// # SUCC: 8 [100.0%] (fallthru,exec)
sha_updatebb_8:
// # PRED: 7 [100.0%] (fallthru,exec) 4 [9.0%] (false,exec)
my_memcpy
(
&
sha_info
->
data
,
buffer
,
prephitmp_324
);
//[tail call]
my_memcpy
(
&
sha_info
->
data
,
buffer
,
(
size_t
)
count
);
return
;
// # SUCC: EXIT [100.0%]
...
...
@@ -433,11 +417,11 @@ sha_updatebb_8:
void
sha_stream
(
SHA_INFO
*
sha_info
,
BYTE
*
inData
,
LONG
dSize
)
{
LONG
end_
408
;
LONG
end_
407
;
uintptr_t
ivtmp_
392
;
uintptr_t
D_3
265
;
uintptr_t
ivtmp_
386
;
LONG
end_
289
;
LONG
end_
288
;
uintptr_t
ivtmp_
273
;
uintptr_t
D_3
144
;
uintptr_t
ivtmp_
267
;
BYTE
data
[
8192
];
LONG
count
;
LONG
end
;
...
...
@@ -448,30 +432,24 @@ void sha_stream(SHA_INFO *sha_info, BYTE *inData, LONG dSize) {
sha_streambb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ARR_SIZE_4
=
ARR_SIZE
;
j
=
ARR_SIZE_4
>>
13
;
sha_info
->
digest
[
0
]
=
1732584193
;
sha_info
->
digest
[
1
]
=
4023233417
;
sha_info
->
digest
[
2
]
=
2562383102
;
sha_info
->
digest
[
3
]
=
271733878
;
sha_info
->
digest
[
4
]
=
3285377520
;
sha_info
->
count_lo
=
0
;
sha_info
->
count_hi
=
0
;
j
=
ARR_SIZE_4
/
8192
;
sha_init
(
sha_info
);
if
(
j
!=
0
)
goto
sha_streambb_1
2
;
goto
sha_streambb_1
3
;
else
goto
sha_streambb_6
;
// # SUCC: 1
2
[91.0%] (true,exec) 6 [9.0%] (false,exec)
// # SUCC: 1
3
[91.0%] (true,exec) 6 [9.0%] (false,exec)
sha_streambb_1
2
:
sha_streambb_1
3
:
// # PRED: 2 [91.0%] (true,exec)
end_
408
=
0
;
end_
289
=
0
;
count
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
sha_streambb_3:
// # PRED: 12 [100.0%] (fallthru) 13 [100.0%] (fallthru)
end_
407
=
end_408
+
8192
;
if
(
end_
407
>
end_408
)
end_
288
=
end_289
+
8192
;
if
(
end_
288
>
end_289
)
goto
sha_streambb_14
;
else
goto
sha_streambb_5
;
...
...
@@ -479,32 +457,32 @@ sha_streambb_3:
sha_streambb_14:
// # PRED: 3 [99.0%] (true,exec)
ivtmp_
392
=
0
;
ivtmp_
273
=
0
;
// # SUCC: 4 [100.0%] (fallthru)
sha_streambb_4:
// # PRED:
14 [100.0%] (fallthru) 4 [99.0%] (dfs_back,true,exec
)
*
(
BYTE
*
)((
uintptr_t
)
&
data
+
(
uintptr_t
)
ivtmp_
392
)
=
*
(
BYTE
*
)((
BYTE
*
)
(
end_408
+
(
uintptr_t
)
inData
)
+
(
uintptr_t
)
ivtmp_392
);
ivtmp_
392
=
ivtmp_392
+
1
;
if
(
ivtmp_
392
!=
8192
)
// # PRED:
4 [99.0%] (true,exec) 14 [100.0%] (fallthru
)
*
(
BYTE
*
)((
uintptr_t
)
&
data
+
(
uintptr_t
)
ivtmp_
273
)
=
*
(
BYTE
*
)((
BYTE
*
)
(
end_289
+
(
uintptr_t
)
inData
)
+
(
uintptr_t
)
ivtmp_273
);
ivtmp_
273
=
ivtmp_273
+
1
;
if
(
ivtmp_
273
!=
8192
)
goto
sha_streambb_4
;
else
goto
sha_streambb_5
;
// # SUCC: 4 [99.0%] (
dfs_back,
true,exec) 5 [1.0%] (false,exec)
// # SUCC: 4 [99.0%] (true,exec) 5 [1.0%] (false,exec)
sha_streambb_5:
// # PRED: 4 [1.0%] (false,exec) 3 [1.0%] (false,exec)
sha_update
(
sha_info
,
&
data
,
8192
);
count
=
count
+
1
;
if
(
j
>
count
)
goto
sha_streambb_1
3
;
goto
sha_streambb_1
2
;
else
goto
sha_streambb_6
;
// # SUCC: 1
3 [91.0%] (dfs_back,
true,exec) 6 [9.0%] (false,exec)
// # SUCC: 1
2 [91.0%] (
true,exec) 6 [9.0%] (false,exec)
sha_streambb_1
3
:
// # PRED: 5 [91.0%] (
dfs_back,
true,exec)
end_
408
=
end_407
;
sha_streambb_1
2
:
// # PRED: 5 [91.0%] (true,exec)
end_
289
=
end_288
;
goto
sha_streambb_3
;
// # SUCC: 3 [100.0%] (fallthru)
...
...
@@ -528,19 +506,19 @@ sha_streambb_7:
sha_streambb_8:
// # PRED: 7 [99.0%] (true,exec)
D_3
265
=
end
-
start
;
ivtmp_
386
=
0
;
D_3
144
=
end
-
start
;
ivtmp_
267
=
0
;
// # SUCC: 9 [100.0%] (fallthru,exec)
sha_streambb_9:
// # PRED: 9 [99.0%] (
dfs_back,
true,exec) 8 [100.0%] (fallthru,exec)
*
(
BYTE
*
)((
uintptr_t
)
&
data
+
(
uintptr_t
)
ivtmp_
386
)
=
*
(
BYTE
*
)((
uintptr_t
)
inData
+
start
+
(
uintptr_t
)
ivtmp_386
);
ivtmp_
386
=
ivtmp_386
+
1
;
if
(
ivtmp_
386
!=
D_3265
)
// # PRED: 9 [99.0%] (true,exec) 8 [100.0%] (fallthru,exec)
*
(
BYTE
*
)((
uintptr_t
)
&
data
+
(
uintptr_t
)
ivtmp_
267
)
=
*
(
BYTE
*
)((
uintptr_t
)
inData
+
start
+
(
uintptr_t
)
ivtmp_267
);
ivtmp_
267
=
ivtmp_267
+
1
;
if
(
ivtmp_
267
!=
D_3144
)
goto
sha_streambb_9
;
else
goto
sha_streambb_10
;
// # SUCC: 9 [99.0%] (
dfs_back,
true,exec) 10 [1.0%] (false,exec)
// # SUCC: 9 [99.0%] (true,exec) 10 [1.0%] (false,exec)
sha_streambb_10:
// # PRED: 9 [1.0%] (false,exec) 7 [1.0%] (false,exec)
...
...
instrument/cfg_isc.py
View file @
ff4c6e4b
...
...
@@ -11,7 +11,7 @@ from cfg import *
# if group(2) == "){", single line definition
# elif group(2) == $, multi line definition
re_funcDef
=
re
.
compile
(
'(?:
\
w*
\
s+)*
\
**(
\
w+)
\
s*
\
([,
\
s
\
w&
\
[
\
]
\
*]*($|
\
)
\
s*
\
{)'
)
re_funcDefArgLine
=
re
.
compile
(
'[,
\
s
\
w&
\
[
\
]
\
*]*($|
\
)
\
s*
\
{
)'
)
re_funcDefArgLine
=
re
.
compile
(
'[,
\
s
\
w&
\
[
\
]
\
*]*($|
\
)
\
s*
(?:
\
{)?
)'
)
re_basicBlockLabel
=
re
.
compile
(
'
\
s*(
\
w*bb_[0-9]*):'
)
re_basicBlockStart
=
re
.
compile
(
'
\
s*//
\
s*#
\
s*PRED:./*'
)
re_basicBlockEnd
=
re
.
compile
(
'
\
s*//
\
s*#
\
s*SUCC:./*'
)
...
...
@@ -125,7 +125,7 @@ def parse_isc(fileName):
currFuncStartLine
=
lineNum
+
1
continue
else
:
raise
ParseError
(
"Not found the expected Multi Line Argument List at
%
s:
%
d."
&
(
fileName
,
lineNum
))
raise
ParseError
(
"Not found the expected Multi Line Argument List at
%
s:
%
d."
%
(
fileName
,
lineNum
))
exit
(
1
)
# 2. Inside Function Body
...
...
instrument/examples/basicmath/basicmath_small_truncated3_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
basicmath/app_dir/basicmath_small_truncated3.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
//23 Oct 2012 - Truncated the 4 nested loop counts (calling SolveCubic). Total iterations
// reduced to 960 from 18000 in this nest of 4 loops.
// last week of Oct 2012 - Truncated even more, down to 96 iterations in the
// 4 nested for-loops and 51 in the usqrt loops
#include "snipmath.h"
#include <math.h>
/* The printf's may be removed to isolate just the math calculations */
double
Xangle
[
2
];
int
main
(
void
)
{
double
X_62
;
uintptr_t
ivtmp_58
;
uintptr_t
ivtmp_54
;
uintptr_t
ivtmp_50
;
uintptr_t
ivtmp_46
;
uintptr_t
ivtmp_37
;
uintptr_t
ivtmp_32
;
double
Xangle_I_lsm_24
;
double
Xangle_I_lsm_23
;
struct
int_sqrt
q
;
int
i
;
int
solutions
;
double
X
;
double
x
[
3
];
double
d1
;
double
c1
;
double
b1
;
double
a1
;
mainbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
SolveCubic
(
1.0e+0
,
-
1.05e+1
,
3.2e+1
,
-
3.0e+1
,
&
solutions
,
&
x
);
SolveCubic
(
1.0e+0
,
-
4.5e+0
,
1.7e+1
,
-
3.0e+1
,
&
solutions
,
&
x
);
SolveCubic
(
1.0e+0
,
-
3.5e+0
,
2.2e+1
,
-
3.1e+1
,
&
solutions
,
&
x
);
SolveCubic
(
1.0e+0
,
-
1.36999999999999992894572642398998141288757324219e+1
,
1.0e+0
,
-
3.5e+1
,
&
solutions
,
&
x
);
ivtmp_58
=
0
;
a1
=
3.0e+0
;
goto
mainbb_9
;
// # SUCC: 9 [100.0%] (fallthru,exec)
mainbb_3:
// # PRED: 3 [91.0%] (true,exec) 5 [100.0%] (fallthru,exec)
SolveCubic
(
a1
,
b1
,
c1
,
d1
,
&
solutions
,
&
x
);
d1
=
d1
-
1.0e+0
;
ivtmp_46
=
ivtmp_46
+
1
;
if
(
ivtmp_46
!=
4
)
goto
mainbb_3
;
else
goto
mainbb_4
;
// # SUCC: 3 [91.0%] (true,exec) 4 [9.0%] (false,exec)
mainbb_4:
// # PRED: 3 [9.0%] (false,exec)
c1
=
c1
+
5.0e-1
;
ivtmp_50
=
ivtmp_50
+
1
;
if
(
ivtmp_50
!=
4
)
goto
mainbb_5
;
else
goto
mainbb_6
;
// # SUCC: 5 [91.0%] (true,exec) 6 [9.0%] (false,exec)
mainbb_5:
// # PRED: 4 [91.0%] (true,exec) 7 [100.0%] (fallthru,exec)
ivtmp_46
=
0
;
d1
=
-
1.0e+0
;
goto
mainbb_3
;
// # SUCC: 3 [100.0%] (fallthru,exec)
mainbb_6:
// # PRED: 4 [9.0%] (false,exec)
b1
=
b1
-
1.0e+0
;
ivtmp_54
=
ivtmp_54
+
1
;
if
(
ivtmp_54
!=
2
)
goto
mainbb_7
;
else
goto
mainbb_8
;
// # SUCC: 7 [91.0%] (true,exec) 8 [9.0%] (false,exec)
mainbb_7:
// # PRED: 6 [91.0%] (true,exec) 9 [100.0%] (fallthru,exec)
ivtmp_50
=
0
;
c1
=
5.0e+0
;
goto
mainbb_5
;
// # SUCC: 5 [100.0%] (fallthru,exec)
mainbb_8:
// # PRED: 6 [9.0%] (false,exec)
a1
=
a1
+
1.0e+0
;
ivtmp_58
=
ivtmp_58
+
1
;
if
(
ivtmp_58
!=
3
)
goto
mainbb_9
;
else
goto
mainbb_16
;
// # SUCC: 9 [75.0%] (true,exec) 16 [25.0%] (false,exec)
mainbb_9:
// # PRED: 8 [75.0%] (true,exec) 2 [100.0%] (fallthru,exec)
ivtmp_54
=
0
;
b1
=
1.0e+1
;
goto
mainbb_7
;
// # SUCC: 7 [100.0%] (fallthru,exec)
mainbb_16:
// # PRED: 8 [25.0%] (false,exec)
i
=
0
;
// # SUCC: 10 [100.0%] (fallthru)
mainbb_10:
// # PRED: 10 [98.1%] (true,exec) 16 [100.0%] (fallthru)
usqrt
((
long
unsigned
int
)
i
,
&
q
);
i
=
i
+
1
;
if
(
i
!=
51
)
goto
mainbb_10
;
else
goto
mainbb_11
;
// # SUCC: 10 [98.1%] (true,exec) 11 [1.9%] (false,exec)
mainbb_11:
// # PRED: 10 [1.9%] (false,exec)
//Invalid sum of outgoing probabilities 0.0%
usqrt
(
1072497001
,
&
q
);
ivtmp_37
=
0
;
X
=
0
.
0
;
// # SUCC: 12 (fallthru,exec)
mainbb_12:
// # PRED: 12 [99.0%] (true,exec) 11 (fallthru,exec)
Xangle_I_lsm_24
=
(
X
*
3.14159265358979311599796346854418516159057617188e+0
)
/
1.8e+2
;
X
=
X
+
1.0e+0
;
ivtmp_37
=
ivtmp_37
+
1
;
if
(
ivtmp_37
!=
361
)
goto
mainbb_12
;
else
goto
mainbb_13
;
// # SUCC: 12 [99.0%] (true,exec) 13 [1.0%] (false,exec)
mainbb_13:
// # PRED: 12 [1.0%] (false,exec)
//Invalid sum of outgoing probabilities 0.0%
Xangle
[
0
]
=
Xangle_I_lsm_24
;
ivtmp_32
=
0
;
X_62
=
0
.
0
;
// # SUCC: 14 (fallthru,exec)
mainbb_14:
// # PRED: 14 [91.0%] (true,exec) 13 (fallthru,exec)
Xangle_I_lsm_23
=
(
X_62
*
1.8e+2
)
/
3.14159265358979311599796346854418516159057617188e+0
;
X_62
=
X_62
+
1.74532925199432954743716805978692718781530857086e-2
;
ivtmp_32
=
ivtmp_32
+
1
;
if
(
ivtmp_32
!=
361
)
goto
mainbb_14
;
else
goto
mainbb_15
;
// # SUCC: 14 [91.0%] (true,exec) 15 [9.0%] (false,exec)
mainbb_15:
// # PRED: 14 [9.0%] (false,exec)
Xangle
[
1
]
=
Xangle_I_lsm_23
;
return
0
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/basicmath/cubic_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
basicmath/app_dir/cubic.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/* +++Date last modified: 05-Jul-1997 */
/*
** CUBIC.C - Solve a cubic polynomial
** public domain by Ross Cottrell
*/
#include <math.h>
#include <stdlib.h>
#include "snipmath.h"
void
SolveCubic
(
double
a
,
double
b
,
double
c
,
double
d
,
int
*
solutions
,
double
*
x
)
{
double
theta
;
double
R2_Q3
;
long
double
R
;
long
double
Q
;
long
double
a2
;
long
double
a1
;
double
iftmp_1
;
double
D_2478
;
double
D_2475
;
double
D_2471
;
double
D_2467
;
double
D_2463
;
double
D_2459
;
long
double
D_2456
;
double
D_2454
;
double
D_2451
;
double
D_2448
;
long
double
D_2444
;
SolveCubicbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
a1
=
b
/
a
;
a2
=
c
/
a
;
Q
=
(
a1
*
a1
+
a2
*
-
3.0e+0
)
/
9.0e+0
;
R
=
((((
a1
*
2.0e+0
)
*
a1
)
*
a1
+
(
a1
*
-
9.0e+0
)
*
a2
)
+
(
d
/
a
)
*
2.7e+1
)
/
5.4e+1
;
D_2444
=
(
Q
*
Q
)
*
Q
;
R2_Q3
=
R
*
R
-
D_2444
;
if
(
R2_Q3
<=
0
.
0
!=
0
)
goto
SolveCubicbb_3
;
else
goto
SolveCubicbb_4
;
// # SUCC: 3 [39.0%] (true,exec) 4 [61.0%] (false,exec)
SolveCubicbb_3:
// # PRED: 2 [39.0%] (true,exec)
*
solutions
=
3
;
D_2448
=
sqrt
(
D_2444
);
theta
=
acos
(
R
/
D_2448
);
D_2451
=
sqrt
(
Q
);
D_2454
=
cos
(
theta
/
3.0e+0
);
D_2456
=
a1
/
-
3.0e+0
;
*
x
=
(
D_2451
*
-
2.0e+0
)
*
D_2454
+
D_2456
;
D_2459
=
sqrt
(
Q
);
D_2463
=
cos
((
theta
+
6.28318530717958623199592693708837032318115234375e+0
)
/
3.0e+0
);
*
(
double
*
)((
uintptr_t
)
x
+
8
)
=
D_2456
+
(
D_2459
*
-
2.0e+0
)
*
D_2463
;
D_2467
=
sqrt
(
Q
);
D_2471
=
cos
((
theta
+
1.25663706143591724639918538741767406463623046875e+1
)
/
3.0e+0
);
*
(
double
*
)((
uintptr_t
)
x
+
16
)
=
D_2456
+
(
D_2467
*
-
2.0e+0
)
*
D_2471
;
goto
SolveCubicbb_7
;
// # SUCC: 7 [100.0%] (fallthru,exec)
SolveCubicbb_4:
// # PRED: 2 [61.0%] (false,exec)
*
solutions
=
1
;
D_2475
=
sqrt
(
R2_Q3
);
D_2478
=
pow
(
D_2475
+
fabsl
(
R
),
3.33333333333333314829616256247390992939472198486e-1
);
if
(
R
<
0
.
0
!=
0
)
goto
SolveCubicbb_5
;
else
goto
SolveCubicbb_8
;
// # SUCC: 5 [50.0%] (true,exec) 8 [50.0%] (false,exec)
SolveCubicbb_8:
// # PRED: 4 [50.0%] (false,exec)
iftmp_1
=
-
1.0e+0
;
goto
SolveCubicbb_6
;
// # SUCC: 6 [100.0%] (fallthru)
SolveCubicbb_5:
// # PRED: 4 [50.0%] (true,exec)
iftmp_1
=
1.0e+0
;
// # SUCC: 6 [100.0%] (fallthru,exec)
SolveCubicbb_6:
// # PRED: 5 [100.0%] (fallthru,exec) 8 [100.0%] (fallthru)
*
x
=
iftmp_1
*
(
D_2478
+
Q
/
D_2478
)
+
a1
/
-
3.0e+0
;
// # SUCC: 7 [100.0%] (fallthru,exec)
SolveCubicbb_7:
// # PRED: 3 [100.0%] (fallthru,exec) 6 [100.0%] (fallthru,exec)
return
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/basicmath/isqrt_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
basicmath/app_dir/isqrt.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/* +++Date last modified: 05-Jul-1997 */
#include <string.h>
#include "snipmath.h"
#define BITSPERLONG 32
#define TOP2BITS(x) ((x & (3L << (BITSPERLONG-2))) >> (BITSPERLONG-2))
/* usqrt:
ENTRY x: unsigned long
EXIT returns floor(sqrt(x) * pow(2, BITSPERLONG/2))
Since the square root never uses more than half the bits
of the input, we use the other half of the bits to contain
extra bits of precision after the binary point.
EXAMPLE
suppose BITSPERLONG = 32
then usqrt(144) = 786432 = 12 * 65536
usqrt(32) = 370727 = 5.66 * 65536
NOTES
(1) change BITSPERLONG to BITSPERLONG/2 if you do not want
the answer scaled. Indeed, if you want n bits of
precision after the binary point, use BITSPERLONG/2+n.
The code assumes that BITSPERLONG is even.
(2) This is really better off being written in assembly.
The line marked below is really a "arithmetic shift left"
on the double-long value with r in the upper half
and x in the lower half. This operation is typically
expressible in only one or two assembly instructions.
(3) Unrolling this loop is probably not a bad idea.
ALGORITHM
The calculations are the base-two analogue of the square
root algorithm we all learned in grammar school. Since we're
in base 2, there is only one nontrivial trial multiplier.
Notice that absolutely no multiplications or divisions are performed.
This means it'll be fast on a wide range of processors.
*/
void
usqrt
(
unsigned
long
int
x
,
struct
int_sqrt
*
q
)
{
int
i
;
long
unsigned
int
e
;
long
unsigned
int
r
;
long
unsigned
int
a
;
long
unsigned
int
D_2427
;
usqrtbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
a
=
0
;
i
=
0
;
r
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
usqrtbb_3:
// # PRED: 5 [97.0%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2427
=
r
<<
2
;
r
=
(
x
>>
30
)
+
D_2427
;
x
=
x
<<
2
;
a
=
a
<<
1
;
e
=
(
a
<<
1
)
+
1
;
if
(
r
>=
e
)
goto
usqrtbb_4
;
else
goto
usqrtbb_5
;
// # SUCC: 4 [50.0%] (true,exec) 5 [50.0%] (false,exec)
usqrtbb_4:
// # PRED: 3 [50.0%] (true,exec)
r
=
r
-
e
;
a
=
a
+
1
;
// # SUCC: 5 [100.0%] (fallthru,exec)
usqrtbb_5:
// # PRED: 3 [50.0%] (false,exec) 4 [100.0%] (fallthru,exec)
i
=
i
+
1
;
if
(
i
!=
32
)
goto
usqrtbb_3
;
else
goto
usqrtbb_6
;
// # SUCC: 3 [97.0%] (true,exec) 6 [3.0%] (false,exec)
usqrtbb_6:
// # PRED: 5 [3.0%] (false,exec)
*
(
long
unsigned
int
*
)
q
=
a
;
return
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/basicmath/my_math_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
basicmath/app_dir/my_math.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
#include <stdio.h>
#define SQRTCNT 163
#define ACOSCNT 21
#define COSCNT 63
#define POWCNT 79
#define MY_MARGIN 0.002
struct
Pair
{
long
double
input
;
long
double
output
;
};
struct
Pair1
{
long
double
input1
;
long
double
input2
;
long
double
output
;
};
struct
Pair
sQrt_LkUpTbl
[
SQRTCNT
]
=
{
{
3
.
969329
,
1
.
992317
},
{
1
.
583333
,
1
.
258306
},
{
1
.
583333
,
1
.
258306
},
{
1
.
583333
,
1
.
258306
},
{
71
.
525463
,
8
.
457273
},
{
231
.
115741
,
15
.
202491
},
{
3557
.
867870
,
59
.
647866
},
{
0
.
313064
,
0
.
559521
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
313064
,
0
.
559521
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
313064
,
0
.
559521
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
313064
,
0
.
559521
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
679012
,
0
.
824022
},
{
0
.
242337
,
0
.
492277
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
242337
,
0
.
492277
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
242337
,
0
.
492277
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
242337
,
0
.
492277
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
623457
,
0
.
789593
},
{
0
.
183155
,
0
.
427966
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
183155
,
0
.
427966
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
183155
,
0
.
427966
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
183155
,
0
.
427966
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
567901
,
0
.
753592
},
{
0
.
134490
,
0
.
366728
},
{
0
.
512346
,
0
.
715783
},
{
0
.
512346
,
0
.
715783
},
{
0
.
512346
,
0
.
715783
},
{
0
.
134490
,
0
.
366728
},
{
0
.
512346
,
0
.
715783
},
{
0
.
512346
,
0
.
715783
},
{
0
.
512346
,
0
.
715783
},
{
0
.
134490
,
0
.
366728
},
{
0
.
512346
,
0
.
715783
},
{
0
.
512346
,
0
.
715783
},
{
0
.
512346
,
0
.
715783
},
{
0
.
114140
,
0
.
337847
},
{
0
.
087791
,
0
.
296296
},
{
0
.
444444
,
0
.
666667
},
{
0
.
444444
,
0
.
666667
},
{
0
.
444444
,
0
.
666667
},
{
0
.
087791
,
0
.
296296
},
{
0
.
444444
,
0
.
666667
},
{
0
.
444444
,
0
.
666667
},
{
0
.
444444
,
0
.
666667
},
{
0
.
023320
,
0
.
152708
},
{
0
.
162209
,
0
.
402751
},
{
0
.
05
8813
,
0
.
242515
},
{
0
.
388889
,
0
.
623610
},
{
0
.
388889
,
0
.
623610
},
{
0
.
388889
,
0
.
623610
},
{
0
.
0036
87
,
0
.
060717
},
{
0
.
114798
,
0
.
338818
},
{
0
.
281464
,
0
.
530532
},
{
0
.
037037
,
0
.
192450
},
{
0
.
333333
,
0
.
577350
},
{
0
.
333333
,
0
.
577350
},
{
0
.
333333
,
0
.
577350
},
{
0
.
074074
,
0
.
272166
},
{
0
.
212963
,
0
.
461479
},
{
0
.
407407
,
0
.
638285
},
{
0
.
041067
,
0
.
202649
},
{
0
.
152178
,
0
.
390100
},
{
0
.
318844
,
0
.
564663
},
{
0
.
541067
,
0
.
735572
},
{
0
.
021433
,
0
.
146402
},
{
0
.
277778
,
0
.
527046
},
{
0
.
277778
,
0
.
527046
},
{
0
.
277778
,
0
.
527046
},
{
0
.
0154
80
,
0
.
124420
},
{
0
.
07
9138
,
0
.
281314
},
{
0
.
174045
,
0
.
417187
},
{
0
.
00104
9
,
0
.
0323
87
},
{
0
.
046477
,
0
.
215586
},
{
0
.
123155
,
0
.
350935
},
{
0
.
231084
,
0
.
480712
},
{
0
.
021
991
,
0
.
148293
},
{
0
.
080440
,
0
.
283619
},
{
0
.
170139
,
0
.
412479
},
{
0
.
291088
,
0
.
539526
},
{
0
.
046332
,
0
.
215250
},
{
0
.
117802
,
0
.
343224
},
{
0
.
220522
,
0
.
469598
},
{
0
.
354492
,
0
.
595392
},
{
0
.
026440
,
0
.
162602
},
{
0
.
085033
,
0
.
291605
},
{
0
.
174877
,
0
.
418183
},
{
0
.
295971
,
0
.
544032
},
{
0
.
046721
,
0
.
216151
},
{
0
.
117034
,
0
.
342102
},
{
0
.
218596
,
0
.
467543
},
{
0
.
351409
,
0
.
592797
},
{
0
.
070312
,
0
.
265165
},
{
0
.
152344
,
0
.
390312
},
{
0
.
265625
,
0
.
515388
},
{
0
.
410156
,
0
.
640434
},
{
0
.
097647
,
0
.
312486
},
{
0
.
191397
,
0
.
437490
},
{
0
.
316397
,
0
.
562492
},
{
0
.
472647
,
0
.
687493
},
{
0
.
017407
,
0
.
131937
},
{
0
.
054
815
,
0
.
234126
},
{
0
.
112222
,
0
.
334996
},
{
0
.
189630
,
0
.
435465
},
{
0
.
02
8556
,
0
.
168984
},
{
0
.
072630
,
0
.
269499
},
{
0
.
136704
,
0
.
369735
},
{
0
.
220778
,
0
.
469870
},
{
0
.
041407
,
0
.
203488
},
{
0
.
092148
,
0
.
303559
},
{
0
.
162889
,
0
.
403595
},
{
0
.
253630
,
0
.
503617
},
{
0
.
0561
85
,
0
.
237034
},
{
0
.
113593
,
0
.
337035
},
{
0
.
191000
,
0
.
437035
},
{
0
.
288407
,
0
.
537036
},
{
0
.
033
837
,
0
.
183948
},
{
0
.
080637
,
0
.
283967
},
{
0
.
147437
,
0
.
383975
},
{
0
.
234237
,
0
.
483980
},
{
0
.
0457
96
,
0
.
214001
},
{
0
.
098596
,
0
.
314000
},
{
0
.
171396
,
0
.
414000
},
{
0
.
264196
,
0
.
514000
},
{
0
.
05
9600
,
0
.
244131
},
{
0
.
118400
,
0
.
344093
},
{
0
.
197200
,
0
.
444072
},
{
0
.
296000
,
0
.
544059
},
{
0
.
075470
,
0
.
274719
},
{
0
.
140270
,
0
.
374527
},
{
0
.
225070
,
0
.
474416
},
{
0
.
329870
,
0
.
574343
}
};
struct
Pair
aCos_LkUpTbl
[
ACOSCNT
]
=
{
{
-
0
.
941115
,
2
.
796710
},
{
0
.
498908
,
1
.
04
8458
},
{
0
.
201034
,
1
.
368383
},
{
-
0
.
096840
,
1
.
667788
},
{
-
0
.
394713
,
1
.
976552
},
{
0
.
378967
,
1
.
182116
},
{
0
.
040405
,
1
.
530381
},
{
-
0
.
298158
,
1
.
873559
},
{
-
0
.
636721
,
2
.
261035
},
{
0
.
219560
,
1
.
349433
},
{
-
0
.
169879
,
1
.
741503
},
{
-
0
.
559318
,
2
.
164359
},
{
-
0
.
948757
,
2
.
820075
},
{
0
.
003740
,
1
.
567056
},
{
-
0
.
450728
,
2
.
03
8377
},
{
-
0
.
905197
,
2
.
702640
},
{
0
.
000000
,
1
.
570796
},
{
-
0
.
562500
,
2
.
168203
},
{
-
0
.
343622
,
1
.
921567
},
{
-
0
.
866025
,
2
.
617994
},
{
-
0
.
458530
,
2
.
047137
}
};
struct
Pair
cos_LkUpTbl
[
COSCNT
]
=
{
{
0
.
932237
,
0
.
596040
},
{
3
.
026632
,
-
0
.
993399
},
{
5
.
121027
,
0
.
397360
},
{
0
.
349486
,
0
.
939549
},
{
2
.
443881
,
-
0
.
766314
},
{
4
.
538276
,
-
0
.
173234
},
{
0
.
456128
,
0
.
897765
},
{
2
.
550523
,
-
0
.
830345
},
{
4
.
644918
,
-
0
.
067420
},
{
0
.
555929
,
0
.
849410
},
{
2
.
650324
,
-
0
.
881735
},
{
4
.
744720
,
0
.
032325
},
{
0
.
658851
,
0
.
790696
},
{
2
.
753246
,
-
0
.
925536
},
{
4
.
847641
,
0
.
134840
},
{
0
.
394039
,
0
.
923366
},
{
2
.
488434
,
-
0
.
794168
},
{
4
.
582829
,
-
0
.
129198
},
{
0
.
510127
,
0
.
872683
},
{
2
.
604522
,
-
0
.
859211
},
{
4
.
698917
,
-
0
.
013471
},
{
0
.
624520
,
0
.
811244
},
{
2
.
718915
,
-
0
.
911994
},
{
4
.
813310
,
0
.
100750
},
{
0
.
753678
,
0
.
729177
},
{
2
.
848073
,
-
0
.
957232
},
{
4
.
942468
,
0
.
228055
},
{
0
.
449811
,
0
.
900529
},
{
2
.
544206
,
-
0
.
826808
},
{
4
.
638601
,
-
0
.
073721
},
{
0
.
580501
,
0
.
836188
},
{
2
.
674896
,
-
0
.
893060
},
{
4
.
769291
,
0
.
056
872
},
{
0
.
721453
,
0
.
750847
},
{
2
.
815848
,
-
0
.
947413
},
{
4
.
910243
,
0
.
196566
},
{
0
.
940025
,
0
.
589768
},
{
3
.
034420
,
-
0
.
994263
},
{
5
.
128815
,
0
.
404495
},
{
0
.
522352
,
0
.
866648
},
{
2
.
616747
,
-
0
.
865401
},
{
4
.
711142
,
-
0
.
001247
},
{
0
.
679459
,
0
.
777913
},
{
2
.
773854
,
-
0
.
933143
},
{
4
.
868249
,
0
.
155230
},
{
0
.
900880
,
0
.
620920
},
{
2
.
995275
,
-
0
.
989315
},
{
5
.
089670
,
0
.
368394
},
{
0
.
523599
,
0
.
866025
},
{
2
.
617994
,
-
0
.
866025
},
{
4
.
712389
,
-
0
.
000000
},
{
0
.
722734
,
0
.
750000
},
{
2
.
817129
,
-
0
.
947822
},
{
4
.
911524
,
0
.
197822
},
{
0
.
640522
,
0
.
801784
},
{
2
.
734917
,
-
0
.
918441
},
{
4
.
829313
,
0
.
116657
},
{
0
.
872665
,
0
.
642788
},
{
2
.
967060
,
-
0
.
984808
},
{
5
.
061455
,
0
.
342020
},
{
0
.
682379
,
0
.
776075
},
{
2
.
776774
,
-
0
.
934189
},
{
4
.
871169
,
0
.
158114
}
};
struct
Pair1
pow_LkUpTbl
[
POWCNT
]
=
{
{
14
.
082273
,
0
.
333333
,
2
.
414854
},
{
19
.
457121
,
0
.
333333
,
2
.
689632
},
{
170
.
099829
,
0
.
333333
,
5
.
540742
},
{
0
.
836475
,
0
.
333333
,
0
.
942217
},
{
0
.
486041
,
0
.
333333
,
0
.
786244
},
{
0
.
902751
,
0
.
333333
,
0
.
966472
},
{
0
.
310717
,
0
.
333333
,
0
.
677311
},
{
0
.
755485
,
0
.
333333
,
0
.
910770
},
{
1
.
113865
,
0
.
333333
,
1
.
0365
99
},
{
0
.
605499
,
0
.
333333
,
0
.
846001
},
{
0
.
961479
,
0
.
333333
,
0
.
986991
},
{
1
.
304951
,
0
.
333333
,
1
.
092777
},
{
0
.
452649
,
0
.
333333
,
0
.
767810
},
{
0
.
806766
,
0
.
333333
,
0
.
930928
},
{
1
.
147996
,
0
.
333333
,
1
.
0470
81
},
{
1
.
485572
,
0
.
333333
,
1
.
141032
},
{
0
.
316550
,
0
.
333333
,
0
.
681523
},
{
0
.
598444
,
0
.
333333
,
0
.
842703
},
{
0
.
859317
,
0
.
333333
,
0
.
950717
},
{
0
.
151600
,
0
.
333333
,
0
.
533211
},
{
0
.
459799
,
0
.
333333
,
0
.
771832
},
{
0
.
720148
,
0
.
333333
,
0
.
896342
},
{
0
.
974925
,
0
.
333333
,
0
.
991571
},
{
0
.
319589
,
0
.
333333
,
0
.
683697
},
{
0
.
579915
,
0
.
333333
,
0
.
833915
},
{
0
.
833775
,
0
.
333333
,
0
.
941202
},
{
1
.
085822
,
0
.
333333
,
1
.
027
826
},
{
0
.
438629
,
0
.
333333
,
0
.
759800
},
{
0
.
691603
,
0
.
333333
,
0
.
884339
},
{
0
.
942978
,
0
.
333333
,
0
.
980619
},
{
1
.
193772
,
0
.
333333
,
1
.
060
817
},
{
0
.
334477
,
0
.
333333
,
0
.
694154
},
{
0
.
588480
,
0
.
333333
,
0
.
838000
},
{
0
.
840058
,
0
.
333333
,
0
.
943561
},
{
1
.
090907
,
0
.
333333
,
1
.
02
9428
},
{
0
.
434901
,
0
.
333333
,
0
.
757641
},
{
0
.
685852
,
0
.
333333
,
0
.
881881
},
{
0
.
936293
,
0
.
333333
,
0
.
978297
},
{
1
.
186547
,
0
.
333333
,
1
.
05
8673
},
{
0
.
530790
,
0
.
333333
,
0
.
809669
},
{
0
.
780937
,
0
.
333333
,
0
.
920885
},
{
1
.
031013
,
0
.
333333
,
1
.
010233
},
{
1
.
281059
,
0
.
333333
,
1
.
086067
},
{
0
.
624986
,
0
.
333333
,
0
.
854981
},
{
0
.
874990
,
0
.
333333
,
0
.
956462
},
{
1
.
124992
,
0
.
333333
,
1
.
04003
9
},
{
1
.
374993
,
0
.
333333
,
1
.
111988
},
{
0
.
268974
,
0
.
333333
,
0
.
645511
},
{
0
.
471163
,
0
.
333333
,
0
.
778139
},
{
0
.
672033
,
0
.
333333
,
0
.
875918
},
{
0
.
872502
,
0
.
333333
,
0
.
955554
},
{
0
.
339354
,
0
.
333333
,
0
.
697511
},
{
0
.
539869
,
0
.
333333
,
0
.
814260
},
{
0
.
740105
,
0
.
333333
,
0
.
904547
},
{
0
.
940240
,
0
.
333333
,
0
.
979670
},
{
0
.
407192
,
0
.
333333
,
0
.
741196
},
{
0
.
607263
,
0
.
333333
,
0
.
846822
},
{
0
.
807299
,
0
.
333333
,
0
.
931132
},
{
1
.
007320
,
0
.
333333
,
1
.
002434
},
{
0
.
474071
,
0
.
333333
,
0
.
779736
},
{
0
.
674072
,
0
.
333333
,
0
.
876803
},
{
0
.
874073
,
0
.
333333
,
0
.
956128
},
{
1
.
074073
,
0
.
333333
,
1
.
024105
},
{
0
.
367948
,
0
.
333333
,
0
.
716576
},
{
0
.
567967
,
0
.
333333
,
0
.
828147
},
{
0
.
767975
,
0
.
333333
,
0
.
915762
},
{
0
.
967980
,
0
.
333333
,
0
.
989211
},
{
0
.
428001
,
0
.
333333
,
0
.
753613
},
{
0
.
628000
,
0
.
333333
,
0
.
856354
},
{
0
.
828000
,
0
.
333333
,
0
.
939024
},
{
1
.
02
8000
,
0
.
333333
,
1
.
00
9248
},
{
0
.
488131
,
0
.
333333
,
0
.
787370
},
{
0
.
688093
,
0
.
333333
,
0
.
882841
},
{
0
.
888072
,
0
.
333333
,
0
.
961205
},
{
1
.
088059
,
0
.
333333
,
1
.
02
8531
},
{
0
.
548719
,
0
.
333333
,
0
.
818685
},
{
0
.
748527
,
0
.
333333
,
0
.
907965
},
{
0
.
948416
,
0
.
333333
,
0
.
982501
},
{
1
.
148343
,
0
.
333333
,
1
.
0471
86
}
};
long
double
sqrt
(
long
double
in
)
{
uintptr_t
ivtmp_32
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2171
;
sqrtbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_32
=
(
uintptr_t
)
&
sQrt_LkUpTbl
[
0
].
input
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
sqrtbb_3:
// # PRED: 6 [99.0%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2171
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_32
);
if
(
D_2171
+
2.00000000000000004163336342344337026588618755341e-3
>=
in
!=
0
)
goto
sqrtbb_4
;
else
goto
sqrtbb_6
;
// # SUCC: 4 [50.0%] (true,exec) 6 [50.0%] (false,exec)
sqrtbb_4:
// # PRED: 3 [50.0%] (true,exec)
if
(
D_2171
-
2.00000000000000004163336342344337026588618755341e-3
<
in
!=
0
)
goto
sqrtbb_5
;
else
goto
sqrtbb_6
;
// # SUCC: 5 [4.5%] (true,exec) 6 [95.5%] (false,exec)
sqrtbb_5:
// # PRED: 4 [4.5%] (true,exec)
rValue
=
sQrt_LkUpTbl
[
i
].
output
;
goto
sqrtbb_7
;
// # SUCC: 7 [100.0%] (fallthru,exec)
sqrtbb_6:
// # PRED: 3 [50.0%] (false,exec) 4 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_32
=
ivtmp_32
+
16
;
if
(
i
!=
163
)
goto
sqrtbb_3
;
else
goto
sqrtbb_8
;
// # SUCC: 3 [99.0%] (true,exec) 8 [1.0%] (false,exec)
sqrtbb_8:
// # PRED: 6 [1.0%] (false,exec)
rValue
=
0
.
0
;
// # SUCC: 7 [100.0%] (fallthru)
sqrtbb_7:
// # PRED: 5 [100.0%] (fallthru,exec) 8 [100.0%] (fallthru)
return
rValue
;
// # SUCC: EXIT [100.0%]
}
long
double
acos
(
long
double
in
)
{
uintptr_t
ivtmp_64
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2190
;
acosbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_64
=
(
uintptr_t
)
&
aCos_LkUpTbl
[
0
].
input
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
acosbb_3:
// # PRED: 6 [95.5%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2190
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_64
);
if
(
D_2190
+
2.00000000000000004163336342344337026588618755341e-3
>=
in
!=
0
)
goto
acosbb_4
;
else
goto
acosbb_6
;
// # SUCC: 4 [50.0%] (true,exec) 6 [50.0%] (false,exec)
acosbb_4:
// # PRED: 3 [50.0%] (true,exec)
if
(
D_2190
-
2.00000000000000004163336342344337026588618755341e-3
<
in
!=
0
)
goto
acosbb_5
;
else
goto
acosbb_6
;
// # SUCC: 5 [4.5%] (true,exec) 6 [95.5%] (false,exec)
acosbb_5:
// # PRED: 4 [4.5%] (true,exec)
rValue
=
aCos_LkUpTbl
[
i
].
output
;
goto
acosbb_7
;
// # SUCC: 7 [100.0%] (fallthru,exec)
acosbb_6:
// # PRED: 3 [50.0%] (false,exec) 4 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_64
=
ivtmp_64
+
16
;
if
(
i
!=
21
)
goto
acosbb_3
;
else
goto
acosbb_8
;
// # SUCC: 3 [95.5%] (true,exec) 8 [4.5%] (false,exec)
acosbb_8:
// # PRED: 6 [4.5%] (false,exec)
rValue
=
0
.
0
;
// # SUCC: 7 [100.0%] (fallthru)
acosbb_7:
// # PRED: 5 [100.0%] (fallthru,exec) 8 [100.0%] (fallthru)
return
rValue
;
// # SUCC: EXIT [100.0%]
}
long
double
cos
(
long
double
in
)
{
uintptr_t
ivtmp_95
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2209
;
cosbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_95
=
(
uintptr_t
)
&
cos_LkUpTbl
[
0
].
input
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
cosbb_3:
// # PRED: 6 [98.4%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2209
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_95
);
if
(
D_2209
+
2.00000000000000004163336342344337026588618755341e-3
>=
in
!=
0
)
goto
cosbb_4
;
else
goto
cosbb_6
;
// # SUCC: 4 [50.0%] (true,exec) 6 [50.0%] (false,exec)
cosbb_4:
// # PRED: 3 [50.0%] (true,exec)
if
(
D_2209
-
2.00000000000000004163336342344337026588618755341e-3
<
in
!=
0
)
goto
cosbb_5
;
else
goto
cosbb_6
;
// # SUCC: 5 [4.5%] (true,exec) 6 [95.5%] (false,exec)
cosbb_5:
// # PRED: 4 [4.5%] (true,exec)
rValue
=
cos_LkUpTbl
[
i
].
output
;
goto
cosbb_7
;
// # SUCC: 7 [100.0%] (fallthru,exec)
cosbb_6:
// # PRED: 3 [50.0%] (false,exec) 4 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_95
=
ivtmp_95
+
16
;
if
(
i
!=
63
)
goto
cosbb_3
;
else
goto
cosbb_8
;
// # SUCC: 3 [98.4%] (true,exec) 8 [1.6%] (false,exec)
cosbb_8:
// # PRED: 6 [1.6%] (false,exec)
rValue
=
0
.
0
;
// # SUCC: 7 [100.0%] (fallthru)
cosbb_7:
// # PRED: 5 [100.0%] (fallthru,exec) 8 [100.0%] (fallthru)
return
rValue
;
// # SUCC: EXIT [100.0%]
}
long
double
pow
(
long
double
in1
,
long
double
in2
)
{
uintptr_t
ivtmp_126
;
long
double
rValue
;
unsigned
int
i
;
long
double
D_2238
;
long
double
D_2229
;
powbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_126
=
(
uintptr_t
)
&
pow_LkUpTbl
[
0
].
input1
;
i
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
powbb_3:
// # PRED: 8 [98.8%] (true,exec) 2 [100.0%] (fallthru,exec)
D_2229
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_126
);
if
(
D_2229
+
2.00000000000000004163336342344337026588618755341e-3
>=
in1
!=
0
)
goto
powbb_4
;
else
goto
powbb_8
;
// # SUCC: 4 [50.0%] (true,exec) 8 [50.0%] (false,exec)
powbb_4:
// # PRED: 3 [50.0%] (true,exec)
if
(
D_2229
-
2.00000000000000004163336342344337026588618755341e-3
<
in1
!=
0
)
goto
powbb_5
;
else
goto
powbb_8
;
// # SUCC: 5 [50.0%] (true,exec) 8 [50.0%] (false,exec)
powbb_5:
// # PRED: 4 [50.0%] (true,exec)
D_2238
=
*
(
long
double
*
)((
uintptr_t
)
ivtmp_126
+
8
);
if
(
D_2238
+
2.00000000000000004163336342344337026588618755341e-3
>=
in2
!=
0
)
goto
powbb_6
;
else
goto
powbb_8
;
// # SUCC: 6 [50.0%] (true,exec) 8 [50.0%] (false,exec)
powbb_6:
// # PRED: 5 [50.0%] (true,exec)
if
(
D_2238
-
2.00000000000000004163336342344337026588618755341e-3
<
in2
!=
0
)
goto
powbb_7
;
else
goto
powbb_8
;
// # SUCC: 7 [4.5%] (true,exec) 8 [95.5%] (false,exec)
powbb_7:
// # PRED: 6 [4.5%] (true,exec)
rValue
=
pow_LkUpTbl
[
i
].
output
;
goto
powbb_9
;
// # SUCC: 9 [100.0%] (fallthru,exec)
powbb_8:
// # PRED: 3 [50.0%] (false,exec) 4 [50.0%] (false,exec) 5 [50.0%] (false,exec) 6 [95.5%] (false,exec)
i
=
i
+
1
;
ivtmp_126
=
ivtmp_126
+
24
;
if
(
i
!=
79
)
goto
powbb_3
;
else
goto
powbb_10
;
// # SUCC: 3 [98.8%] (true,exec) 10 [1.2%] (false,exec)
powbb_10:
// # PRED: 8 [1.2%] (false,exec)
rValue
=
0
.
0
;
// # SUCC: 9 [100.0%] (fallthru)
powbb_9:
// # PRED: 7 [100.0%] (fallthru,exec) 10 [100.0%] (fallthru)
return
rValue
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/basicmath/rad2deg_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
basicmath/app_dir/rad2deg.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/* +++Date last modified: 05-Jul-1997 */
/*
** RAD2DEG.C - Functions to convert between radians and degrees
*/
#include <math.h>
#include "snipmath.h"
#undef rad2deg
/* These are macros defined in PI.H */
#undef deg2rad
double
rad2deg
(
double
rad
)
{
rad2degbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
return
(
rad
*
1.8e+2
)
/
3.14159265358979311599796346854418516159057617188e+0
;
// # SUCC: EXIT [100.0%]
}
double
deg2rad
(
double
deg
)
{
deg2radbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
return
(
deg
*
3.14159265358979311599796346854418516159057617188e+0
)
/
1.8e+2
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/crc32/crc_32_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
crc32/app_dir/crc_32.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/* +++Date last modified: 05-Jul-1997 */
/* Crc - 32 BIT ANSI X3.66 CRC checksum files */
#include "crc.h"
//#include "my_defines.h"
extern
unsigned
int
ARR_SIZE
;
#ifdef __TURBOC__
#pragma warn -cln
#endif
/**********************************************************************\
|* Demonstration program to compute the 32-bit CRC used as the frame *|
|* check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 *|
|* and FED-STD-1003, the U.S. versions of CCITT's X.25 link-level *|
|* protocol). The 32-bit FCS was added via the Federal Register, *|
|* 1 June 1982, p.23798. I presume but don't know for certain that *|
|* this polynomial is or will be included in CCITT V.41, which *|
|* defines the 16-bit CRC (often called CRC-CCITT) polynomial. FIPS *|
|* PUB 78 says that the 32-bit FCS reduces otherwise undetected *|
|* errors by a factor of 10^-5 over 16-bit FCS. *|
\**********************************************************************/
/* Need an unsigned type capable of holding 32 bits; */
typedef
DWORD
UNS_32_BITS
;
#define MY_LOOP 50
/* Copyright (C) 1986 Gary S. Brown. You may use this program, or
code or tables extracted from it, as desired without restriction.*/
/* First, the polynomial itself and its table of feedback terms. The */
/* polynomial is */
/* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
/* Note that we take it "backwards" and put the highest-order term in */
/* the lowest-order bit. The X^32 term is "implied"; the LSB is the */
/* X^31 term, etc. The X^0 term (usually shown as "+1") results in */
/* the MSB being 1. */
/* Note that the usual hardware shift register implementation, which */
/* is what we're using (we're merely optimizing it by doing eight-bit */
/* chunks at a time) shifts bits into the lowest-order term. In our */
/* implementation, that means shifting towards the right. Why do we */
/* do it this way? Because the calculated CRC must be transmitted in */
/* order from highest-order term to lowest-order term. UARTs transmit */
/* characters in order from LSB to MSB. By storing the CRC this way, */
/* we hand it to the UART in the order low-byte to high-byte; the UART */
/* sends each low-bit to hight-bit; and the result is transmission bit */
/* by bit from highest- to lowest-order term without requiring any bit */
/* shuffling on our part. Reception works similarly. */
/* The feedback terms table consists of 256, 32-bit entries. Notes: */
/* */
/* 1. The table can be generated at runtime if desired; code to do so */
/* is shown later. It might not be obvious, but the feedback */
/* terms simply represent the results of eight shift/xor opera- */
/* tions for all combinations of data and CRC register values. */
/* */
/* 2. The CRC accumulation logic is the same for all CRC polynomials, */
/* be they sixteen or thirty-two bits wide. You simply choose the */
/* appropriate table. Alternatively, because the table can be */
/* generated at runtime, you can start by generating the table for */
/* the polynomial in question and use exactly the same "updcrc", */
/* if your application needn't simultaneously handle two CRC */
/* polynomials. (Note, however, that XMODEM is strange.) */
/* */
/* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */
/* of course, 32-bit entries work OK if the high 16 bits are zero. */
/* */
/* 4. The values must be right-shifted by eight bits by the "updcrc" */
/* logic; the shift must be unsigned (bring in zeroes). On some */
/* hardware you could probably optimize the shift in assembler by */
/* using byte-swap instructions. */
static
UNS_32_BITS
crc_32_tab
[]
=
{
/* CRC polynomial 0xedb88320 */
0x00000000
,
0x77073096
,
0xee0e612c
,
0x990951ba
,
0x076dc419
,
0x706af48f
,
0xe963a535
,
0x9e6495a3
,
0x0edb8832
,
0x79dcb8a4
,
0xe0d5e91e
,
0x97d2d988
,
0x09b64c2b
,
0x7eb17cbd
,
0xe7b82d07
,
0x90bf1d91
,
0x1db71064
,
0x6ab020f2
,
0xf3b97148
,
0x84be41de
,
0x1adad47d
,
0x6ddde4eb
,
0xf4d4b551
,
0x83d385c7
,
0x136c9856
,
0x646ba8c0
,
0xfd62f97a
,
0x8a65c9ec
,
0x14015c4f
,
0x63066cd9
,
0xfa0f3d63
,
0x8d080df5
,
0x3b6e20c8
,
0x4c69105e
,
0xd56041e4
,
0xa2677172
,
0x3c03e4d1
,
0x4b04d447
,
0xd20d85fd
,
0xa50ab56b
,
0x35b5a8fa
,
0x42b2986c
,
0xdbbbc9d6
,
0xacbcf940
,
0x32d86ce3
,
0x45df5c75
,
0xdcd60dcf
,
0xabd13d59
,
0x26d930ac
,
0x51de003a
,
0xc8d75180
,
0xbfd06116
,
0x21b4f4b5
,
0x56b3c423
,
0xcfba9599
,
0xb8bda50f
,
0x2802b89e
,
0x5f058808
,
0xc60cd9b2
,
0xb10be924
,
0x2f6f7c87
,
0x58684c11
,
0xc1611dab
,
0xb6662d3d
,
0x76dc4190
,
0x01db7106
,
0x98d220bc
,
0xefd5102a
,
0x71b18589
,
0x06b6b51f
,
0x9fbfe4a5
,
0xe8b8d433
,
0x7807c9a2
,
0x0f00f934
,
0x9609a88e
,
0xe10e9818
,
0x7f6a0dbb
,
0x086d3d2d
,
0x91646c97
,
0xe6635c01
,
0x6b6b51f4
,
0x1c6c6162
,
0x856530d8
,
0xf262004e
,
0x6c0695ed
,
0x1b01a57b
,
0x8208f4c1
,
0xf50fc457
,
0x65b0d9c6
,
0x12b7e950
,
0x8bbeb8ea
,
0xfcb9887c
,
0x62dd1ddf
,
0x15da2d49
,
0x8cd37cf3
,
0xfbd44c65
,
0x4db26158
,
0x3ab551ce
,
0xa3bc0074
,
0xd4bb30e2
,
0x4adfa541
,
0x3dd895d7
,
0xa4d1c46d
,
0xd3d6f4fb
,
0x4369e96a
,
0x346ed9fc
,
0xad678846
,
0xda60b8d0
,
0x44042d73
,
0x33031de5
,
0xaa0a4c5f
,
0xdd0d7cc9
,
0x5005713c
,
0x270241aa
,
0xbe0b1010
,
0xc90c2086
,
0x5768b525
,
0x206f85b3
,
0xb966d409
,
0xce61e49f
,
0x5edef90e
,
0x29d9c998
,
0xb0d09822
,
0xc7d7a8b4
,
0x59b33d17
,
0x2eb40d81
,
0xb7bd5c3b
,
0xc0ba6cad
,
0xedb88320
,
0x9abfb3b6
,
0x03b6e20c
,
0x74b1d29a
,
0xead54739
,
0x9dd277af
,
0x04db2615
,
0x73dc1683
,
0xe3630b12
,
0x94643b84
,
0x0d6d6a3e
,
0x7a6a5aa8
,
0xe40ecf0b
,
0x9309ff9d
,
0x0a00ae27
,
0x7d079eb1
,
0xf00f9344
,
0x8708a3d2
,
0x1e01f268
,
0x6906c2fe
,
0xf762575d
,
0x806567cb
,
0x196c3671
,
0x6e6b06e7
,
0xfed41b76
,
0x89d32be0
,
0x10da7a5a
,
0x67dd4acc
,
0xf9b9df6f
,
0x8ebeeff9
,
0x17b7be43
,
0x60b08ed5
,
0xd6d6a3e8
,
0xa1d1937e
,
0x38d8c2c4
,
0x4fdff252
,
0xd1bb67f1
,
0xa6bc5767
,
0x3fb506dd
,
0x48b2364b
,
0xd80d2bda
,
0xaf0a1b4c
,
0x36034af6
,
0x41047a60
,
0xdf60efc3
,
0xa867df55
,
0x316e8eef
,
0x4669be79
,
0xcb61b38c
,
0xbc66831a
,
0x256fd2a0
,
0x5268e236
,
0xcc0c7795
,
0xbb0b4703
,
0x220216b9
,
0x5505262f
,
0xc5ba3bbe
,
0xb2bd0b28
,
0x2bb45a92
,
0x5cb36a04
,
0xc2d7ffa7
,
0xb5d0cf31
,
0x2cd99e8b
,
0x5bdeae1d
,
0x9b64c2b0
,
0xec63f226
,
0x756aa39c
,
0x026d930a
,
0x9c0906a9
,
0xeb0e363f
,
0x72076785
,
0x05005713
,
0x95bf4a82
,
0xe2b87a14
,
0x7bb12bae
,
0x0cb61b38
,
0x92d28e9b
,
0xe5d5be0d
,
0x7cdcefb7
,
0x0bdbdf21
,
0x86d3d2d4
,
0xf1d4e242
,
0x68ddb3f8
,
0x1fda836e
,
0x81be16cd
,
0xf6b9265b
,
0x6fb077e1
,
0x18b74777
,
0x88085ae6
,
0xff0f6a70
,
0x66063bca
,
0x11010b5c
,
0x8f659eff
,
0xf862ae69
,
0x616bffd3
,
0x166ccf45
,
0xa00ae278
,
0xd70dd2ee
,
0x4e048354
,
0x3903b3c2
,
0xa7672661
,
0xd06016f7
,
0x4969474d
,
0x3e6e77db
,
0xaed16a4a
,
0xd9d65adc
,
0x40df0b66
,
0x37d83bf0
,
0xa9bcae53
,
0xdebb9ec5
,
0x47b2cf7f
,
0x30b5ffe9
,
0xbdbdf21c
,
0xcabac28a
,
0x53b39330
,
0x24b4a3a6
,
0xbad03605
,
0xcdd70693
,
0x54de5729
,
0x23d967bf
,
0xb3667a2e
,
0xc4614ab8
,
0x5d681b02
,
0x2a6f2b94
,
0xb40bbe37
,
0xc30c8ea1
,
0x5a05df1b
,
0x2d02ef8d
};
DWORD
updateCRC32
(
unsigned
char
ch
,
DWORD
crc
)
{
updateCRC32bb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
return
crc_32_tab
[(
crc
^
(
long
unsigned
int
)
ch
)
&
255
]
^
crc
>>
8
;
// # SUCC: EXIT [100.0%]
}
Boolean_T
crc32file
(
char
*
name
,
DWORD
*
crc
,
long
int
*
charcnt
)
{
long
unsigned
int
temp_52
;
long
unsigned
int
temp_50
;
register
DWORD
oldcrc32
;
long
unsigned
int
D_2020
;
DWORD
D_2019
;
UNS_32_BITS
D_2018
;
char
D_2012
;
crc32filebb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
*
charcnt
=
0
;
if
(
ARR_SIZE
!=
0
)
goto
crc32filebb_6
;
else
goto
crc32filebb_7
;
// # SUCC: 6 [91.0%] (true,exec) 7 [9.0%] (false,exec)
crc32filebb_6:
// # PRED: 2 [91.0%] (true,exec)
temp_50
=
1
;
temp_52
=
0
;
oldcrc32
=
4294967295
;
// # SUCC: 3 [100.0%] (fallthru)
crc32filebb_3:
// # PRED: 5 [100.0%] (fallthru) 6 [100.0%] (fallthru)
D_2012
=
*
(
char
*
)((
uintptr_t
)
name
+
temp_52
);
*
charcnt
=
(
long
int
)
(
long
int
)
temp_50
;
D_2018
=
crc_32_tab
[((
long
unsigned
int
)
D_2012
^
oldcrc32
)
&
255
];
D_2019
=
oldcrc32
>>
8
;
oldcrc32
=
D_2018
^
D_2019
;
D_2020
=
temp_50
+
1
;
if
(
ARR_SIZE
>
temp_50
)
goto
crc32filebb_5
;
else
goto
crc32filebb_4
;
// # SUCC: 5 [91.0%] (true,exec) 4 [9.0%] (false,exec)
crc32filebb_5:
// # PRED: 3 [91.0%] (true,exec)
temp_52
=
temp_50
;
temp_50
=
D_2020
;
goto
crc32filebb_3
;
// # SUCC: 3 [100.0%] (fallthru)
crc32filebb_7:
// # PRED: 2 [9.0%] (false,exec)
oldcrc32
=
4294967295
;
// # SUCC: 4 [100.0%] (fallthru)
crc32filebb_4:
// # PRED: 3 [9.0%] (false,exec) 7 [100.0%] (fallthru)
*
crc
=
oldcrc32
=
~
oldcrc32
;
return
0
;
// # SUCC: EXIT [100.0%]
}
DWORD
crc32buf
(
char
*
buf
,
size_t
len
)
{
uintptr_t
ivtmp_76
;
register
DWORD
oldcrc32
;
DWORD
D_2036
;
UNS_32_BITS
D_2035
;
crc32bufbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
if
(
len
!=
0
)
goto
crc32bufbb_5
;
else
goto
crc32bufbb_6
;
// # SUCC: 5 [91.0%] (true,exec) 6 [9.0%] (false,exec)
crc32bufbb_6:
// # PRED: 2 [9.0%] (false,exec)
oldcrc32
=
4294967295
;
goto
crc32bufbb_4
;
// # SUCC: 4 [100.0%] (fallthru)
crc32bufbb_5:
// # PRED: 2 [91.0%] (true,exec)
ivtmp_76
=
0
;
oldcrc32
=
4294967295
;
// # SUCC: 3 [100.0%] (fallthru)
crc32bufbb_3:
// # PRED: 3 [91.0%] (true,exec) 5 [100.0%] (fallthru)
D_2035
=
crc_32_tab
[(
oldcrc32
^
(
long
unsigned
int
)
*
(
char
*
)((
uintptr_t
)
buf
+
(
uintptr_t
)
ivtmp_76
))
&
255
];
D_2036
=
oldcrc32
>>
8
;
oldcrc32
=
D_2035
^
D_2036
;
ivtmp_76
=
ivtmp_76
+
1
;
if
(
ivtmp_76
!=
len
)
goto
crc32bufbb_3
;
else
goto
crc32bufbb_4
;
// # SUCC: 3 [91.0%] (true,exec) 4 [9.0%] (false,exec)
crc32bufbb_4:
// # PRED: 3 [9.0%] (false,exec) 6 [100.0%] (fallthru)
return
~
oldcrc32
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/crc32/crc_top_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
crc32/app_dir/crc_top.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
#include "crc.h"
#include <stdio.h>
#include "in_data.h"
//#include "in_large.h"
#include "my_variables.h"
DWORD
my_crc
;
long
int
my_charcnt
;
int
main
()
{
Boolean_T
D_2724
;
mainbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
D_2724
=
crc32file
(
&
in_Data
,
&
my_crc
,
&
my_charcnt
);
return
(
int
)
D_2724
!=
0
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/sha/my_mem_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
sha/app_dir/my_mem.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/*
Author - Suhas Chakravarty
memcpy implementation taken from
www.danielvik.com/2010/02/fast-memcpy-in-c.html
Renamed to my_memcpy
Created - 17 Nov 2012
Last modified - 17 Nov 2012
*/
#include <stdlib.h>
void
*
my_memcpy
(
void
*
dest
,
const
void
*
src
,
size_t
count
)
{
uintptr_t
ivtmp_23
;
my_memcpybb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
if
(
count
!=
0
)
goto
my_memcpybb_5
;
else
goto
my_memcpybb_4
;
// # SUCC: 5 [91.0%] (true,exec) 4 [9.0%] (false,exec)
my_memcpybb_5:
// # PRED: 2 [91.0%] (true,exec)
ivtmp_23
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
my_memcpybb_3:
// # PRED: 3 [91.0%] (true,exec) 5 [100.0%] (fallthru)
*
(
char
*
)((
uintptr_t
)
dest
+
(
uintptr_t
)
ivtmp_23
)
=
*
(
char
*
)((
uintptr_t
)
src
+
(
uintptr_t
)
ivtmp_23
);
ivtmp_23
=
ivtmp_23
+
1
;
if
(
ivtmp_23
!=
count
)
goto
my_memcpybb_3
;
else
goto
my_memcpybb_4
;
// # SUCC: 3 [91.0%] (true,exec) 4 [9.0%] (false,exec)
my_memcpybb_4:
// # PRED: 3 [9.0%] (false,exec) 2 [9.0%] (false,exec)
return
(
uintptr_t
)
dest
;
// # SUCC: EXIT [100.0%]
}
void
*
my_memset
(
void
*
s
,
int
c
,
size_t
n
)
{
uintptr_t
ivtmp_56
;
my_memsetbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
if
(
n
!=
0
)
goto
my_memsetbb_5
;
else
goto
my_memsetbb_4
;
// # SUCC: 5 [91.0%] (true,exec) 4 [9.0%] (false,exec)
my_memsetbb_5:
// # PRED: 2 [91.0%] (true,exec)
ivtmp_56
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
my_memsetbb_3:
// # PRED: 3 [91.0%] (true,exec) 5 [100.0%] (fallthru)
*
(
char
*
)((
uintptr_t
)
s
+
(
uintptr_t
)
ivtmp_56
)
=
(
char
)
(
char
)
c
;
ivtmp_56
=
ivtmp_56
+
1
;
if
(
ivtmp_56
!=
n
)
goto
my_memsetbb_3
;
else
goto
my_memsetbb_4
;
// # SUCC: 3 [91.0%] (true,exec) 4 [9.0%] (false,exec)
my_memsetbb_4:
// # PRED: 3 [9.0%] (false,exec) 2 [9.0%] (false,exec)
return
(
uintptr_t
)
s
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/sha/sha_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
sha/app_dir/sha.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/* NIST Secure Hash Algorithm */
/* heavily modified by Uwe Hollerbach uh@alumni.caltech edu */
/* from Peter C. Gutmann's implementation as found in */
/* Applied Cryptography by Bruce Schneier */
/* NIST's proposed modification to SHA of 7/11/94 may be */
/* activated by defining USE_MODIFIED_SHA */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "sha.h"
#include "my_mem.h"
//#include "my_defines.h"
//#include "my_variable.h"
/* SHA f()-functions */
extern
unsigned
int
ARR_SIZE
;
#define f1(x,y,z) ((x & y) | (~x & z))
#define f2(x,y,z) (x ^ y ^ z)
#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
#define f4(x,y,z) (x ^ y ^ z)
/* SHA constants */
#define CONST1 0x5a827999L
#define CONST2 0x6ed9eba1L
#define CONST3 0x8f1bbcdcL
#define CONST4 0xca62c1d6L
/* 32-bit rotate */
#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
#define FUNC(n,i) \
temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
E = D; D = C; C = ROT32(B,30); B = A; A = temp
/* do SHA transformation */
static
void
sha_transform
(
SHA_INFO
*
sha_info
)
{
LONG
A_133
;
LONG
E_132
;
LONG
D_131
;
LONG
B_130
;
LONG
A_129
;
LONG
E_128
;
LONG
D_127
;
LONG
B_126
;
LONG
A_125
;
LONG
E_124
;
LONG
E_123
;
LONG
D_122
;
LONG
D_121
;
LONG
B_120
;
LONG
B_119
;
LONG
A_118
;
LONG
A_117
;
uintptr_t
ivtmp_116
;
uintptr_t
ivtmp_115
;
LONG
C_114
;
LONG
temp_113
;
LONG
C_105
;
LONG
temp_104
;
LONG
C_101
;
LONG
temp_100
;
LONG
C_97
;
uintptr_t
ivtmp_94
;
uintptr_t
ivtmp_93
;
uintptr_t
D_2941
;
uintptr_t
ivtmp_79
;
uintptr_t
ivtmp_71
;
uintptr_t
D_2918
;
uintptr_t
ivtmp_63
;
LONG
W
[
80
];
LONG
E
;
LONG
D
;
LONG
C
;
LONG
B
;
LONG
A
;
LONG
temp
;
sha_transformbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ivtmp_94
=
(
uintptr_t
)
sha_info
;
ivtmp_93
=
0
;
// # SUCC: 3 [100.0%] (fallthru,exec)
sha_transformbb_3:
// # PRED: 3 [94.1%] (true,exec) 2 [100.0%] (fallthru,exec)
*
(
LONG
*
)((
uintptr_t
)
&
W
+
(
uintptr_t
)
ivtmp_93
)
=
*
(
LONG
*
)((
uintptr_t
)
ivtmp_94
+
28
);
ivtmp_93
=
ivtmp_93
+
4
;
ivtmp_94
=
ivtmp_94
+
4
;
if
(
ivtmp_93
!=
64
)
goto
sha_transformbb_3
;
else
goto
sha_transformbb_4
;
// # SUCC: 3 [94.1%] (true,exec) 4 [5.9%] (false,exec)
sha_transformbb_4:
// # PRED: 3 [5.9%] (false,exec)
ivtmp_79
=
(
uintptr_t
)
&
W
[
13
];
ivtmp_63
=
(
uintptr_t
)
&
W
;
D_2941
=
ivtmp_63
+
308
;
// # SUCC: 5 [100.0%] (fallthru,exec)
sha_transformbb_5:
// # PRED: 5 [98.5%] (true,exec) 4 [100.0%] (fallthru,exec)
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
12
)
=
((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
(
int
)
4294967276
)
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
))
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
(
int
)
4294967252
))
^
*
(
LONG
*
)((
uintptr_t
)
ivtmp_79
+
(
int
)
4294967244
);
ivtmp_79
=
ivtmp_79
+
4
;
if
(
ivtmp_79
!=
D_2941
)
goto
sha_transformbb_5
;
else
goto
sha_transformbb_6
;
// # SUCC: 5 [98.5%] (true,exec) 6 [1.5%] (false,exec)
sha_transformbb_6:
// # PRED: 5 [1.5%] (false,exec)
A
=
sha_info
->
digest
[
0
];
B
=
sha_info
->
digest
[
1
];
C
=
sha_info
->
digest
[
2
];
D
=
sha_info
->
digest
[
3
];
E
=
sha_info
->
digest
[
4
];
A_133
=
A
;
ivtmp_71
=
0
;
// # SUCC: 7 [100.0%] (fallthru,exec)
sha_transformbb_7:
// # PRED: 13 [100.0%] (fallthru) 6 [100.0%] (fallthru,exec)
temp
=
(((
*
(
LONG
*
)((
uintptr_t
)
&
W
+
(
uintptr_t
)
ivtmp_71
)
+
1518500249
)
+
E
)
+
((
A_133
<<
27
)
|
(
A_133
>>
(
sizeof
(
A_133
)
*
CHAR_BIT
-
27
))))
+
(
~
B
&
D
|
C
&
B
);
C_97
=
(
B
<<
2
)
|
(
B
>>
(
sizeof
(
B
)
*
CHAR_BIT
-
2
));
ivtmp_71
=
ivtmp_71
+
4
;
if
(
ivtmp_71
!=
80
)
goto
sha_transformbb_13
;
else
goto
sha_transformbb_8
;
// # SUCC: 13 [95.2%] (true,exec) 8 [4.8%] (false,exec)
sha_transformbb_13:
// # PRED: 7 [95.2%] (true,exec)
E
=
D
;
D
=
C
;
C
=
C_97
;
B
=
A_133
;
A_133
=
temp
;
goto
sha_transformbb_7
;
// # SUCC: 7 [100.0%] (fallthru)
sha_transformbb_8:
// # PRED: 7 [4.8%] (false,exec)
D_2918
=
ivtmp_63
+
80
;
ivtmp_116
=
ivtmp_63
;
E_132
=
D
;
D_131
=
C
;
B_130
=
A_133
;
A_129
=
temp
;
// # SUCC: 9 [100.0%] (fallthru,exec)
sha_transformbb_9:
// # PRED: 14 [100.0%] (fallthru) 8 [100.0%] (fallthru,exec)
temp_100
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_116
+
80
)
+
1859775393
)
+
E_132
)
+
((
A_129
<<
27
)
|
(
A_129
>>
(
sizeof
(
A_129
)
*
CHAR_BIT
-
27
))))
+
((
C_97
^
B_130
)
^
D_131
);
C_101
=
(
B_130
<<
2
)
|
(
B_130
>>
(
sizeof
(
B_130
)
*
CHAR_BIT
-
2
));
ivtmp_116
=
ivtmp_116
+
4
;
if
(
ivtmp_116
!=
D_2918
)
goto
sha_transformbb_14
;
else
goto
sha_transformbb_16
;
// # SUCC: 14 [95.2%] (true,exec) 16 [4.8%] (false,exec)
sha_transformbb_16:
// # PRED: 9 [4.8%] (false,exec)
ivtmp_115
=
ivtmp_63
;
E_128
=
D_131
;
D_127
=
C_97
;
B_126
=
A_129
;
A_125
=
temp_100
;
goto
sha_transformbb_10
;
// # SUCC: 10 [100.0%] (fallthru)
sha_transformbb_14:
// # PRED: 9 [95.2%] (true,exec)
E_132
=
D_131
;
D_131
=
C_97
;
C_97
=
C_101
;
B_130
=
A_129
;
A_129
=
temp_100
;
goto
sha_transformbb_9
;
// # SUCC: 9 [100.0%] (fallthru)
sha_transformbb_15:
// # PRED: 10 [95.2%] (true,exec)
E_128
=
D_127
;
D_127
=
C_101
;
C_101
=
C_105
;
B_126
=
A_125
;
A_125
=
temp_104
;
// # SUCC: 10 [100.0%] (fallthru)
sha_transformbb_10:
// # PRED: 15 [100.0%] (fallthru) 16 [100.0%] (fallthru)
temp_104
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_115
+
160
)
+
(
int
)
2400959708
)
+
E_128
)
+
((
A_125
<<
27
)
|
(
A_125
>>
(
sizeof
(
A_125
)
*
CHAR_BIT
-
27
))))
+
((
D_127
|
C_101
)
&
B_126
|
D_127
&
C_101
);
C_105
=
(
B_126
<<
2
)
|
(
B_126
>>
(
sizeof
(
B_126
)
*
CHAR_BIT
-
2
));
ivtmp_115
=
ivtmp_115
+
4
;
if
(
ivtmp_115
!=
D_2918
)
goto
sha_transformbb_15
;
else
goto
sha_transformbb_18
;
// # SUCC: 15 [95.2%] (true,exec) 18 [4.8%] (false,exec)
sha_transformbb_18:
// # PRED: 10 [4.8%] (false,exec)
E_123
=
D_127
;
D_121
=
C_101
;
B_119
=
A_125
;
A_117
=
temp_104
;
// # SUCC: 11 [100.0%] (fallthru)
sha_transformbb_11:
// # PRED: 17 [100.0%] (fallthru) 18 [100.0%] (fallthru)
temp_113
=
(((
*
(
LONG
*
)((
uintptr_t
)
ivtmp_63
+
240
)
+
(
int
)
3395469782
)
+
E_123
)
+
((
A_117
<<
27
)
|
(
A_117
>>
(
sizeof
(
A_117
)
*
CHAR_BIT
-
27
))))
+
((
C_105
^
B_119
)
^
D_121
);
C_114
=
(
B_119
<<
2
)
|
(
B_119
>>
(
sizeof
(
B_119
)
*
CHAR_BIT
-
2
));
ivtmp_63
=
ivtmp_63
+
4
;
if
(
ivtmp_63
!=
D_2918
)
goto
sha_transformbb_17
;
else
goto
sha_transformbb_19
;
// # SUCC: 17 [95.2%] (true,exec) 19 [4.8%] (false,exec)
sha_transformbb_17:
// # PRED: 11 [95.2%] (true,exec)
E_123
=
D_121
;
D_121
=
C_105
;
C_105
=
C_114
;
B_119
=
A_117
;
A_117
=
temp_113
;
goto
sha_transformbb_11
;
// # SUCC: 11 [100.0%] (fallthru)
sha_transformbb_19:
// # PRED: 11 [4.8%] (false,exec)
E_124
=
D_121
;
D_122
=
C_105
;
B_120
=
A_117
;
A_118
=
temp_113
;
// # SUCC: 12 [100.0%] (fallthru)
sha_transformbb_12:
// # PRED: 19 [100.0%] (fallthru)
sha_info
->
digest
[
0
]
=
A_118
+
A
;
sha_info
->
digest
[
1
]
=
B_120
+
sha_info
->
digest
[
1
];
sha_info
->
digest
[
2
]
=
C_114
+
sha_info
->
digest
[
2
];
sha_info
->
digest
[
3
]
=
D_122
+
sha_info
->
digest
[
3
];
sha_info
->
digest
[
4
]
=
E_124
+
sha_info
->
digest
[
4
];
return
;
// # SUCC: EXIT [100.0%]
}
void
sha_init
(
SHA_INFO
*
sha_info
)
{
sha_initbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
sha_info
->
digest
[
0
]
=
1732584193
;
sha_info
->
digest
[
1
]
=
4023233417
;
sha_info
->
digest
[
2
]
=
2562383102
;
sha_info
->
digest
[
3
]
=
271733878
;
sha_info
->
digest
[
4
]
=
3285377520
;
sha_info
->
count_lo
=
0
;
sha_info
->
count_hi
=
0
;
return
;
// # SUCC: EXIT [100.0%]
}
void
sha_print
(
SHA_INFO
*
sha_info
)
{
sha_printbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
printf
(
&
"%08lx %08lx %08lx %08lx %08lx
\n
"
[
0
],
sha_info
->
digest
[
0
],
sha_info
->
digest
[
1
],
sha_info
->
digest
[
2
],
sha_info
->
digest
[
3
],
sha_info
->
digest
[
4
]);
return
;
// # SUCC: EXIT [100.0%]
}
void
sha_final
(
SHA_INFO
*
sha_info
)
{
int
count_203
;
LONG
hi_bit_count
;
LONG
lo_bit_count
;
int
count
;
LONG
*
D_2806
;
sha_finalbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
lo_bit_count
=
sha_info
->
count_lo
;
hi_bit_count
=
sha_info
->
count_hi
;
count
=
(
int
)
(
lo_bit_count
>>
3
)
&
63
;
D_2806
=
&
sha_info
->
data
;
*
(
BYTE
*
)(
(
uintptr_t
)
D_2806
+
(
unsigned
int
)
count
)
=
128
;
count_203
=
count
+
1
;
if
(
count_203
>
56
)
goto
sha_finalbb_3
;
else
goto
sha_finalbb_4
;
// # SUCC: 3 [39.0%] (true,exec) 4 [61.0%] (false,exec)
sha_finalbb_3:
// # PRED: 2 [39.0%] (true,exec)
my_memset
(
D_2806
+
(
unsigned
int
)
count_203
,
0
,
(
size_t
)
(
64
-
count_203
));
sha_transform
(
sha_info
);
my_memset
(
D_2806
,
0
,
56
);
goto
sha_finalbb_5
;
// # SUCC: 5 [100.0%] (fallthru,exec)
sha_finalbb_4:
// # PRED: 2 [61.0%] (false,exec)
my_memset
(
D_2806
+
(
unsigned
int
)
count_203
,
0
,
(
size_t
)
(
56
-
count_203
));
// # SUCC: 5 [100.0%] (fallthru,exec)
sha_finalbb_5:
// # PRED: 3 [100.0%] (fallthru,exec) 4 [100.0%] (fallthru,exec)
sha_info
->
data
[
14
]
=
hi_bit_count
;
sha_info
->
data
[
15
]
=
lo_bit_count
;
sha_transform
(
sha_info
);
return
;
// # SUCC: EXIT [100.0%]
}
void
sha_update
(
SHA_INFO
*
sha_info
,
BYTE
*
buffer
,
int
count
)
{
uintptr_t
D_3104
;
uintptr_t
ivtmp_232
;
int
D_3090
;
uintptr_t
D_3087
;
LONG
*
D_2796
;
long
unsigned
int
D_2788
;
long
unsigned
int
count_1
;
LONG
D_2786
;
sha_updatebb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
D_2786
=
sha_info
->
count_lo
;
count_1
=
(
long
unsigned
int
)
count
;
D_2788
=
count_1
<<
3
;
if
(
D_2786
>
D_2788
+
D_2786
)
goto
sha_updatebb_3
;
else
goto
sha_updatebb_4
;
// # SUCC: 3 [50.0%] (true,exec) 4 [50.0%] (false,exec)
sha_updatebb_3:
// # PRED: 2 [50.0%] (true,exec)
sha_info
->
count_hi
=
sha_info
->
count_hi
+
1
;
// # SUCC: 4 [100.0%] (fallthru,exec)
sha_updatebb_4:
// # PRED: 2 [50.0%] (false,exec) 3 [100.0%] (fallthru,exec)
sha_info
->
count_lo
=
D_2788
+
sha_info
->
count_lo
;
sha_info
->
count_hi
=
(
count_1
>>
29
)
+
sha_info
->
count_hi
;
if
(
count
>
63
)
goto
sha_updatebb_5
;
else
goto
sha_updatebb_8
;
// # SUCC: 5 [91.0%] (true,exec) 8 [9.0%] (false,exec)
sha_updatebb_5:
// # PRED: 4 [91.0%] (true,exec)
D_2796
=
&
sha_info
->
data
;
ivtmp_232
=
0
;
// # SUCC: 6 [100.0%] (fallthru,exec)
sha_updatebb_6:
// # PRED: 6 [91.0%] (true,exec) 5 [100.0%] (fallthru,exec)
D_3104
=
ivtmp_232
+
(
uintptr_t
)
buffer
;
my_memcpy
(
D_2796
,
D_3104
,
64
);
sha_transform
(
sha_info
);
ivtmp_232
=
ivtmp_232
+
64
;
if
((
int
)
(
count_1
-
ivtmp_232
)
>
63
)
goto
sha_updatebb_6
;
else
goto
sha_updatebb_7
;
// # SUCC: 6 [91.0%] (true,exec) 7 [9.0%] (false,exec)
sha_updatebb_7:
// # PRED: 6 [9.0%] (false,exec)
D_3087
=
(
count_1
+
(
int
)
4294967232
)
/
64
;
buffer
=
(
uintptr_t
)
buffer
+
(
D_3087
+
1
)
*
64
;
D_3090
=
count
+
-
64
;
count
=
D_3090
+
(
int
)
D_3087
*
-
64
;
// # SUCC: 8 [100.0%] (fallthru,exec)
sha_updatebb_8:
// # PRED: 7 [100.0%] (fallthru,exec) 4 [9.0%] (false,exec)
my_memcpy
(
&
sha_info
->
data
,
buffer
,
(
size_t
)
count
);
return
;
// # SUCC: EXIT [100.0%]
}
void
sha_stream
(
SHA_INFO
*
sha_info
,
BYTE
*
inData
,
LONG
dSize
)
{
LONG
end_289
;
LONG
end_288
;
uintptr_t
ivtmp_273
;
uintptr_t
D_3144
;
uintptr_t
ivtmp_267
;
BYTE
data
[
8192
];
LONG
count
;
LONG
end
;
LONG
start
;
LONG
j
;
unsigned
int
ARR_SIZE_4
;
sha_streambb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
ARR_SIZE_4
=
ARR_SIZE
;
j
=
ARR_SIZE_4
/
8192
;
sha_init
(
sha_info
);
if
(
j
!=
0
)
goto
sha_streambb_13
;
else
goto
sha_streambb_6
;
// # SUCC: 13 [91.0%] (true,exec) 6 [9.0%] (false,exec)
sha_streambb_13:
// # PRED: 2 [91.0%] (true,exec)
end_289
=
0
;
count
=
0
;
// # SUCC: 3 [100.0%] (fallthru)
sha_streambb_3:
// # PRED: 12 [100.0%] (fallthru) 13 [100.0%] (fallthru)
end_288
=
end_289
+
8192
;
if
(
end_288
>
end_289
)
goto
sha_streambb_14
;
else
goto
sha_streambb_5
;
// # SUCC: 14 [99.0%] (true,exec) 5 [1.0%] (false,exec)
sha_streambb_14:
// # PRED: 3 [99.0%] (true,exec)
ivtmp_273
=
0
;
// # SUCC: 4 [100.0%] (fallthru)
sha_streambb_4:
// # PRED: 4 [99.0%] (true,exec) 14 [100.0%] (fallthru)
*
(
BYTE
*
)((
uintptr_t
)
&
data
+
(
uintptr_t
)
ivtmp_273
)
=
*
(
BYTE
*
)((
BYTE
*
)
(
end_289
+
(
uintptr_t
)
inData
)
+
(
uintptr_t
)
ivtmp_273
);
ivtmp_273
=
ivtmp_273
+
1
;
if
(
ivtmp_273
!=
8192
)
goto
sha_streambb_4
;
else
goto
sha_streambb_5
;
// # SUCC: 4 [99.0%] (true,exec) 5 [1.0%] (false,exec)
sha_streambb_5:
// # PRED: 4 [1.0%] (false,exec) 3 [1.0%] (false,exec)
sha_update
(
sha_info
,
&
data
,
8192
);
count
=
count
+
1
;
if
(
j
>
count
)
goto
sha_streambb_12
;
else
goto
sha_streambb_6
;
// # SUCC: 12 [91.0%] (true,exec) 6 [9.0%] (false,exec)
sha_streambb_12:
// # PRED: 5 [91.0%] (true,exec)
end_289
=
end_288
;
goto
sha_streambb_3
;
// # SUCC: 3 [100.0%] (fallthru)
sha_streambb_6:
// # PRED: 5 [9.0%] (false,exec) 2 [9.0%] (false,exec)
if
(
ARR_SIZE_4
&
8191
!=
0
)
goto
sha_streambb_7
;
else
goto
sha_streambb_11
;
// # SUCC: 7 [61.0%] (true,exec) 11 [39.0%] (false,exec)
sha_streambb_7:
// # PRED: 6 [61.0%] (true,exec)
start
=
j
*
8192
;
end
=
ARR_SIZE
;
if
(
start
<
end
)
goto
sha_streambb_8
;
else
goto
sha_streambb_10
;
// # SUCC: 8 [99.0%] (true,exec) 10 [1.0%] (false,exec)
sha_streambb_8:
// # PRED: 7 [99.0%] (true,exec)
D_3144
=
end
-
start
;
ivtmp_267
=
0
;
// # SUCC: 9 [100.0%] (fallthru,exec)
sha_streambb_9:
// # PRED: 9 [99.0%] (true,exec) 8 [100.0%] (fallthru,exec)
*
(
BYTE
*
)((
uintptr_t
)
&
data
+
(
uintptr_t
)
ivtmp_267
)
=
*
(
BYTE
*
)((
uintptr_t
)
inData
+
start
+
(
uintptr_t
)
ivtmp_267
);
ivtmp_267
=
ivtmp_267
+
1
;
if
(
ivtmp_267
!=
D_3144
)
goto
sha_streambb_9
;
else
goto
sha_streambb_10
;
// # SUCC: 9 [99.0%] (true,exec) 10 [1.0%] (false,exec)
sha_streambb_10:
// # PRED: 9 [1.0%] (false,exec) 7 [1.0%] (false,exec)
sha_update
(
sha_info
,
&
data
,
(
int
)
(
end
-
start
));
// # SUCC: 11 [100.0%] (fallthru,exec)
sha_streambb_11:
// # PRED: 6 [39.0%] (false,exec) 10 [100.0%] (fallthru,exec)
sha_final
(
sha_info
);
return
;
// # SUCC: EXIT [100.0%]
}
instrument/examples/sha/sha_driver_IR.c
0 → 100644
View file @
ff4c6e4b
/***********************************************************
Intermediate representation of
sha/app_dir/sha_driver.c
Converted by ir2c v0.1
***********************************************************/
#include <limits.h>
#include <stdint.h>
#include "ir2c.h"
/* NIST Secure Hash Algorithm */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "sha.h"
#include "in_small.h"
#include "my_variable.h"
SHA_INFO
sha_info
;
//making global
int
main
()
{
mainbb_2:
// # PRED: ENTRY [100.0%] (fallthru,exec)
sha_stream
(
&
sha_info
,
&
in_Data
,
ARR_SIZE
);
return
0
;
// # SUCC: EXIT [100.0%]
}
instrument/match_cfg.py
View file @
ff4c6e4b
...
...
@@ -14,7 +14,7 @@ from display_cfg import display_cfgs
## Global Variables
######################################################
COND_EXEC_BLOCKLEN_THRESH
=
4
COND_EXEC_BLOCKLEN_THRESH
=
6
app
=
None
...
...
@@ -183,7 +183,7 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
succBlockISC
=
cfgISC
.
listBlocks
[
listSuccBlocksISC
[
0
]]
if
(
succBlockISC
.
isReturning
==
1
):
logging
.
debug
(
"/t OBJ:
%
s returns, and is mapped to ISC:
%
s"
%
(
blockObj
.
name
,
succBlock
Obj
.
name
))
%
(
blockObj
.
name
,
succBlock
ISC
.
name
))
blockISC
.
mapsTo
.
append
(
blockIndObj
)
succBlockISC
.
mapsTo
.
append
(
blockIndObj
)
blockObj
.
mapsTo
.
append
(
blockIndISC
)
...
...
@@ -288,7 +288,8 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
return
-
1
# If none of the blocks return, it means we have to continue the DFT
if
(
len
(
listSuccBlocksWOBackEdgeISC
)
!=
len
(
listSuccBlocksWOBackEdgeObj
))
and
blockObj
.
hasConditionalExec
==
1
:
# len(listSuccBlocksWOBackEdgeISC) != len(listSuccBlocksWOBackEdgeObj) and
if
blockObj
.
hasConditionalExec
==
1
:
# Check that length of each successor block is less than threshold for Conditional Execution
lenLongestSuccBlock
=
0
...
...
@@ -386,75 +387,55 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
if
len
(
listSuccBlocksISC
)
==
len
(
listSuccBlocksObj
):
logging
.
debug
(
"
\t
%
s::
%
s length of successors is same, trying DFT"
%
(
blockISC
.
name
,
blockObj
.
name
))
succBlocISCkMatchingFound
=
0
allSuccBlocksISCMatchingFound
=
1
for
succBlockIndISC
in
listSuccBlocksISC
:
# stackEntryISC = find(lambda stackEntry: stackEntry[0] == succBlockIndISC, mappingStackISC)
# if stackEntryISC != None:
# # look for all successors of blockObj which are in the stack,
# # and check if the succBlockIndISC maps to the obj node
# backEdgeMatched = 0
# for succBlockIndObj in listSuccBlocksObj:
# stackEntryObj = find(lambda stackEntry: stackEntry[0] == succBlockIndObj, mappingStackObj)
# if stackEntryObj != None:
# if (succBlockIndObj in stackEntryISC[1] and
# succBlockIndISC in stackEntryObj[1]):
# # back edge matched!
# logging.debug("%s::%s Back Edge to %s::%s matched!" %
# (blockISC.name, blockObj.name,
# cfgISC.listBlocks[succBlockIndISC].name,
# cfgObj.listBlocks[succBlockIndObj].name))
# backEdgeMatched = 1
# succBlocISCkMatchingFound = 1
# break
# if backEdgeMatched == 1:
# continue
# else:
# logging.error("%s::%s ISC block has back edge, that could not be matched to Obj Block" %
# (blockISC.name, blockObj.name))
# succBlocISCkMatchingFound = 0
# break
succBlockISCMatchFoundUsingDFT
=
0
for
succBlockIndObj
in
listSuccBlocksObj
:
# stackEntryObj = find(lambda stackEntry: stackEntry[0] == succBlockIndObj, mappingStackObj)
# if stackEntryObj != None:
# # TODO: Check for some trouble
# # We should just skip this back edge
# continue
logging
.
debug
(
"
\t\t
%
s::
%
s Trying DFT on
%
s::
%
s"
%
(
blockISC
.
name
,
blockObj
.
name
,
cfgISC
.
listBlocks
[
succBlockIndISC
]
.
name
,
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
name
))
mappingStackISC
.
append
((
succBlockIndISC
,
[
succBlockIndObj
]))
mappingStackObj
.
append
((
succBlockIndObj
,
[
succBlockIndISC
]))
if
(
mapping
(
cfgISC
,
succBlockIndISC
,
cfgObj
,
succBlockIndObj
,
mergedLevelsISC
)
==
0
):
cfgISC
.
listBlocks
[
succBlockIndISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
mapsTo
.
append
(
blockIndISC
)
mappingStackISC
.
pop
()
mappingStackObj
.
pop
()
succBlockISCMatchFoundUsingDFT
=
1
succBlocISCkMatchingFound
=
1
break
if
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
mapsTo
:
if
succBlockIndISC
in
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
mapsTo
:
# Both have already been mapped.
succBlockISCMatchFoundUsingDFT
=
1
break
# to continue matching the next successor in ISC
else
:
# Obj has been mapped to some other node.
continue
else
:
mappingStackISC
.
pop
()
mappingStackObj
.
pop
()
continue
# to try to match next successor of blockObj with current successor of blockISC
# Obj blocked hasn't yet been mapped. Try mapping
logging
.
debug
(
"
\t\t
%
s::
%
s Trying DFT on
%
s::
%
s"
%
(
blockISC
.
name
,
blockObj
.
name
,
cfgISC
.
listBlocks
[
succBlockIndISC
]
.
name
,
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
name
))
mappingStackISC
.
append
((
succBlockIndISC
,
[
succBlockIndObj
]))
mappingStackObj
.
append
((
succBlockIndObj
,
[
succBlockIndISC
]))
if
(
mapping
(
cfgISC
,
succBlockIndISC
,
cfgObj
,
succBlockIndObj
,
mergedLevelsISC
)
==
0
):
cfgISC
.
listBlocks
[
succBlockIndISC
]
.
mapsTo
.
append
(
succBlockIndObj
)
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
mapsTo
.
append
(
succBlockIndISC
)
mappingStackISC
.
pop
()
mappingStackObj
.
pop
()
succBlockISCMatchFoundUsingDFT
=
1
break
else
:
succBlockISCMatchFoundUsingDFT
=
0
mappingStackISC
.
pop
()
mappingStackObj
.
pop
()
continue
# to try to match next successor of blockObj with current successor of blockISC
if
succBlockISCMatchFoundUsingDFT
==
1
:
logging
.
debug
(
"
\t\t
%
s::
%
s DFT: Found matching for
%
s::
%
s"
%
(
blockISC
.
name
,
blockObj
.
name
,
cfgISC
.
listBlocks
[
succBlockIndISC
]
.
name
,
cfgObj
.
listBlocks
[
succBlockIndObj
]
.
name
))
succBlockISCMatchFoundUsingDFT
=
0
continue
# to match next blockISC
else
:
logging
.
error
(
"
\t\t
%
s::
%
s DFT: Matching obj block for ISC block not found!"
%
(
blockISC
.
name
,
blockObj
.
name
))
succBlocISCk
MatchingFound
=
0
allSuccBlocksISC
MatchingFound
=
0
break
if
succBlocISCk
MatchingFound
==
1
:
if
allSuccBlocksISC
MatchingFound
==
1
:
# Mapping was found for each successor block of blockISC
blockISC
.
mapsTo
.
append
(
blockIndObj
)
blockObj
.
mapsTo
.
append
(
blockIndISC
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment