Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB

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