1 //===-- llvm/MC/MCModule.h - MCModule class ---------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declaration of the MCModule class, which is used to
11 // represent a complete, disassembled object file or executable.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_MC_MCMODULE_H
16 #define LLVM_MC_MCMODULE_H
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/IntervalMap.h"
20 #include "llvm/ADT/SmallPtrSet.h"
21 #include "llvm/Support/DataTypes.h"
27 /// MCModule - This class represent a completely disassembled object file or
28 /// executable. It comprises a list of MCAtom's, and a branch target table.
29 /// Each atom represents a contiguous range of either instructions or data.
31 /// AtomAllocationTracker - An MCModule owns its component MCAtom's, so it
32 /// must track them in order to ensure they are properly freed as atoms are
33 /// merged or otherwise manipulated.
34 SmallPtrSet<MCAtom*, 8> AtomAllocationTracker;
36 /// OffsetMap - Efficiently maps offset ranges to MCAtom's.
37 IntervalMap<uint64_t, MCAtom*> OffsetMap;
39 /// BranchTargetMap - Maps offsets that are determined to be branches and
40 /// can be statically resolved to their target offsets.
41 DenseMap<uint64_t, MCAtom*> BranchTargetMap;
45 /// remap - Update the interval mapping for an MCAtom.
46 void remap(MCAtom *Atom, uint64_t NewBegin, uint64_t NewEnd);
49 MCModule(IntervalMap<uint64_t, MCAtom*>::Allocator &A) : OffsetMap(A) { }
51 /// createAtom - Creates a new MCAtom covering the specified offset range.
52 MCAtom *createAtom(MCAtom::AtomType Type, uint64_t Begin, uint64_t End);