Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
Zipr Toolchain
Commits
3119379c
Commit
3119379c
authored
13 years ago
by
an7s
Browse files
Options
Downloads
Patches
Plain Diff
Added comments
parent
6360ff39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
xform/p1_transform.cpp
+18
-2
18 additions, 2 deletions
xform/p1_transform.cpp
xform/p1_transform.h
+3
-1
3 additions, 1 deletion
xform/p1_transform.h
xform/rewriter.h
+2
-2
2 additions, 2 deletions
xform/rewriter.h
with
23 additions
and
5 deletions
xform/p1_transform.cpp
+
18
−
2
View file @
3119379c
...
...
@@ -63,6 +63,13 @@ P1Transform::P1Transform(char *p_elf, char *p_annot, char *p_spri) : Rewriter(p_
}
}
//
// Implement P1 transform for one function
//
// Use pattern matching to rewrite instructions
// Commit all rewritten instrutions if all is well
// Write rules to file
//
void
P1Transform
::
rewrite
(
wahoo
::
Function
*
f
,
FILE
*
fp
)
{
app_iaddr_t
addr
=
f
->
getAddress
();
...
...
@@ -306,7 +313,10 @@ void P1Transform::rewrite(wahoo::Function *f, FILE* fp)
}
// rewrite all candidate functions
//
// Iterate other candidate functions
// Emit SPASM rules for each valid function
//
void
P1Transform
::
rewrite
(
char
*
p_filenamePrefix
)
{
int
num_func_successful
=
0
;
...
...
@@ -327,7 +337,7 @@ void P1Transform::rewrite(char *p_filenamePrefix)
bool
P1Transform
::
isCandidate
(
wahoo
::
Function
*
p_fn
)
{
if
(
!
p_fn
)
return
false
;
if
(
p_fn
->
isSafe
())
return
false
;
if
(
p_fn
->
isSafe
())
return
false
;
// we don't transform MEDS-safe functions
// strict policy: we only attempt the P1 transform on functions
// that we think have exactly 1 allocation and deallocation site
...
...
@@ -339,7 +349,9 @@ bool P1Transform::isCandidate(wahoo::Function *p_fn)
return
false
;
}
//
// return candidate functions for the P1 transform
//
vector
<
wahoo
::
Function
*>
P1Transform
::
getCandidateFunctions
()
{
vector
<
wahoo
::
Function
*>
p1Candidates
;
...
...
@@ -357,7 +369,9 @@ vector<wahoo::Function*> P1Transform::getCandidateFunctions()
return
p1Candidates
;
}
//
// return non-candidate functions for the P1 transform
//
vector
<
wahoo
::
Function
*>
P1Transform
::
getNonCandidateFunctions
()
{
vector
<
wahoo
::
Function
*>
p1NonCandidates
;
...
...
@@ -391,6 +405,8 @@ int P1Transform::getStackFramePadding(wahoo::Function *p_fn)
// - to make sure BED flags the fn
// - to assess confidence in the fn (TSET)
//
// [now DEPRECATED with instruction coverage info]
//
void
P1Transform
::
badRewrite
(
wahoo
::
Function
*
p_fn
,
FILE
*
p_aspri
)
{
addSimpleRewriteRule
(
p_fn
,
""
,
1
,
p_fn
->
getAddress
(),
"hlt"
);
...
...
This diff is collapsed.
Click to expand it.
xform/p1_transform.h
+
3
−
1
View file @
3119379c
...
...
@@ -9,6 +9,7 @@ class P1Transform : public Rewriter
void
rewrite
(
char
*
);
void
rewrite
(
wahoo
::
Function
*
,
FILE
*
);
// deprecated
void
badRewrite
(
wahoo
::
Function
*
,
FILE
*
);
void
badRewrite
(
char
*
);
...
...
@@ -17,9 +18,10 @@ class P1Transform : public Rewriter
private:
bool
isCandidate
(
wahoo
::
Function
*
);
int
getStackFramePadding
(
wahoo
::
Function
*
);
int
getStackFramePadding
(
wahoo
::
Function
*
);
private:
// regex patterns for detecting and transforming stack instruction references
regex_t
m_stack_ebp_pattern
;
regex_t
m_stack_alloc_pattern
;
regex_t
m_stack_dealloc_pattern
;
...
...
This diff is collapsed.
Click to expand it.
xform/rewriter.h
+
2
−
2
View file @
3119379c
...
...
@@ -38,6 +38,6 @@ class Rewriter
map
<
app_iaddr_t
,
wahoo
::
Instruction
*>
m_instructions
;
private
:
ElfReader
*
m_elfReader
;
FILE
*
m_spri
;
ElfReader
*
m_elfReader
;
FILE
*
m_spri
;
};
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