summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 88a856c2..127e0bda 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1243,6 +1243,7 @@ semantic_pass_symbols (systemtap_session& s)
}
+
// Keep unread global variables for probe end value display.
void add_global_var_display (systemtap_session& s)
{
@@ -2609,6 +2610,7 @@ struct void_statement_reducer: public update_visitor
void visit_print_format (print_format* e);
void visit_target_symbol (target_symbol* e);
void visit_cast_op (cast_op* e);
+ void visit_defined_op (defined_op* e);
// these are a bit hairy to grok due to the intricacies of indexables and
// stats, so I'm chickening out and skipping them...
@@ -2947,6 +2949,23 @@ void_statement_reducer::visit_cast_op (cast_op* e)
}
+void
+void_statement_reducer::visit_defined_op (defined_op* e)
+{
+ // When the result of a @defined operation isn't needed, just elide
+ // it entirely. Its operand $expression must already be
+ // side-effect-free.
+
+ if (session.verbose>2)
+ clog << "Eliding unused check " << *e->tok << endl;
+
+ relaxed_p = false;
+ e = 0;
+ provide (e);
+}
+
+
+
void semantic_pass_opt5 (systemtap_session& s, bool& relaxed_p)
{
// Let's simplify statements with unused computed values.
@@ -3576,6 +3595,13 @@ typeresolution_info::visit_target_symbol (target_symbol* e)
void
+typeresolution_info::visit_defined_op (defined_op* e)
+{
+ throw semantic_error("unexpected @defined", e->tok);
+}
+
+
+void
typeresolution_info::visit_cast_op (cast_op* e)
{
// Like target_symbol, a cast_op shouldn't survive this far