stage3/constant_folding.hh
author mjsousa
Tue, 30 Dec 2014 22:17:22 +0000
changeset 982 760b26477193
parent 981 aad6aa35ce60
child 984 634269b0f104
permissions -rw-r--r--
Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     1
/*
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     3
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     4
 *  Copyright (C) 2009-2012  Mario de Sousa (msousa@fe.up.pt)
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     5
 *  Copyright (C) 2012       Manuele Conti (conti.ma@alice.it)
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     6
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     7
 *  This program is free software: you can redistribute it and/or modify
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     8
 *  it under the terms of the GNU General Public License as published by
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
     9
 *  the Free Software Foundation, either version 3 of the License, or
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    10
 *  (at your option) any later version.
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    11
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    12
 *  This program is distributed in the hope that it will be useful,
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    15
 *  GNU General Public License for more details.
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    16
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    17
 *  You should have received a copy of the GNU General Public License
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    19
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    20
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    21
 * This code is made available on the understanding that it will not be
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    22
 * used in safety-critical situations without a full and competent review.
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    23
 */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    24
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    25
/*
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    26
 * An IEC 61131-3 compiler.
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    27
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    28
 * Based on the
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    29
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    30
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    31
 */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    32
781
577547327f67 Add note about How Constant Folding class is extended with a implementation constant propagation algorithm
Manuele Conti <conti.ma@alice.it>
parents: 780
diff changeset
    33
/* Determine the value of an constant expression.
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    34
 * A reference to the relevant type definition is returned.
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    35
 *
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    36
 * For example:
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    37
 *       2 + 3       -> returns reference 
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    38
 *       22.2 - 5    -> returns reference
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    39
 *       etc...
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    40
 */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    41
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    42
#include <vector>
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    43
#include "../absyntax_utils/absyntax_utils.hh"
973
f86d5d6bb04e Do constant propagation of configuration/resource variables, taking into account scope of variables.
mjsousa
parents: 969
diff changeset
    44
