18 void MCAtom::anchor() {}
21 Parent->remap(
this, NewBegin, NewEnd);
25 assert((TruncPt >=
Begin && TruncPt <
End) &&
26 "Truncation point not contained in atom!");
31 uint64_t &LBegin, uint64_t &LEnd,
32 uint64_t &RBegin, uint64_t &REnd) {
33 assert((SplitPt >
Begin && SplitPt <=
End) &&
34 "Splitting at point not contained in atom!");
57 Data.resize(TruncPt -
Begin + 1);
61 uint64_t LBegin, LEnd, RBegin, REnd;
67 std::vector<MCData>::iterator
I = Data.begin() + (RBegin - LBegin);
68 assert(I != Data.end() &&
"Split point not found in range!");
70 std::copy(I, Data.end(), std::back_inserter(RightAtom->Data));
71 Data.erase(I, Data.end());
78 if (NextInstAddress + Size - 1 >
End)
81 NextInstAddress += Size;
87 InstListTy::iterator
I = Insts.begin();
88 while (I != Insts.end() && I->Address <= TruncPt) ++I;
90 assert(I != Insts.end() &&
"Truncation point not found in disassembly!");
91 assert(I->Address == TruncPt + 1 &&
92 "Truncation point does not fall on instruction boundary");
94 Insts.erase(I, Insts.end());
98 uint64_t LBegin, LEnd, RBegin, REnd;
104 InstListTy::iterator
I = Insts.begin();
105 while (I != Insts.end() && I->Address < SplitPt) ++I;
106 assert(I != Insts.end() &&
"Split point not found in disassembly!");
107 assert(I->Address == SplitPt &&
108 "Split point does not fall on instruction boundary!");
110 std::copy(I, Insts.end(), std::back_inserter(RightAtom->Insts));
111 Insts.erase(I, Insts.end());
112 Parent->splitBasicBlocksForAtom(
this, RightAtom);
void truncate(uint64_t TruncPt) LLVM_OVERRIDE
Truncates an atom, discarding everything after TruncPt.
An atom consisting of disassembled instructions.
StringRef getName() const
MCDataAtom * split(uint64_t SplitPt) LLVM_OVERRIDE
Splits the atom in two at a given address.
uint8_t MCData
An entry in an MCDataAtom.
void addInst(const MCInst &Inst, uint64_t Size)
Append an instruction, expanding the atom if necessary.
void remapForSplit(uint64_t SplitPt, uint64_t &LBegin, uint64_t &LEnd, uint64_t &RBegin, uint64_t &REnd)
Remap the atom to prepare for a split at SplitPt. The bounds for the resulting atoms are returned in ...
An atom consising of a sequence of bytes.
An entry in an MCTextAtom: a disassembled instruction. NOTE: Both the Address and Size field are actu...
MCDataAtom * createDataAtom(uint64_t Begin, uint64_t End)
MCTextAtom * createTextAtom(uint64_t Begin, uint64_t End)
void remap(uint64_t NewBegin, uint64_t NewEnd)
Remap the atom, using the given range, updating Begin/End. One or both of the bounds can remain the s...
void setName(StringRef NewName)
void remapForTruncate(uint64_t TruncPt)
Remap the atom to prepare for a truncation at TruncPt. Equivalent to:
void truncate(uint64_t TruncPt) LLVM_OVERRIDE
Truncates an atom, discarding everything after TruncPt.
MCTextAtom * split(uint64_t SplitPt) LLVM_OVERRIDE
Splits the atom in two at a given address.
void addData(const MCData &D)
Append a data entry, expanding the atom if necessary.