Allow creation of single-byte MCAtoms.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Wed, 19 Jun 2013 20:18:59 +0000 (20:18 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Wed, 19 Jun 2013 20:18:59 +0000 (20:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184344 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCModule.cpp
lib/MC/MCObjectDisassembler.cpp

index 17619d9392e337c11084e37d27a27aac896be182..5890b4bd028b583760581b2502d46522fd5fc30b 100644 (file)
@@ -21,7 +21,7 @@ static bool AtomComp(const MCAtom *L, uint64_t Addr) {
 void MCModule::map(MCAtom *NewAtom) {
   uint64_t Begin = NewAtom->Begin;
 
-  assert(Begin < NewAtom->End && "Creating MCAtom with endpoints reversed?");
+  assert(Begin <= NewAtom->End && "Creating MCAtom with endpoints reversed?");
 
   // Check for atoms already covering this range.
   AtomListTy::iterator I = std::lower_bound(atom_begin(), atom_end(),
index bb3de1779e1642a336b83e729741e0b4d751f52b..1ea6eed3078046f7fe408a434e5a2503a38761fa 100644 (file)
@@ -126,6 +126,7 @@ void MCObjectDisassembler::buildCFG(MCModule *Module) {
     MCTextAtom *TA = dyn_cast<MCTextAtom>(*AI);
     if (!TA) continue;
     Calls.insert(TA->getBeginAddr());
+    BBInfos[TA->getBeginAddr()].Atom = TA;
     for (MCTextAtom::const_iterator II = TA->begin(), IE = TA->end();
          II != IE; ++II) {
       if (MIA.isTerminator(II->Inst))
@@ -145,7 +146,6 @@ void MCObjectDisassembler::buildCFG(MCModule *Module) {
     MCAtom *A = Module->findAtomContaining(*SI);
     if (!A) continue;
     MCTextAtom *TA = cast<MCTextAtom>(A);
-    BBInfos[TA->getBeginAddr()].Atom = TA;
     if (TA->getBeginAddr() == *SI)
       continue;
     MCTextAtom *NewAtom = TA->split(*SI);