1 #ifndef ROSE_DISASSEMBLER_PARTITIONER_H
2 #define ROSE_DISASSEMBLER_PARTITIONER_H
8 #define INFINITY (DBL_MAX+DBL_MAX)
9 #define NAN (INFINITY-INFINITY)
271 std::vector<SgAsmStaticData*>
nodes;
540 static unsigned parse_switches(
const std::string&,
unsigned initial_flags);
553 virtual void clear();
557 virtual void load_config(
const std::string &filename);
593 virtual Instruction*
discard(Instruction*,
bool discard_entire_block=
false);
598 virtual BasicBlock *
discard(BasicBlock*);
722 : name(name), desc(desc), weight(weight) {}
753 static size_t define_analysis(
const std::string &
name,
const std::string &desc,
double weight,
size_t id=(
size_t)(-1));
756 static const std::string&
get_name(
size_t id);
757 static const std::string&
get_desc(
size_t id);
760 virtual void add_sample(
size_t id,
double val,
size_t nsamples=1);
762 virtual double get_sum(
size_t id)
const;
763 virtual double get_value(
size_t id)
const;
765 virtual void set_value(
size_t id,
double val);
767 double divnan(
size_t num_id,
size_t den_id)
const;
771 virtual void print(std::ostream&)
const;
845 DictionaryEntry(
const std::string &name,
const std::string &desc): name(name), desc(desc) {}
865 init(mean, variance, threshold);
870 static size_t define_criterion(
const std::string &name,
const std::string &desc,
size_t id=(
size_t)(-1));
873 static const std::string&
get_name(
size_t id);
874 static const std::string&
get_desc(
size_t id);
876 virtual double get_mean(
size_t id)
const;
877 virtual void set_mean(
size_t id,
double mean);
881 virtual void set_weight(
size_t id,
double weight);
882 void set_value(
size_t id,
double mean,
double variance,
double weight) {
893 virtual void print(std::ostream&,
const RegionStats *stats=NULL,
const std::vector<double> *votes=NULL,
894 const double *total_vote=NULL)
const;
1039 : partitioner(partitioner), insn_prev(insn_prev), insn_begin(insn_begin), insn_end(insn_end),
1051 virtual bool operator()(
bool enabled,
const Args &args) = 0;
1061 : partitioner(partitioner), restrict_map(restrict_map), ranges(ranges), range(range) {}
1071 virtual bool operator()(
bool enabled,
const Args &args) = 0;
1221 virtual bool operator()(
bool enabled,
const Args &args);
1235 virtual bool operator()(
bool enabled,
const Args &args);
1290 virtual bool operator()(
bool enabled,
const Args &args);
1334 virtual bool operator()(
bool enabled,
const Args &args);
1350 virtual bool operator()(
bool enabled,
const Args &args);
1369 virtual bool operator()(
bool enabled,
const Args &args);
1381 virtual bool operator()(
bool enabled,
const Args &args);
1396 virtual bool operator()(
bool enabled,
const Args &args);
1413 static InstructionMap::const_iterator pattern2(
const InstructionMap&
insns, InstructionMap::const_iterator first,
1418 static InstructionMap::const_iterator pattern3(
const InstructionMap&
insns, InstructionMap::const_iterator first,
1762 : partitioner(p), input(input), len(len), input_name(input_name), at(0), cur_func(NULL), cur_block(NULL) {}
1768 : std::runtime_error(mesg), lnum(0) {}
1770 : std::runtime_error(mesg), name(name), lnum(lnum) {}
1772 std::string format()
const;
1780 static void unparse(std::ostream&,
SgNode *ast);
1790 bool is_terminal(
const char *to_match);
1791 bool is_symbol(
const char *to_match);
1797 void match_terminal(
const char *to_match);
1798 void match_symbol(
const char *to_match);
1799 std::string match_symbol();
1800 std::string match_string();
1802 std::string match_asm();
1812 bool parse_Declaration();
1813 bool parse_FuncDecl();
1814 bool parse_FuncBody();
1815 bool parse_FuncStmtList();
1816 bool parse_FuncStmt();
1817 bool parse_ReturnSpec();
1818 bool parse_BlockDecl();
1819 bool parse_BlockBody();
1820 bool parse_BlockStmtList();
1821 bool parse_BlockStmt();
1823 bool parse_Successors();