diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-08-21 07:28:07 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-08-21 07:28:07 +0000 |
commit | cdef37a9d8d559042fe43d8ae91d4b65f281df69 (patch) | |
tree | 2454f18c8cfa422d9d0bb84d1ed67db45dd24a46 /include/llvm/MC/MCObjectSymbolizer.h | |
parent | 07e8f8f64308239ba9f707c869e0f0e53071a992 (diff) | |
download | external_llvm-cdef37a9d8d559042fe43d8ae91d4b65f281df69.tar.gz external_llvm-cdef37a9d8d559042fe43d8ae91d4b65f281df69.tar.bz2 external_llvm-cdef37a9d8d559042fe43d8ae91d4b65f281df69.zip |
MC: Refactor ObjectSymbolizer to make relocation/section info generation lazy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCObjectSymbolizer.h')
-rw-r--r-- | include/llvm/MC/MCObjectSymbolizer.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/include/llvm/MC/MCObjectSymbolizer.h b/include/llvm/MC/MCObjectSymbolizer.h index 555cf5195d..7d70dfd56b 100644 --- a/include/llvm/MC/MCObjectSymbolizer.h +++ b/include/llvm/MC/MCObjectSymbolizer.h @@ -32,22 +32,14 @@ class MCObjectSymbolizer : public MCSymbolizer { protected: const object::ObjectFile *Obj; - typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap; - typedef std::vector<object::SectionRef> SortedSectionList; - SortedSectionList SortedSections; - // Map a load address to the first relocation that applies there. As far as I // know, if there are several relocations at the exact same address, they are // related and the others can be determined from the first that was found in // the relocation table. For instance, on x86-64 mach-o, a SUBTRACTOR // relocation (referencing the minuend symbol) is followed by an UNSIGNED // relocation (referencing the subtrahend symbol). - AddrToRelocMap AddrToReloc; - - // Helpers around SortedSections. - SortedSectionList::const_iterator findSectionContaining(uint64_t Addr) const; - void insertSection(object::SectionRef Section); - + const object::RelocationRef *findRelocationAt(uint64_t Addr); + const object::SectionRef *findSectionContaining(uint64_t Addr); MCObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo, const object::ObjectFile *Obj); @@ -56,9 +48,9 @@ public: /// \name Overridden MCSymbolizer methods: /// @{ bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &cStream, - int64_t Value, - uint64_t Address, bool IsBranch, - uint64_t Offset, uint64_t InstSize); + int64_t Value, uint64_t Address, + bool IsBranch, uint64_t Offset, + uint64_t InstSize); void tryAddingPcLoadReferenceComment(raw_ostream &cStream, int64_t Value, uint64_t Address); @@ -68,6 +60,15 @@ public: static MCObjectSymbolizer * createObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo, const object::ObjectFile *Obj); + +private: + typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap; + typedef std::vector<object::SectionRef> SortedSectionList; + SortedSectionList SortedSections; + AddrToRelocMap AddrToReloc; + + void buildSectionList(); + void buildRelocationByAddrMap(); }; } |