#include "../util/symtable.hh"
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    45
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    46
792
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    47
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    48
/* For the moment we disable constant propagation algorithm as it is not yet complete, 
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    49
 * and due to this is currently brocken and producing incorrect results!
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    50
 */
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    51
#define DO_CONSTANT_PROPAGATION__ 0
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    52
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    53
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
    54
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    55
class constant_folding_c : public iterator_visitor_c {
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    56
    search_varfb_instance_type_c *search_varfb_instance_type;
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    57
    int error_count;
568
5f79478142d7 make the compiler platform independent (i.e. no longer assume sizeof(double)==8).
Mario de Sousa <msousa@fe.up.pt>
parents: 564
diff changeset
    58
    bool warning_found;
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    59
    int current_display_error_level;
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
    60
    /* Pointer to the previous IL instruction, which contains the current cvalue of the data stored in the IL stack, i.e. the default variable, a.k.a. accumulator */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
    61
    symbol_c *prev_il_instruction;
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
    62
    /* the current IL operand being analyzed */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
    63
    symbol_c *il_operand;
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
    64
969
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    65
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    66
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
    67
  public:
969
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    68
    constant_folding_c(symbol_c *symbol = NULL);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    69
    virtual ~constant_folding_c(void);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    70
    int get_error_count();
973
f86d5d6bb04e Do constant propagation of configuration/resource variables, taking into account scope of variables.
mjsousa
parents: 969
diff changeset
    71
    typedef symtable_c<const_value_c> map_values_t;
963
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
    72
  private:
982
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
    73
    symbol_c *current_resource;
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
    74
    symbol_c *current_configuration;
969
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    75
    map_values_t values;
982
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
    76
    map_values_t var_global_values;
969
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    77
    void *handle_var_list_decl(symbol_c *var_list, symbol_c *type_decl);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    78
    void *handle_var_decl     (symbol_c *var_list, bool fixed_init_value);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    79
    // Flag to indicate whether the variables in the variable declaration list will always have a fixed value when the POU is executed!
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    80
    // VAR CONSTANT ... END_VAR will always be true
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    81
    // VAR          ... END_VAR will always be true for functions (who initialise local variables every time they are called), but false for FBs and PROGRAMS
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    82
    bool fixed_init_value_; 
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    83
    bool function_pou_;
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    84
    bool is_constant(symbol_c *option);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
    85
    bool is_retain  (symbol_c *option);
967
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
    86
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
    87
963
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
    88
  public:
945
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    89
	#if 0
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    90
	// not currently needed, so comment it out!...
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    91
	/* utility functions for other stage3 algorithms to access the contant folded values */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    92
	/* written as static since we do not need to iteratively visit the symbols! */
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    93
	// returns true if both symbols have the same value in all the cvalues
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    94
	static bool is_equal_cvalue(symbol_c *symbol_1, symbol_c *symbol_2);
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    95
	#endif
477393b00f95 Add support for relaxed datatype model for array datatypes.
mjsousa
parents: 792
diff changeset
    96
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
    97
  private:
982
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
    98
    /***************************/
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
    99
    /* B 0 - Programming Model */
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
   100
    /***************************/
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
   101
    void *visit(library_c *symbol);
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   102
    /*********************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   103
    /* B 1.2 - Constants */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   104
    /*********************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   105
    /******************************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   106
    /* B 1.2.1 - Numeric Literals */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   107
    /******************************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   108
    void *visit(real_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   109
    void *visit(integer_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   110
    void *visit(neg_real_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   111
    void *visit(neg_integer_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   112
    void *visit(binary_integer_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   113
    void *visit(octal_integer_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   114
    void *visit(hex_integer_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   115
    void *visit(integer_literal_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   116
    void *visit(real_literal_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   117
    void *visit(bit_string_literal_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   118
    void *visit(boolean_literal_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   119
    void *visit(boolean_true_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   120
    void *visit(boolean_false_c *symbol);
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   121
633
73b56dc69e61 Fix bug with task interval using fixed_point value for duration items
Laurent Bessard
parents: 612
diff changeset
   122
    /************************/
73b56dc69e61 Fix bug with task interval using fixed_point value for duration items
Laurent Bessard
parents: 612
diff changeset
   123
    /* B 1.2.3.1 - Duration */
73b56dc69e61 Fix bug with task interval using fixed_point value for duration items
Laurent Bessard
parents: 612
diff changeset
   124
    /********* **************/
73b56dc69e61 Fix bug with task interval using fixed_point value for duration items
Laurent Bessard
parents: 612
diff changeset
   125
    void *visit(fixed_point_c *symbol);
73b56dc69e61 Fix bug with task interval using fixed_point value for duration items
Laurent Bessard
parents: 612
diff changeset
   126
774
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   127
    /*********************/
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   128
    /* B 1.4 - Variables */
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   129
    /*********************/
981
aad6aa35ce60 Disable constant propagation again (still not working correctly)
mjsousa
parents: 973
diff changeset
   130
    #if DO_CONSTANT_PROPAGATION__
774
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   131
    void *visit(symbolic_variable_c *symbol);
981
aad6aa35ce60 Disable constant propagation again (still not working correctly)
mjsousa
parents: 973
diff changeset
   132
    #endif // DO_CONSTANT_PROPAGATION__
963
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   133
    void *visit(symbolic_constant_c *symbol);
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   134
                             
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   135
    /******************************************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   136
    /* B 1.4.3 - Declaration & Initialisation */
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   137
    /******************************************/
967
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   138
    void *visit(        input_declarations_c *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   139
    void *visit(       output_declarations_c *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   140
    void *visit( input_output_declarations_c *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   141
    void *visit(          var_declarations_c *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   142
    void *visit(retentive_var_declarations_c *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   143
    void *visit( external_var_declarations_c *symbol);
969
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   144
    void *visit(   global_var_declarations_c *symbol);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   145
    void *visit(  external_declaration_c     *symbol);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   146
    void *visit(global_var_decl_c            *symbol);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   147
    void *visit( var1_init_decl_c            *symbol);
963
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   148
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   149
    /**************************************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   150
    /* B.1.5 - Program organization units */
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   151
    /**************************************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   152
    /***********************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   153
    /* B 1.5.1 - Functions */
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   154
    /***********************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   155
    void *visit(function_declaration_c *symbol);
967
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   156
    void *visit(function_var_decls_c   *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   157
963
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   158
    /*****************************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   159
    /* B 1.5.2 - Function Blocks */
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   160
    /*****************************/
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   161
    void *visit(function_block_declaration_c *symbol);
967
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   162
    void *visit(            temp_var_decls_c *symbol);
544ff4dff04f Do constant propagation to symbolic_variables, and correctly handle constant folding and propagation of variable declarations.
mjsousa
parents: 964
diff changeset
   163
    void *visit(   non_retentive_var_decls_c *symbol);
774
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   164
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   165
    /**********************/
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   166
    /* B 1.5.3 - Programs */
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   167
    /**********************/
969
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   168
    void *visit(       program_declaration_c *symbol);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   169
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   170
    /********************************/
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   171
    /* B 1.7 Configuration elements */
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   172
    /********************************/
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   173
    void *visit( configuration_declaration_c *symbol);
706a152731ab Do constant propagation inside Configurations and Resources (required for support of extension: array [1..max] OF int); (Resources is still buggy)
mjsousa
parents: 967
diff changeset
   174
    void *visit(      resource_declaration_c *symbol);
982
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
   175
    void *visit(     program_configuration_c *symbol);
760b26477193 Change algorithm for propagating VAR_GLOBAL constant values to corresponding VAR_EXTERNAL.
mjsousa
parents: 981
diff changeset
   176
    void *visit(                   fb_task_c *symbol);
963
e3d4dca7520b Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents: 945
diff changeset
   177
774
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   178
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   179
    /****************************************/
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   180
    /* B.2 - Language IL (Instruction List) */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   181
    /****************************************/
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   182
    /***********************************/
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   183
    /* B 2.1 Instructions and Operands */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   184
    /***********************************/
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   185
    // void *visit(instruction_list_c *symbol); /* Not needed, since we inherit from iterator_visitor_c */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   186
    void *visit(il_instruction_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   187
    void *visit(il_simple_operation_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   188
    //void *visit(il_function_call_c *symbol);  /* TODO */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   189
    void *visit(il_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   190
    void *visit(il_jump_operation_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   191
    void *visit(il_fb_call_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   192
    //void *visit(il_formal_funct_call_c *symbol);   /* TODO */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   193
    //void *visit(il_operand_list_c *symbol);  /* Not needed, since we inherit from iterator_visitor_c */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   194
    void *visit(simple_instr_list_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   195
    void *visit(il_simple_instruction_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   196
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   197
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   198
    /*******************/
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   199
    /* B 2.2 Operators */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   200
    /*******************/
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   201
    void *visit(   LD_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   202
    void *visit(  LDN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   203
    void *visit(   ST_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   204
    void *visit(  STN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   205
    void *visit(  NOT_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   206
    void *visit(    S_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   207
    void *visit(    R_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   208
    void *visit(   S1_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   209
    void *visit(   R1_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   210
    void *visit(  CLK_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   211
    void *visit(   CU_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   212
    void *visit(   CD_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   213
    void *visit(   PV_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   214
    void *visit(   IN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   215
    void *visit(   PT_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   216
    void *visit(  AND_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   217
    void *visit(   OR_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   218
    void *visit(  XOR_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   219
    void *visit( ANDN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   220
    void *visit(  ORN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   221
    void *visit( XORN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   222
    void *visit(  ADD_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   223
    void *visit(  SUB_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   224
    void *visit(  MUL_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   225
    void *visit(  DIV_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   226
    void *visit(  MOD_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   227
    void *visit(   GT_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   228
    void *visit(   GE_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   229
    void *visit(   EQ_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   230
    void *visit(   LT_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   231
    void *visit(   LE_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   232
    void *visit(   NE_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   233
    void *visit(  CAL_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   234
    void *visit( CALC_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   235
    void *visit(CALCN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   236
    void *visit(  RET_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   237
    void *visit( RETC_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   238
    void *visit(RETCN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   239
    void *visit(  JMP_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   240
    void *visit( JMPC_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   241
    void *visit(JMPCN_operator_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   242
    /* Symbol class handled together with function call checks */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   243
    // void *visit(il_assign_operator_c *symbol, variable_name);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   244
    /* Symbol class handled together with function call checks */
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   245
    // void *visit(il_assign_operator_c *symbol, option, variable_name);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   246
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   247
    /***************************************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   248
    /* B.3 - Language ST (Structured Text) */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   249
    /***************************************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   250
    /***********************/
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   251
    /* B 3.1 - Expressions */
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   252
    /***********************/
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   253
    void *visit(    or_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   254
    void *visit(   xor_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   255
    void *visit(   and_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   256
    void *visit(   equ_expression_c *symbol);
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   257
    void *visit(notequ_expression_c *symbol);
612
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   258
    void *visit(    lt_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   259
    void *visit(    gt_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   260
    void *visit(    le_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   261
    void *visit(    ge_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   262
    void *visit(   add_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   263
    void *visit(   sub_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   264
    void *visit(   mul_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   265
    void *visit(   div_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   266
    void *visit(   mod_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   267
    void *visit( power_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   268
    void *visit(   neg_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   269
    void *visit(   not_expression_c *symbol);
c062ff18d04f Constant folding for IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 568
diff changeset
   270
    //void *visit(function_invocation_c *symbol); /* TODO */
774
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   271
981
aad6aa35ce60 Disable constant propagation again (still not working correctly)
mjsousa
parents: 973
diff changeset
   272
    #if DO_CONSTANT_PROPAGATION__
774
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   273
    /*********************************/
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   274
    /* B 3.2.1 Assignment Statements */
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   275
    /*********************************/
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   276
    void *visit(assignment_statement_c *symbol);
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   277
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   278
    /********************************/
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   279
    /* B 3.2.3 Selection Statements */
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   280
    /********************************/
979af2009d88 Start to implement constant propagation algorithm.
Manuele Conti <conti.ma@alice.it>
parents: 667
diff changeset
   281
    void *visit(if_statement_c *symbol);
780
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   282
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   283
    /********************************/
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   284
    /* B 3.2.4 Iteration Statements */
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   285
    /********************************/
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   286
    void *visit(for_statement_c *symbol);
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   287
    void *visit(while_statement_c *symbol);
9fbdf8a7430e Add constant propagation algorithm for loop cycles.
Manuele Conti <conti.ma@alice.it>
parents: 774
diff changeset
   288
    void *visit(repeat_statement_c *symbol);
792
78083edf93d5 disable not yet complete constant propagation algorithm (currently brocken and producing incorrect results),
Mario de Sousa <msousa@fe.up.pt>
parents: 783
diff changeset
   289
    #endif // DO_CONSTANT_PROPAGATION__
564
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   290
};
dabffc3086dc Start constant_folding class.
Manuele Conti <conti.ma@alice.it>
parents:
diff changeset
   291