00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SAIL_INSTRUCTION_H_
00009 #define SAIL_INSTRUCTION_H_
00010
00011 #include <boost/serialization/vector.hpp>
00012 #include <boost/serialization/map.hpp>
00013 #include <boost/serialization/list.hpp>
00014 #include <boost/serialization/string.hpp>
00015 #include <boost/serialization/version.hpp>
00016 #include <boost/serialization/split_member.hpp>
00017 #include <boost/serialization/shared_ptr.hpp>
00018 #include <boost/serialization/base_object.hpp>
00019 #include <boost/serialization/export.hpp>
00020 #include <boost/serialization/set.hpp>
00021
00022 #include <set>
00023 #include <string>
00024 using namespace std;
00025
00026 namespace il{class node;}
00027
00028 namespace sail {
00029
00030 class Variable;
00031 class Symbol;
00032
00033 enum instruction_type
00034 {
00035 ADDRESS_LABEL,
00036 ADDRESS_VAR,
00037 ADDRESS_STRING,
00038 ARRAY_REF_READ,
00039 ARRAY_REF_WRITE,
00040 SAIL_ASSEMBLY,
00041 ASSIGNMENT,
00042 BINOP,
00043 BRANCH,
00044 CAST,
00045 FIELD_REF_READ,
00046 FIELD_REF_WRITE,
00047 FUNCTION_CALL,
00048 FUNCTION_POINTER_CALL,
00049 JUMP,
00050 SAIL_LABEL,
00051 LOAD,
00052 STORE,
00053 UNOP,
00054 LOOP_INVOCATION,
00055 DROP_TEMPORARY,
00056 STATIC_ASSERT,
00057 ASSUME,
00058 ASSUME_SIZE
00059 };
00060
00065 class Instruction {
00066 friend class boost::serialization::access;
00067
00068 template<class Archive>
00069 void serialize(Archive & ar, const unsigned int version)
00070 {
00071 ar & original;
00072 ar & inst_id;
00073 ar & line;
00074 }
00075 protected:
00076 il::node* original;
00077 instruction_type inst_id;
00078 public:
00079 int line;
00080
00081 public:
00082 Instruction();
00083 virtual string to_string() const = 0;
00084 virtual string to_string(bool pretty_print) const = 0;
00085
00092 il::node* get_original_node();
00093
00094 virtual bool is_save_instruction();
00095
00101 virtual instruction_type get_instruction_id();
00102
00103
00112 virtual bool is_removable() = 0;
00113
00114
00115 virtual ~Instruction();
00116
00117
00118
00119
00120 void get_rhs_symbols(set<Symbol*>& syms);
00121
00122
00123
00124
00125 void get_symbols(set<Symbol*>& syms);
00126 };
00127
00128 }
00129
00130 #endif