Skip to content
Browse files

resumed work on compiler

  • Loading branch information...
1 parent 4611a08 commit e05042016dcbab6e2e63c720965c08cbf05c1147 @mwolf76 committed Apr 6, 2013
View
1 src/model/compilers/compiler.hh
@@ -174,7 +174,6 @@ protected:
// partial results
ADDStack f_add_stack;
- ADDStack f_tmp_stack; // used for binary algebrizations
// current ctx stack, for symbol resolution
ExprStack f_ctx_stack;
View
2 src/model/compilers/fixed.cc
@@ -88,10 +88,8 @@ void Compiler::fixed_ite(const Expr_ptr expr)
FQExpr key(expr); const Type_ptr type = f_owner.type(key);
unsigned width = tm.calculate_width(type);
- assert( 0 == f_tmp_stack.size() );
algebraic_from_fxd_const(width); // rhs
algebraic_from_fxd_const(width); // lhs
- flush_operands();
/* fix type stack, constants are always unsigned */
f_type_stack.pop_back();
View
2 src/model/compilers/integer.cc
@@ -202,10 +202,8 @@ void Compiler::integer_ite(const Expr_ptr expr)
FQExpr key(expr); const Type_ptr type = f_owner.type(key);
unsigned width = tm.calculate_width(type);
- assert( 0 == f_tmp_stack.size() );
algebraic_from_int_const(width); // rhs
algebraic_from_int_const(width); // lhs
- flush_operands();
/* fix type stack, constants are always unsigned */
f_type_stack.pop_back();
View
20 src/model/compilers/internals.cc
@@ -44,26 +44,25 @@
f_add_stack.pop_back(); \
}
-#define PUSH_ADD_DDS(store, count) \
+#define PUSH_DDS(store, count) \
for (unsigned i = 0; i < (count); ++ i) { \
unsigned ndx = (count) - i - 1; \
f_add_stack.push_back((store) [ndx]); \
}
#define ALGEBRIZE_ONE(top, width) \
- { \
+ do { \
algebrize_operand((top), (width)); \
- }
+ } while (0)
#define ALGEBRIZE_TWO(rhs, lhs, width) \
- { \
+ do { \
ADD tmp[(width)]; \
algebrize_operand((rhs), (width)); \
FETCH_DDS(tmp, (width)); \
algebrize_operand((lhs), (width)); \
- PUSH_ADD_DDS(tmp, (width)); \
- }
-
+ PUSH_DDS(tmp, (width)); \
+ } while (0)
void Compiler::algebrize_operand(Type_ptr type, unsigned final_width)
{
@@ -256,7 +255,7 @@ void Compiler::algebraic_from_int_const(unsigned width)
}
for (unsigned i = 0; i < width; ++ i) {
ADD digit = f_enc.constant(value % base);
- f_tmp_stack.push_back(digit);
+ f_add_stack.push_back(digit);
value /= base;
}
@@ -803,9 +802,4 @@ Type_ptr Compiler::algebraic_make_int_of_fxd_type(Type_ptr type)
void Compiler::flush_operands()
{
- for (ADDStack::reverse_iterator ri = f_tmp_stack.rbegin();
- f_tmp_stack.rend() != ri; ++ ri) {
- PUSH_ADD(*ri);
- }
- f_tmp_stack.clear();
}

0 comments on commit e050420

Please sign in to comment.
Something went wrong with that request. Please try again.