Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin_cache_blocks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OTAWA-plugins
plugin_cache_blocks
Commits
463eb51d
Commit
463eb51d
authored
4 years ago
by
Bouquillon Fabien
Browse files
Options
Downloads
Patches
Plain Diff
correction exploration paths (see explo)
parent
59a7b217
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
explo/Makefile
+4
-1
4 additions, 1 deletion
explo/Makefile
explo/explo.cpp
+133
-1
133 additions, 1 deletion
explo/explo.cpp
explo/include/explo.h
+3
-1
3 additions, 1 deletion
explo/include/explo.h
with
140 additions
and
3 deletions
explo/Makefile
+
4
−
1
View file @
463eb51d
...
...
@@ -11,7 +11,7 @@ ARMCC=arm-none-eabi-gcc
CXXFLAGS
+=
-std
=
c++11
-O0
-g3
-I
../otawa-core2-build/otawa/include/
-I
../otawa-core2-build/elm/include/
-I
../include/
all
:
clean explo.so install application large_loop
all
:
clean explo.so install application large_loop
loop_cond
# binaire: binaire.c
# $(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
...
...
@@ -28,6 +28,9 @@ all: clean explo.so install application large_loop
large_loop
:
large_loop.c
$(
ARMCC
)
-nostdlib
-nostdinc
-static
-o
large_loop large_loop.c
loop_cond
:
loop_cond.c
$(
ARMCC
)
-nostdlib
-nostdinc
-static
-o
loop_cond loop_cond.c
# large_loop_function: large_loop_function.c
# $(ARMCC) -nostdlib -nostdinc -static -o large_loop_function large_loop_function.c
...
...
This diff is collapsed.
Click to expand it.
explo/explo.cpp
+
133
−
1
View file @
463eb51d
...
...
@@ -51,6 +51,122 @@ namespace otawa {
}
//--------------------------------------------------------------------------
// Exploration loop
//--------------------------------------------------------------------------
void
ExploProcessor
::
rec_loop
(
Block
*
loop_header
,
Block
*
b
,
std
::
vector
<
std
::
vector
<
Block
*>>
&
paths
,
std
::
vector
<
std
::
vector
<
Block
*>>
paths_before
)
{
// Add the current block to the path
for
(
int
i
=
0
;
i
<
paths_before
.
size
();
i
++
)
{
paths_before
[
i
].
push_back
(
b
);
}
// END condition
if
(
b
==
loop_header
)
{
std
::
vector
<
std
::
vector
<
Block
*>>
tmp
;
for
(
int
i
=
0
;
i
<
paths_before
.
size
();
i
++
)
{
paths
.
push_back
(
paths_before
[
i
]);
}
return
;
}
//if block is function call
if
(
b
->
isSynth
())
{
std
::
vector
<
std
::
vector
<
Block
*>>
path_tmp
;
ExploProcessor
::
explo_fct
(
b
->
toSynth
()
->
callee
()
->
exit
(),
path_tmp
,
paths_before
);
paths_before
=
path_tmp
;
}
// if block is loop
if
(
LOOP_HEADER
(
b
->
toBasic
()))
{
Block
::
EdgeIter
iter_pred
(
b
->
ins
());
Edge
*
edge_fct
=
*
iter_pred
;
Block
*
fct_c
=
edge_fct
->
source
();
iter_pred
++
;
Edge
*
edge_loop
=
*
iter_pred
;
Block
*
loop_c
=
edge_loop
->
source
();
std
::
vector
<
std
::
vector
<
Block
*>>
paths_tmp
;
ExploProcessor
::
rec_loop
(
b
,
loop_c
,
paths_tmp
,
paths_before
);
paths_before
=
paths_tmp
;
ExploProcessor
::
rec_loop
(
loop_header
,
fct_c
,
paths
,
paths_before
);
}
else
{
// Rec part
for
(
Block
::
EdgeIter
iter_pred
(
b
->
ins
());
iter_pred
();
iter_pred
++
)
{
Edge
*
edge
=
*
iter_pred
;
Block
*
src
=
edge
->
source
();
ExploProcessor
::
rec_loop
(
loop_header
,
src
,
paths
,
paths_before
);
}
}
}
void
ExploProcessor
::
explo_fct
(
Block
*
b
,
std
::
vector
<
std
::
vector
<
Block
*>>
&
paths
,
std
::
vector
<
std
::
vector
<
Block
*>>
paths_before
)
{
if
(
paths_before
.
size
()
!=
0
)
{
// Add the current block to the path
for
(
int
i
=
0
;
i
<
paths_before
.
size
();
i
++
)
{
paths_before
[
i
].
push_back
(
b
);
}
}
else
{
std
::
vector
<
Block
*>
tmp
;
tmp
.
push_back
(
b
);
paths_before
.
push_back
(
tmp
);
}
// END condition
if
(
b
->
isEntry
())
{
std
::
vector
<
std
::
vector
<
Block
*>>
tmp
;
for
(
int
i
=
0
;
i
<
paths_before
.
size
();
i
++
)
{
paths
.
push_back
(
paths_before
[
i
]);
}
return
;
}
// if block is loop
if
(
b
->
isBasic
()
&&
LOOP_HEADER
(
b
->
toBasic
()))
{
Block
::
EdgeIter
iter_pred
(
b
->
ins
());
Edge
*
edge_fct
=
*
iter_pred
;
Block
*
fct_c
=
edge_fct
->
source
();
iter_pred
++
;
Edge
*
edge_loop
=
*
iter_pred
;
Block
*
loop_c
=
edge_loop
->
source
();
std
::
vector
<
std
::
vector
<
Block
*>>
paths_tmp
;
ExploProcessor
::
rec_loop
(
b
,
loop_c
,
paths_tmp
,
paths_before
);
paths_before
=
paths_tmp
;
ExploProcessor
::
explo_fct
(
fct_c
,
paths
,
paths_before
);
}
else
{
//if block is function call
if
(
b
->
isSynth
())
{
std
::
vector
<
std
::
vector
<
Block
*>>
path_tmp
;
ExploProcessor
::
explo_fct
(
b
->
toSynth
()
->
callee
()
->
exit
(),
path_tmp
,
paths_before
);
paths_before
=
path_tmp
;
}
// Rec part
for
(
Block
::
EdgeIter
iter_pred
(
b
->
ins
());
iter_pred
();
iter_pred
++
)
{
Edge
*
edge
=
*
iter_pred
;
Block
*
src
=
edge
->
source
();
ExploProcessor
::
explo_fct
(
src
,
paths
,
paths_before
);
}
}
}
//--------------------------------------------------------------------------
// unsigned long time_lblock(LBlock* lb) {
// BasicBlock* bb = lb->bb();
// std::cout << " -- LB -- " << std::endl;
...
...
@@ -255,6 +371,9 @@ namespace otawa {
std
::
cout
<<
"#############################################"
<<
std
::
endl
;
}
void
ExploProcessor
::
processWorkSpace
(
WorkSpace
*
ws
)
{
const
CFGCollection
*
coll
=
INVOLVED_CFGS
(
ws
);
...
...
@@ -263,6 +382,19 @@ namespace otawa {
explo_cfg
(
tmp
);
std
::
cout
<<
std
::
endl
;
}
std
::
cout
<<
"################# LOOP EXPLO ################"
<<
std
::
endl
;
std
::
vector
<
std
::
vector
<
Block
*>>
paths
;
std
::
vector
<
std
::
vector
<
Block
*>>
tmp
;
explo_fct
(
ENTRY_CFG
(
ws
)
->
exit
(),
paths
,
tmp
);
for
(
int
i
=
0
;
i
<
paths
.
size
();
i
++
)
{
std
::
cout
<<
"PATH["
<<
i
<<
"]:"
;
for
(
int
j
=
0
;
j
<
paths
[
i
].
size
();
j
++
)
{
std
::
cout
<<
paths
[
i
][
j
]
->
id
()
<<
"->"
;
}
std
::
cout
<<
"start"
<<
endl
;
}
}
...
...
This diff is collapsed.
Click to expand it.
explo/include/explo.h
+
3
−
1
View file @
463eb51d
...
...
@@ -21,6 +21,8 @@ public:
explicit
ExploProcessor
(
p
::
declare
&
r
=
reg
);
protected:
void
explo_fct
(
Block
*
b
,
std
::
vector
<
std
::
vector
<
Block
*>>
&
paths
,
std
::
vector
<
std
::
vector
<
Block
*>>
paths_before
);
void
rec_loop
(
Block
*
loop_header
,
Block
*
b
,
std
::
vector
<
std
::
vector
<
Block
*>>
&
paths
,
std
::
vector
<
std
::
vector
<
Block
*>>
paths_before
);
void
processWorkSpace
(
WorkSpace
*
/*ws*/
)
override
;
void
configure
(
const
PropList
&
props
)
override
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment