-
Notifications
You must be signed in to change notification settings - Fork 17
/
bb.h
59 lines (45 loc) · 2.04 KB
/
bb.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef NUCLEUS_BB_H
#define NUCLEUS_BB_H
#include <stdio.h>
#include <stdint.h>
#include <list>
#include "insn.h"
#include "edge.h"
#include "loader.h"
class Function;
class BB {
public:
BB() : start(0), end(0), function(NULL), section(NULL), score(0.0),
alive(false), invalid(false), privileged(false), addrtaken(false), padding(false), trap(false) {}
BB(const BB &bb) : start(bb.start), end(bb.end), insns(bb.insns), function(bb.function), section(bb.section), score(bb.score),
alive(bb.alive), invalid(bb.invalid), privileged(bb.privileged), addrtaken(bb.addrtaken), padding(bb.padding), trap(bb.trap),
ancestors(bb.ancestors), targets(bb.targets) {}
void reset() { start = 0; end = 0; insns.clear(); function = NULL; section = NULL; score = 0.0;
alive = false; invalid = false; privileged = false; addrtaken = false; padding = false; trap = false;
ancestors.clear(); targets.clear(); }
void set(uint64_t start, uint64_t end) { reset(); this->start = start; this->end = end; }
bool is_addrtaken () { return addrtaken; }
bool is_invalid () { return invalid; }
bool is_padding () { return padding; }
bool is_trap () { return trap; }
bool is_called ();
bool returns ();
void print(FILE *out);
static bool comparator (BB& bb, BB& cc) { return bb.start < cc.start; }
inline bool operator< (const BB& cc) const { return this->start < cc.start; }
uint64_t start;
uint64_t end;
std::list<Instruction> insns;
Function *function;
Section *section;
double score;
bool alive;
bool invalid;
bool privileged;
bool addrtaken;
bool padding;
bool trap;
std::list<Edge> ancestors;
std::list<Edge> targets;
};
#endif /* NUCLEUS_BB_H */