Remove unused LLVMBasicBlock class
[frida/frida.git] / src / core / BasicBlock.hxx
1 #ifndef INCLUDE__BasicBlock_hxx
2 #define INCLUDE__BasicBlock_hxx
3
4 #include <cassert>
5 #include <string>
6 #include <sstream>
7
8 class Disassembler;
9
10 class BasicBlock {
11 public:
12 BasicBlock(uint64_t start_address, Disassembler * disassembler)
13 : start_address(start_address)
14 , disassembler(disassembler) {
15 next_blocks[0] = 0;
16 next_blocks[1] = 0;
17 }
18
19 uint64_t getStartAddress() const {
20 return start_address;
21 }
22
23 uint64_t getEndAddress() const {
24 return end_address;
25 }
26
27 uint64_t getNextBlock(size_t index) const {
28 assert(index < 2);
29 return next_blocks[index];
30 }
31
32 void setNextBlock(size_t index, uint64_t address) {
33 assert(index < 2);
34 next_blocks[index] = address;
35 }
36
37 void setStartAddress(uint64_t address) {
38 start_address = address;
39 }
40
41 void setEndAddress(uint64_t address) {
42 end_address = address;
43 }
44
45 std::string getName() {
46 std::stringstream s;
47 s << "BLOCK_" << std::hex << start_address << '_' << end_address;
48 return s.str();
49 }
50
51 Disassembler * getDisassembler() {
52 return disassembler;
53 }
54
55 private:
56 uint64_t start_address;
57 uint64_t end_address;
58 Disassembler* disassembler;
59 uint64_t next_blocks[2];
60 };
61
62 #endif