diff options
Diffstat (limited to 'lib/MC/MCAtom.cpp')
-rw-r--r-- | lib/MC/MCAtom.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/MC/MCAtom.cpp b/lib/MC/MCAtom.cpp index 2626b39..bc353cd 100644 --- a/lib/MC/MCAtom.cpp +++ b/lib/MC/MCAtom.cpp @@ -14,6 +14,9 @@ using namespace llvm; +// Pin the vtable to this file. +void MCAtom::anchor() {} + void MCAtom::remap(uint64_t NewBegin, uint64_t NewEnd) { Parent->remap(this, NewBegin, NewEnd); } @@ -44,7 +47,7 @@ void MCAtom::remapForSplit(uint64_t SplitPt, void MCDataAtom::addData(const MCData &D) { Data.push_back(D); - if (Data.size() > Begin - End) + if (Data.size() > End + 1 - Begin) remap(Begin, End + 1); } @@ -72,8 +75,8 @@ MCDataAtom *MCDataAtom::split(uint64_t SplitPt) { // MCTextAtom void MCTextAtom::addInst(const MCInst &I, uint64_t Size) { - if (NextInstAddress > End) - remap(Begin, NextInstAddress); + if (NextInstAddress + Size - 1 > End) + remap(Begin, NextInstAddress + Size - 1); Insts.push_back(MCDecodedInst(I, NextInstAddress, Size)); NextInstAddress += Size; } @@ -106,5 +109,6 @@ MCTextAtom *MCTextAtom::split(uint64_t SplitPt) { std::copy(I, Insts.end(), std::back_inserter(RightAtom->Insts)); Insts.erase(I, Insts.end()); + Parent->splitBasicBlocksForAtom(this, RightAtom); return RightAtom; } |