# HG changeset patch # User Mario de Sousa # Date 1357814826 0 # Node ID 78083edf93d562546b30a50e56bf13f1b3a51055 # Parent ab601bdea102ffff3e639d8d1fda02fe7e4b9b82 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results), diff -r ab601bdea102 -r 78083edf93d5 stage3/constant_folding.cc --- a/stage3/constant_folding.cc Thu Jan 10 10:38:41 2013 +0000 +++ b/stage3/constant_folding.cc Thu Jan 10 10:47:06 2013 +0000 @@ -977,6 +977,7 @@ /*********************/ /* B 1.4 - Variables */ /*********************/ +#if DO_CONSTANT_PROPAGATION__ void *constant_folding_c::visit(symbolic_variable_c *symbol) { std::string varName; @@ -986,11 +987,13 @@ } return NULL; } +#endif // DO_CONSTANT_PROPAGATION__ /**********************/ /* B 1.5.3 - Programs */ /**********************/ +#if DO_CONSTANT_PROPAGATION__ void *constant_folding_c::visit(program_declaration_c *symbol) { symbol_c *var_name; @@ -1007,6 +1010,7 @@ symbol->function_block_body->accept(*this); return NULL; } +#endif // DO_CONSTANT_PROPAGATION__ /****************************************/ @@ -1279,7 +1283,7 @@ - +#if DO_CONSTANT_PROPAGATION__ /*********************************/ /* B 3.2.1 Assignment Statements */ /*********************************/ @@ -1399,6 +1403,6 @@ return NULL; } - - - +#endif // DO_CONSTANT_PROPAGATION__ + + diff -r ab601bdea102 -r 78083edf93d5 stage3/constant_folding.hh --- a/stage3/constant_folding.hh Thu Jan 10 10:38:41 2013 +0000 +++ b/stage3/constant_folding.hh Thu Jan 10 10:47:06 2013 +0000 @@ -43,6 +43,14 @@ #include "../absyntax_utils/absyntax_utils.hh" + +/* For the moment we disable constant propagation algorithm as it is not yet complete, + * and due to this is currently brocken and producing incorrect results! + */ +#define DO_CONSTANT_PROPAGATION__ 0 + + + class constant_folding_c : public iterator_visitor_c { search_varfb_instance_type_c *search_varfb_instance_type; int error_count; @@ -87,12 +95,16 @@ /*********************/ /* B 1.4 - Variables */ /*********************/ + #if DO_CONSTANT_PROPAGATION__ void *visit(symbolic_variable_c *symbol); + #endif /**********************/ /* B 1.5.3 - Programs */ /**********************/ + #if DO_CONSTANT_PROPAGATION__ void *visit(program_declaration_c *symbol); + #endif /****************************************/ /* B.2 - Language IL (Instruction List) */ @@ -188,6 +200,7 @@ //void *visit(function_invocation_c *symbol); /* TODO */ + #if DO_CONSTANT_PROPAGATION__ /*********************************/ /* B 3.2.1 Assignment Statements */ /*********************************/ @@ -204,5 +217,6 @@ void *visit(for_statement_c *symbol); void *visit(while_statement_c *symbol); void *visit(repeat_statement_c *symbol); + #endif // DO_CONSTANT_PROPAGATION__ };