equal
deleted
inserted
replaced
69 |
69 |
70 |
70 |
71 /* Constant folding assumes that flow control analysis has been completed! |
71 /* Constant folding assumes that flow control analysis has been completed! |
72 * so be sure to call flow_control_analysis() before calling this function! |
72 * so be sure to call flow_control_analysis() before calling this function! |
73 */ |
73 */ |
74 static int constant_folding(symbol_c *tree_root){ |
74 static int constant_propagation(symbol_c *tree_root){ |
75 constant_folding_c constant_folding(tree_root); |
75 constant_propagation_c constant_propagation(tree_root); |
76 tree_root->accept(constant_folding); |
76 tree_root->accept(constant_propagation); |
77 return constant_folding.get_error_count(); |
77 return constant_propagation.get_error_count(); |
78 } |
78 } |
79 |
79 |
80 |
80 |
81 /* Type safety analysis assumes that |
81 /* Type safety analysis assumes that |
82 * - flow control analysis |
82 * - flow control analysis |
138 int stage3(symbol_c *tree_root, symbol_c **ordered_tree_root) { |
138 int stage3(symbol_c *tree_root, symbol_c **ordered_tree_root) { |
139 int error_count = 0; |
139 int error_count = 0; |
140 error_count += enum_declaration_check(tree_root); |
140 error_count += enum_declaration_check(tree_root); |
141 error_count += declaration_safety(tree_root); |
141 error_count += declaration_safety(tree_root); |
142 error_count += flow_control_analysis(tree_root); |
142 error_count += flow_control_analysis(tree_root); |
143 error_count += constant_folding(tree_root); |
143 error_count += constant_propagation(tree_root); |
144 error_count += type_safety(tree_root); |
144 error_count += type_safety(tree_root); |
145 error_count += lvalue_check(tree_root); |
145 error_count += lvalue_check(tree_root); |
146 error_count += array_range_check(tree_root); |
146 error_count += array_range_check(tree_root); |
147 error_count += remove_forward_dependencies(tree_root, ordered_tree_root); |
147 error_count += remove_forward_dependencies(tree_root, ordered_tree_root); |
148 |
148 |