Use target addresses for basic block linking
authorChristoph Egger <siccegge@cs.fau.de>
Tue, 27 May 2014 11:21:36 +0000 (13:21 +0200)
committerChristoph Egger <siccegge@cs.fau.de>
Tue, 27 May 2014 11:21:36 +0000 (13:21 +0200)
src/disassembler/BasicBlock.hxx

index c994d9ea02c77373f8c5f81a2ade0cf2516b9508..1952f2bdac8d2732585b2f76cd50a778da2d9069 100644 (file)
@@ -1,9 +1,14 @@
 #ifndef INCLUDE__BasicBlock_hxx
 #define INCLUDE__BasicBlock_hxx
 
+#include <cassert>
+
 class BasicBlock {
 public:
-    BasicBlock() {}
+    BasicBlock() {
+               next_blocks[0] = 0;
+               next_blocks[1] = 0;
+       }
 
     uint64_t getStartAddress() const {
         return start_address;
@@ -13,8 +18,14 @@ public:
         return end_address;
     }
 
-       BasicBlock * const * getNextBlocks() const {
-               return next_blocks;
+       uint64_t getNextBlock(size_t index) const {
+               assert(index < 2);
+               return next_blocks[index];
+       }
+
+       void setNextBlock(size_t index, uint64_t address) {
+               assert(index < 2);
+               next_blocks[index] = address;
        }
 
        void setStartAddress(uint64_t address) {
@@ -29,7 +40,7 @@ private:
     uint64_t start_address;
     uint64_t end_address;
 
-    BasicBlock * next_blocks[2];
+    uint64_t next_blocks[2];
 };
 
 #endif