diff options
author | Logan Chien <loganchien@google.com> | 2011-10-20 00:08:13 +0800 |
---|---|---|
committer | Logan Chien <loganchien@google.com> | 2011-10-20 00:09:35 +0800 |
commit | 0ebc07a576037e4e36f68bf5cece32740ca120c0 (patch) | |
tree | c2e40648043d01498ee25af839a071193561e425 /include/llvm/MC/MCModule.h | |
parent | 62383e889e0b06fd12a6b88311717cd33a1925c4 (diff) | |
parent | cdd8e46bec4e975d00a5abea808d8eb4138515c5 (diff) | |
download | external_llvm-0ebc07a576037e4e36f68bf5cece32740ca120c0.tar.gz external_llvm-0ebc07a576037e4e36f68bf5cece32740ca120c0.tar.bz2 external_llvm-0ebc07a576037e4e36f68bf5cece32740ca120c0.zip |
Merge with LLVM upstream 2011/10/20 (r142530)
Conflicts:
lib/Support/Unix/Host.inc
Change-Id: Idc00db3b63912dca6348bddd9f8a1af2a8d5d147
Diffstat (limited to 'include/llvm/MC/MCModule.h')
-rw-r--r-- | include/llvm/MC/MCModule.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/llvm/MC/MCModule.h b/include/llvm/MC/MCModule.h new file mode 100644 index 0000000000..755fa025fb --- /dev/null +++ b/include/llvm/MC/MCModule.h @@ -0,0 +1,58 @@ +//===-- llvm/MC/MCModule.h - MCModule class ---------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the declaration of the MCModule class, which is used to +// represent a complete, disassembled object file or executable. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCMODULE_H +#define LLVM_MC_MCMODULE_H + +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/IntervalMap.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/Support/DataTypes.h" + +namespace llvm { + +class MCAtom; + +/// MCModule - This class represent a completely disassembled object file or +/// executable. It comprises a list of MCAtom's, and a branch target table. +/// Each atom represents a contiguous range of either instructions or data. +class MCModule { + /// AtomAllocationTracker - An MCModule owns its component MCAtom's, so it + /// must track them in order to ensure they are properly freed as atoms are + /// merged or otherwise manipulated. + SmallPtrSet<MCAtom*, 8> AtomAllocationTracker; + + /// OffsetMap - Efficiently maps offset ranges to MCAtom's. + IntervalMap<uint64_t, MCAtom*> OffsetMap; + + /// BranchTargetMap - Maps offsets that are determined to be branches and + /// can be statically resolved to their target offsets. + DenseMap<uint64_t, MCAtom*> BranchTargetMap; + + friend class MCAtom; + + /// remap - Update the interval mapping for an MCAtom. + void remap(MCAtom *Atom, uint64_t NewBegin, uint64_t NewEnd); + +public: + MCModule(IntervalMap<uint64_t, MCAtom*>::Allocator &A) : OffsetMap(A) { } + + /// createAtom - Creates a new MCAtom covering the specified offset range. + MCAtom *createAtom(MCAtom::AtomType Type, uint64_t Begin, uint64_t End); +}; + +} + +#endif + |