← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/81857

optimizer optimization:avoid double traversal of the expr tree during MarkProducerNodeProps rule
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/81857
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp'
--- src/compiler/rewriter/rules/nodeid_rules.cpp	2011-08-12 10:21:10 +0000
+++ src/compiler/rewriter/rules/nodeid_rules.cpp	2011-11-10 14:10:29 +0000
@@ -483,19 +483,14 @@
 /*******************************************************************************
   
 ********************************************************************************/
-RULE_REWRITE_PRE(MarkProducerNodeProps)
-{
-  if (rCtx.getRoot().getp() == node) 
-  {
-    DataflowAnnotationsComputer computer;
-    computer.compute(node);
-  }
-  return NULL;
-}
-
-
-RULE_REWRITE_POST(MarkProducerNodeProps)
-{
+expr_t MarkProducerNodeProps::apply(
+    RewriterContext& rCtx,
+    expr* node,
+    bool& modified)
+{
+  DataflowAnnotationsComputer computer;
+  computer.compute(node);
+  modified = false;
   return NULL;
 }
 

=== modified file 'src/compiler/rewriter/rules/ruleset.h'
--- src/compiler/rewriter/rules/ruleset.h	2011-06-14 17:26:33 +0000
+++ src/compiler/rewriter/rules/ruleset.h	2011-11-10 14:10:29 +0000
@@ -32,8 +32,6 @@
 
 PREPOST_RULE(PlanPrinter);
 
-PREPOST_RULE(MarkProducerNodeProps);
-
 PREPOST_RULE(EliminateNodeOps);
 
 PREPOST_RULE(SpecializeOperations);
@@ -109,6 +107,22 @@
 /*******************************************************************************
 
 ********************************************************************************/
+class MarkProducerNodeProps : public RewriteRule 
+{
+public:
+  MarkProducerNodeProps() 
+    :
+    RewriteRule(RewriteRule::MarkProducerNodeProps, "MarkProducerNodeProps")
+  {
+  }
+
+  expr_t apply(RewriterContext& rCtx, expr* node, bool& modified);
+};
+
+
+/*******************************************************************************
+
+********************************************************************************/
 class HoistRule : public RewriteRule 
 {
 public:
@@ -131,9 +145,6 @@
 };
 
 
-#undef RULE
-
-
 }
 
 #endif /* ZORBA_REWRITE_RULE_H */


Follow ups