summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-08-03 15:49:40 -0700
committerJosh Stone <jistone@redhat.com>2009-08-03 15:49:40 -0700
commit8b095b454b34e88c04592be6c651153f802eced6 (patch)
tree9dd9080f259427ddad2ae70de7ba908832b4ef07 /elaborate.cxx
parent3a4235b9897b75a188753419a29f0616c1686249 (diff)
downloadsystemtap-steved-8b095b454b34e88c04592be6c651153f802eced6.tar.gz
systemtap-steved-8b095b454b34e88c04592be6c651153f802eced6.tar.xz
systemtap-steved-8b095b454b34e88c04592be6c651153f802eced6.zip
Add update_visitor::replace
I noticed that most uses of update_visitor::require() were simply writing the value back to the same place, i.e. foo = require(foo). The new replace() method just encapsulates that paradigm, so we don't have the duplication between the LHS and RHS. * staptree.h (update_visitor::replace): New. * elaborate.cxx, staptree.cxx, tapset-mark.cxx, tapset-perfmon.cxx, tapset-procfs.cxx, tapset-utrace.cxx, tapsets.cxx: Update all require calls that are simply updating the value in-place.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx38
1 files changed, 19 insertions, 19 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index d1ebe326..9271e847 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1108,7 +1108,7 @@ semantic_pass_symbols (systemtap_session& s)
try
{
for (unsigned j=0; j<s.code_filters.size(); j++)
- fd->body = s.code_filters[j]->require (fd->body);
+ s.code_filters[j]->replace (fd->body);
sym.current_function = fd;
sym.current_probe = 0;
@@ -1143,7 +1143,7 @@ semantic_pass_symbols (systemtap_session& s)
try
{
for (unsigned k=0; k<s.code_filters.size(); k++)
- dp->body = s.code_filters[k]->require (dp->body);
+ s.code_filters[k]->replace (dp->body);
sym.current_function = 0;
sym.current_probe = dp;
@@ -2136,8 +2136,8 @@ struct dead_assignment_remover: public update_visitor
void
dead_assignment_remover::visit_assignment (assignment* e)
{
- e->left = require (e->left);
- e->right = require (e->right);
+ replace (e->left);
+ replace (e->right);
symbol* left = get_symbol_within_expression (e->left);
vardecl* leftvar = left->referent; // NB: may be 0 for unresolved $target
@@ -2203,10 +2203,10 @@ void semantic_pass_opt3 (systemtap_session& s, bool& relaxed_p)
// This instance may be reused for multiple probe/function body trims.
for (unsigned i=0; i<s.probes.size(); i++)
- s.probes[i]->body = dar.require (s.probes[i]->body);
+ dar.replace (s.probes[i]->body);
for (map<string,functiondecl*>::iterator it = s.functions.begin();
it != s.functions.end(); it++)
- it->second->body = dar.require (it->second->body);
+ dar.replace (it->second->body);
// The rewrite operation is performed within the visitor.
// XXX: we could also zap write-only globals here
@@ -2290,8 +2290,8 @@ dead_stmtexpr_remover::visit_block (block *s)
void
dead_stmtexpr_remover::visit_if_statement (if_statement *s)
{
- s->thenblock = require (s->thenblock, true);
- s->elseblock = require (s->elseblock, true);
+ replace (s->thenblock, true);
+ replace (s->elseblock, true);
if (s->thenblock == 0)
{
@@ -2343,7 +2343,7 @@ dead_stmtexpr_remover::visit_if_statement (if_statement *s)
void
dead_stmtexpr_remover::visit_foreach_loop (foreach_loop *s)
{
- s->block = require(s->block, true);
+ replace (s->block, true);
if (s->block == 0)
{
@@ -2357,7 +2357,7 @@ dead_stmtexpr_remover::visit_foreach_loop (foreach_loop *s)
void
dead_stmtexpr_remover::visit_for_loop (for_loop *s)
{
- s->block = require(s->block, true);
+ replace (s->block, true);
if (s->block == 0)
{
@@ -2446,7 +2446,7 @@ void semantic_pass_opt4 (systemtap_session& s, bool& relaxed_p)
duv.focal_vars.insert (p->locals.begin(),
p->locals.end());
- p->body = duv.require(p->body, true);
+ duv.replace (p->body, true);
if (p->body == 0)
{
if (! s.suppress_warnings
@@ -2472,7 +2472,7 @@ void semantic_pass_opt4 (systemtap_session& s, bool& relaxed_p)
duv.focal_vars.insert (s.globals.begin(),
s.globals.end());
- fn->body = duv.require(fn->body, true);
+ duv.replace (fn->body, true);
if (fn->body == 0)
{
if (! s.suppress_warnings)
@@ -2556,7 +2556,7 @@ struct void_statement_reducer: public update_visitor
void
void_statement_reducer::visit_expr_statement (expr_statement* s)
{
- s->value = require (s->value, true);
+ replace (s->value, true);
// if the expression provides 0, that's our signal that a new
// statement has been provided, so we shouldn't provide this one.
@@ -2568,8 +2568,8 @@ void
void_statement_reducer::visit_if_statement (if_statement* s)
{
// s->condition is never void
- s->thenblock = require (s->thenblock);
- s->elseblock = require (s->elseblock);
+ replace (s->thenblock);
+ replace (s->elseblock);
provide (s);
}
@@ -2577,7 +2577,7 @@ void
void_statement_reducer::visit_for_loop (for_loop* s)
{
// s->init/cond/incr are never void
- s->block = require (s->block);
+ replace (s->block);
provide (s);
}
@@ -2585,7 +2585,7 @@ void
void_statement_reducer::visit_foreach_loop (foreach_loop* s)
{
// s->indexes/base/limit are never void
- s->block = require (s->block);
+ replace (s->block);
provide (s);
}
@@ -2884,10 +2884,10 @@ void semantic_pass_opt5 (systemtap_session& s, bool& relaxed_p)
vuv.focal_vars.insert (s.globals.begin(), s.globals.end());
for (unsigned i=0; i<s.probes.size(); i++)
- s.probes[i]->body = vuv.require (s.probes[i]->body);
+ vuv.replace (s.probes[i]->body);
for (map<string,functiondecl*>::iterator it = s.functions.begin();
it != s.functions.end(); it++)
- it->second->body = vuv.require (it->second->body);
+ vuv.replace (it->second->body);
}