00001 #ifndef BINOP_EXPRESSION_H_
00002 #define BINOP_EXPRESSION_H_
00003
00004 #include "expression.h"
00005
00006 namespace il
00007 {
00008
00009
00010
00011
00012
00013
00017 enum binop_type{
00018 _PLUS, _MINUS, _MULTIPLY,_DIV, _MOD,
00019 _POINTER_PLUS,
00020 _LT, _LEQ, _GT, _GEQ,
00021 _EQ, _NEQ,
00022 _REAL_DIV,
00023 _LEFT_SHIFT, _RIGHT_SHIFT,
00024 _BITWISE_OR, _BITWISE_AND, _BITWISE_XOR,
00025 _LOGICAL_AND, _LOGICAL_OR,
00026 _LOGICAL_AND_NO_SHORTCIRCUIT, _LOGICAL_OR_NO_SHORTCIRCUIT,
00027 _VEC_BINOP
00028 };
00029
00030
00034 class binop_expression : public il::expression
00035 {
00036
00037 friend class boost::serialization::access;
00038
00039 template<class Archive>
00040 void serialize(Archive & ar, const unsigned int version)
00041 {
00042 ar & boost::serialization::base_object<il::expression>(*this);
00043 ar & exp1;
00044 ar & exp2;
00045 ar & op;
00046 }
00047
00048
00049 private:
00050 expression* exp1;
00051 expression* exp2;
00052 binop_type op;
00053 public:
00054 binop_expression();
00055 binop_expression(expression* exp1, expression* exp2, binop_type op,
00056 type* t, location loc);
00057 virtual string to_string() const;
00058 virtual binop_type get_operator();
00059 void set_first_operand(expression* op1);
00060 void set_second_operand(expression* op2);
00061 virtual expression* get_first_operand();
00062 virtual expression* get_second_operand();
00063 virtual bool is_vector_binop();
00064 static string binop_to_string(binop_type op);
00065 virtual ~binop_expression();
00066
00067 static bool is_predicate_binop(il::binop_type bt);
00068
00069 };
00070
00071 }
00072
00073 #endif