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
e69b08ae
Commit
e69b08ae
authored
Sep 09, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also annotating function signatures in header files
Signed-off-by:
Gaurav Kukreja
<
gaurav@gauravk.in
>
parent
32c43004
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
cacheSimInstrument.py
instrument/cacheSimInstrument.py
+33
-0
adpcm.h
instrument/examples/adpcm/adpcm.h
+1
-2
irc_regex.py
instrument/irc_regex.py
+2
-0
No files found.
instrument/cacheSimInstrument.py
View file @
e69b08ae
...
...
@@ -196,6 +196,39 @@ def annotateVarFuncDecl(listISCFileNames, listISCFunctions, listGlobalVariables,
annot
)
continue
m
=
re_FuncDeclStart
.
match
(
line
)
if
m
is
not
None
:
currFunctionName
=
m
.
group
(
"name"
)
currFuncRetType
=
m
.
group
(
"retType"
)
assert
(
m
.
group
(
"openBrace"
)
is
not
None
)
logging
.
debug
(
" Function : "
+
currFunctionName
)
funcISC
=
find
(
lambda
fn
:
fn
.
functionName
==
currFunctionName
,
listISCFunctions
)
if
funcISC
.
listParams
:
# Create a list of new parameters for the annotated function signature
# Add <name>_addr parameter for each param that is a pointer
newFuncParamsList
=
[]
for
param
in
funcISC
.
listParams
:
newFuncParamsList
.
append
(
param
.
type
+
param
.
name
+
param
.
len
)
if
param
.
isPointer
:
newFuncParamsList
.
append
(
"unsigned long "
+
param
.
name
+
"_addr"
)
# create the new annotation
annotatedFuncDecl
=
currFuncRetType
+
" "
+
currFunctionName
+
" ("
for
param
in
newFuncParamsList
[:
-
1
]:
annotatedFuncDecl
=
annotatedFuncDecl
+
param
+
", "
annotatedFuncDecl
=
annotatedFuncDecl
+
newFuncParamsList
[
-
1
]
+
")"
annot
=
Annotation
(
annotatedFuncDecl
,
ISCFileName
,
lineNum
,
replace
=
True
)
addAnnotationToDict
(
dictAnnotVarFuncDecl
,
lineNum
,
annot
)
continue
m
=
re_BlockEndRBrace
.
match
(
line
)
if
m
is
not
None
and
inFunction
==
1
:
inFunction
=
0
...
...
instrument/examples/adpcm/adpcm.h
View file @
e69b08ae
...
...
@@ -15,5 +15,4 @@ struct adpcm_state {
#define ARGS(x) ()
#endif
void
adpcm_coder
ARGS
((
short
[],
char
[],
int
,
struct
adpcm_state
*
));
void
adpcm_decoder
ARGS
((
char
[],
short
[],
int
,
struct
adpcm_state
*
));
void
adpcm_coder
(
short
[],
char
[],
int
,
struct
adpcm_state
*
);
instrument/irc_regex.py
View file @
e69b08ae
...
...
@@ -36,6 +36,8 @@ FuncParams = "(?:(?:%s)(?:\s*,\s*(?:%s))*)" % (VarSpec_, VarSpec_)
RetTypes
=
"(?:
%
s)|void"
%
(
DataTypes
)
re_FuncDefStart
=
re
.
compile
(
"
\
s*(?P<retType>
%
s)?
\
s*(?P<name>
\
w*)
\
s*
\
((?P<params>
%
s)?(?:(?P<endComma>,)|(?P<openBrace>
\
)
\
s*
\
{))"
%
(
RetTypes
,
FuncParams
))
re_FuncDefArgLine
=
re
.
compile
(
"
\
s*(?P<params>
%
s)(?:(?P<endComma>,)|(?P<openBrace>
\
)
\
s*
\
{))"
%
(
FuncParams
))
re_FuncDeclStart
=
re
.
compile
(
"
\
s*(?P<retType>
%
s)?
\
s*(?P<name>
\
w*)
\
s*
\
((?P<params>
%
s)?(?:(?P<endComma>,)|(?P<openBrace>
\
)
\
s*;))"
%
(
RetTypes
,
FuncParams
))
# Label
re_Label
=
re
.
compile
(
"
\
s*(?P<label>
\
w*):"
)
...
...
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