#ifndef LLVM_MC_MCANALYSIS_MCMODULE_H
#define LLVM_MC_MCANALYSIS_MCMODULE_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <memory>
#include <vector>
namespace llvm {
class MCAtom;
class MCBasicBlock;
class MCDataAtom;
class MCFunction;
class MCObjectDisassembler;
class MCTextAtom;
class MCModule {
typedef std::vector<MCAtom*> AtomListTy;
AtomListTy Atoms;
friend class MCAtom;
void remap(MCAtom *Atom, uint64_t NewBegin, uint64_t NewEnd);
void map(MCAtom *NewAtom);
typedef std::vector<MCBasicBlock*> BBsByAtomTy;
BBsByAtomTy BBsByAtom;
friend class MCBasicBlock;
friend class MCTextAtom;
void trackBBForAtom(const MCTextAtom *Atom, MCBasicBlock *BBBackedByAtom);
void splitBasicBlocksForAtom(const MCTextAtom *TA, const MCTextAtom *NewTA);
typedef std::vector<std::unique_ptr<MCFunction>> FunctionListTy;
FunctionListTy Functions;
uint64_t Entrypoint;
MCModule (const MCModule &) LLVM_DELETED_FUNCTION;
MCModule& operator=(const MCModule &) LLVM_DELETED_FUNCTION;
friend class MCObjectDisassembler;
public:
MCModule();
~MCModule();
MCTextAtom *createTextAtom(uint64_t Begin, uint64_t End);
MCDataAtom *createDataAtom(uint64_t Begin, uint64_t End);
const MCAtom *findAtomContaining(uint64_t Addr) const;
MCAtom *findAtomContaining(uint64_t Addr);
const MCAtom *findFirstAtomAfter(uint64_t Addr) const;
MCAtom *findFirstAtomAfter(uint64_t Addr);
typedef AtomListTy::const_iterator const_atom_iterator;
typedef AtomListTy:: iterator atom_iterator;
const_atom_iterator atom_begin() const { return Atoms.begin(); }
atom_iterator atom_begin() { return Atoms.begin(); }
const_atom_iterator atom_end() const { return Atoms.end(); }
atom_iterator atom_end() { return Atoms.end(); }
MCFunction *createFunction(StringRef Name);
typedef FunctionListTy::const_iterator const_func_iterator;
typedef FunctionListTy:: iterator func_iterator;
const_func_iterator func_begin() const { return Functions.begin(); }
func_iterator func_begin() { return Functions.begin(); }
const_func_iterator func_end() const { return Functions.end(); }
func_iterator func_end() { return Functions.end(); }
uint64_t getEntrypoint() const { return Entrypoint; }
};
}
#endif