summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAnalysis/MCModule.cpp
diff options
context:
space:
mode:
authorSean Silva <chisophugis@gmail.com>2014-09-02 22:32:20 +0000
committerSean Silva <chisophugis@gmail.com>2014-09-02 22:32:20 +0000
commit888320e9fa5eb33194c066f68d50f1e73c5fff5e (patch)
treeb8f80b8ddec0931f35da1db7f83ea4aaf6889e77 /llvm/lib/MC/MCAnalysis/MCModule.cpp
parent79cc1e3ae7bc224fa948495ba2f1c02f4c0c84ea (diff)
downloadbcm5719-llvm-888320e9fa5eb33194c066f68d50f1e73c5fff5e.tar.gz
bcm5719-llvm-888320e9fa5eb33194c066f68d50f1e73c5fff5e.zip
Nuke MCAnalysis.
The code is buggy and barely tested. It is also mostly boilerplate. (This includes MCObjectDisassembler, which is the interface to that functionality) Following an IRC discussion with Jim Grosbach, it seems sensible to just nuke the whole lot of functionality, and dig it up from VCS if necessary (I hope not!). All of this stuff appears to have been added in a huge patch dump (look at the timeframe surrounding e.g. r182628) where almost every patch seemed to be untested and not reviewed before being committed. Post-review responses to the patches were never addressed. I don't think any of it would have passed pre-commit review. I doubt anyone is depending on this, since this code appears to be extremely buggy. In limited testing that Michael Spencer and I did, we couldn't find a single real-world object file that wouldn't crash the CFG reconstruction stuff. The symbolizer stuff has O(n^2) behavior and so is not much use to anyone anyway. It seemed simpler to remove them as a whole. Most of this code is boilerplate, which is the only way it was able to scrape by 60% coverage. HEADSUP: Modules folks, some files I nuked were referenced from include/llvm/module.modulemap; I just deleted the references. Hopefully that is the right fix (one was a FIXME though!). llvm-svn: 216983
Diffstat (limited to 'llvm/lib/MC/MCAnalysis/MCModule.cpp')
-rw-r--r--llvm/lib/MC/MCAnalysis/MCModule.cpp142
1 files changed, 0 insertions, 142 deletions
diff --git a/llvm/lib/MC/MCAnalysis/MCModule.cpp b/llvm/lib/MC/MCAnalysis/MCModule.cpp
deleted file mode 100644
index 7512299c9e0..00000000000
--- a/llvm/lib/MC/MCAnalysis/MCModule.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-//===- lib/MC/MCModule.cpp - MCModule implementation ----------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/MC/MCAnalysis/MCModule.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/MC/MCAnalysis/MCAtom.h"
-#include "llvm/MC/MCAnalysis/MCFunction.h"
-#include <algorithm>
-
-using namespace llvm;
-
-static bool AtomComp(const MCAtom *L, uint64_t Addr) {
- return L->getEndAddr() < Addr;
-}
-
-static bool AtomCompInv(uint64_t Addr, const MCAtom *R) {
- return Addr < R->getEndAddr();
-}
-
-void MCModule::map(MCAtom *NewAtom) {
- uint64_t Begin = NewAtom->Begin;
-
- 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(),
- Begin, AtomComp);
- assert((I == atom_end() || (*I)->getBeginAddr() > NewAtom->End)
- && "Offset range already occupied!");
-
- // Insert the new atom to the list.
- Atoms.insert(I, NewAtom);
-}
-
-MCTextAtom *MCModule::createTextAtom(uint64_t Begin, uint64_t End) {
- MCTextAtom *NewAtom = new MCTextAtom(this, Begin, End);
- map(NewAtom);
- return NewAtom;
-}
-
-MCDataAtom *MCModule::createDataAtom(uint64_t Begin, uint64_t End) {
- MCDataAtom *NewAtom = new MCDataAtom(this, Begin, End);
- map(NewAtom);
- return NewAtom;
-}
-
-// remap - Update the interval mapping for an atom.
-void MCModule::remap(MCAtom *Atom, uint64_t NewBegin, uint64_t NewEnd) {
- // Find and erase the old mapping.
- AtomListTy::iterator I = std::lower_bound(atom_begin(), atom_end(),
- Atom->Begin, AtomComp);
- assert(I != atom_end() && "Atom offset not found in module!");
- assert(*I == Atom && "Previous atom mapping was invalid!");
- Atoms.erase(I);
-
- // FIXME: special case NewBegin == Atom->Begin
-
- // Insert the new mapping.
- AtomListTy::iterator NewI = std::lower_bound(atom_begin(), atom_end(),
- NewBegin, AtomComp);
- assert((NewI == atom_end() || (*NewI)->getBeginAddr() > Atom->End)
- && "Offset range already occupied!");
- Atoms.insert(NewI, Atom);
-
- // Update the atom internal bounds.
- Atom->Begin = NewBegin;
- Atom->End = NewEnd;
-}
-
-const MCAtom *MCModule::findAtomContaining(uint64_t Addr) const {
- AtomListTy::const_iterator I = std::lower_bound(atom_begin(), atom_end(),
- Addr, AtomComp);
- if (I != atom_end() && (*I)->getBeginAddr() <= Addr)
- return *I;
- return nullptr;
-}
-
-MCAtom *MCModule::findAtomContaining(uint64_t Addr) {
- return const_cast<MCAtom*>(
- const_cast<const MCModule *>(this)->findAtomContaining(Addr));
-}
-
-const MCAtom *MCModule::findFirstAtomAfter(uint64_t Addr) const {
- AtomListTy::const_iterator I = std::upper_bound(atom_begin(), atom_end(),
- Addr, AtomCompInv);
- if (I != atom_end())
- return *I;
- return nullptr;
-}
-
-MCAtom *MCModule::findFirstAtomAfter(uint64_t Addr) {
- return const_cast<MCAtom*>(
- const_cast<const MCModule *>(this)->findFirstAtomAfter(Addr));
-}
-
-MCFunction *MCModule::createFunction(StringRef Name) {
- std::unique_ptr<MCFunction> MCF(new MCFunction(Name, this));
- Functions.push_back(std::move(MCF));
- return Functions.back().get();
-}
-
-static bool CompBBToAtom(MCBasicBlock *BB, const MCTextAtom *Atom) {
- return BB->getInsts() < Atom;
-}
-
-void MCModule::splitBasicBlocksForAtom(const MCTextAtom *TA,
- const MCTextAtom *NewTA) {
- BBsByAtomTy::iterator
- I = std::lower_bound(BBsByAtom.begin(), BBsByAtom.end(),
- TA, CompBBToAtom);
- for (; I != BBsByAtom.end() && (*I)->getInsts() == TA; ++I) {
- MCBasicBlock *BB = *I;
- MCBasicBlock *NewBB = &BB->getParent()->createBlock(*NewTA);
- BB->splitBasicBlock(NewBB);
- }
-}
-
-void MCModule::trackBBForAtom(const MCTextAtom *Atom, MCBasicBlock *BB) {
- assert(Atom == BB->getInsts() && "Text atom doesn't back the basic block!");
- BBsByAtomTy::iterator I = std::lower_bound(BBsByAtom.begin(),
- BBsByAtom.end(),
- Atom, CompBBToAtom);
- for (; I != BBsByAtom.end() && (*I)->getInsts() == Atom; ++I)
- if (*I == BB)
- return;
- BBsByAtom.insert(I, BB);
-}
-
-MCModule::MCModule() : Entrypoint(0) { }
-
-MCModule::~MCModule() {
- for (AtomListTy::iterator AI = atom_begin(),
- AE = atom_end();
- AI != AE; ++AI)
- delete *AI;
-}
OpenPOWER on IntegriCloud