# HG changeset patch # User Mario de Sousa # Date 1339181265 -3600 # Node ID cb704eca7e37557c6d4ea810f5b39466aad94e71 # Parent 0d1ab9e785745ab627b2bdf499d84a5a3630f33d cosmetic changes. diff -r 0d1ab9e78574 -r cb704eca7e37 stage3/constant_folding.cc --- a/stage3/constant_folding.cc Fri Jun 08 19:44:32 2012 +0100 +++ b/stage3/constant_folding.cc Fri Jun 08 19:47:45 2012 +0100 @@ -238,6 +238,7 @@ NEW_CVALUE( int64, symbol); SET_CVALUE( int64, symbol, - GET_CVALUE( int64, symbol->exp)); } + /* TODO: check for overflows */ return NULL; } @@ -434,12 +435,9 @@ void *constant_folding_c::visit(add_expression_c *symbol) { symbol->l_exp->accept(*this); symbol->r_exp->accept(*this); - DO_BIN_OPER(uint64, +); - DO_BIN_OPER( int64, +); - DO_BIN_OPER(real64, +); - CHECK_OVERFLOW_SUM(uint64); - CHECK_OVERFLOW_SUM( int64); - CHECK_OVERFLOW_real64; + DO_BIN_OPER(uint64, +); CHECK_OVERFLOW_SUM(uint64); + DO_BIN_OPER( int64, +); CHECK_OVERFLOW_SUM( int64); + DO_BIN_OPER(real64, +); CHECK_OVERFLOW_real64; return NULL; } @@ -452,12 +450,9 @@ void *constant_folding_c::visit(sub_expression_c *symbol) { symbol->l_exp->accept(*this); symbol->r_exp->accept(*this); - DO_BIN_OPER(uint64, -); - DO_BIN_OPER( int64, -); - DO_BIN_OPER(real64, -); - CHECK_OVERFLOW_SUB(uint64); - CHECK_OVERFLOW_SUB( int64); - CHECK_OVERFLOW_real64; + DO_BIN_OPER(uint64, -); CHECK_OVERFLOW_SUB(uint64); + DO_BIN_OPER( int64, -); CHECK_OVERFLOW_SUB( int64); + DO_BIN_OPER(real64, -); CHECK_OVERFLOW_real64; return NULL; } @@ -470,12 +465,9 @@ void *constant_folding_c::visit(mul_expression_c *symbol) { symbol->l_exp->accept(*this); symbol->r_exp->accept(*this); - DO_BIN_OPER(uint64, *); - DO_BIN_OPER( int64, *); - DO_BIN_OPER(real64, *); - CHECK_OVERFLOW_MUL(uint64); - CHECK_OVERFLOW_MUL( int64); - CHECK_OVERFLOW_real64; + DO_BIN_OPER(uint64, *); CHECK_OVERFLOW_MUL(uint64); + DO_BIN_OPER( int64, *); CHECK_OVERFLOW_MUL( int64); + DO_BIN_OPER(real64, *); CHECK_OVERFLOW_real64; return NULL; }