diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-24 03:43:40 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-24 03:43:40 +0000 |
commit | 0df7c5cb1aa5e78af335c36ba830a2401c2eaec3 (patch) | |
tree | 7cbe12687a4f117def1297781e615368454c7a9e /include/llvm | |
parent | d2560964a3e920821da3cbfe4c06fb6b0b73ae8e (diff) | |
download | external_llvm-0df7c5cb1aa5e78af335c36ba830a2401c2eaec3.zip external_llvm-0df7c5cb1aa5e78af335c36ba830a2401c2eaec3.tar.gz external_llvm-0df7c5cb1aa5e78af335c36ba830a2401c2eaec3.tar.bz2 |
MC: Direct all {fragment,section,symbol} address access through the MCAsmLayout object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/MC/MCAsmLayout.h | 11 | ||||
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 10 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectWriter.h | 5 | ||||
-rw-r--r-- | include/llvm/MC/MachObjectWriter.h | 3 |
4 files changed, 23 insertions, 6 deletions
diff --git a/include/llvm/MC/MCAsmLayout.h b/include/llvm/MC/MCAsmLayout.h index 27bdbe9..2c26ff0 100644 --- a/include/llvm/MC/MCAsmLayout.h +++ b/include/llvm/MC/MCAsmLayout.h @@ -12,6 +12,9 @@ namespace llvm { class MCAssembler; +class MCFragment; +class MCSectionData; +class MCSymbolData; /// Encapsulates the layout of an assembly file at a particular point in time. /// @@ -29,6 +32,14 @@ public: /// Get the assembler object this is a layout for. MCAssembler &getAssembler() const { return Assembler; } + + uint64_t getFragmentAddress(const MCFragment *F) const; + + uint64_t getSectionAddress(const MCSectionData *SD) const; + + uint64_t getSymbolAddress(const MCSymbolData *SD) const; + + void setSectionAddress(MCSectionData *SD, uint64_t Value); }; } // end namespace llvm diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index d14122b..54c91a2 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -699,15 +699,17 @@ public: /// Find the symbol which defines the atom containing given address, inside /// the given section, or null if there is no such symbol. // - // FIXME: Eliminate this, it is very slow. - const MCSymbolData *getAtomForAddress(const MCSectionData *Section, + // FIXME-PERF: Eliminate this, it is very slow. + const MCSymbolData *getAtomForAddress(const MCAsmLayout &Layout, + const MCSectionData *Section, uint64_t Address) const; /// Find the symbol which defines the atom containing the given symbol, or /// null if there is no such symbol. // - // FIXME: Eliminate this, it is very slow. - const MCSymbolData *getAtom(const MCSymbolData *Symbol) const; + // FIXME-PERF: Eliminate this, it is very slow. + const MCSymbolData *getAtom(const MCAsmLayout &Layout, + const MCSymbolData *Symbol) const; /// Check whether a particular symbol is visible to the linker and is required /// in the symbol table, or whether it can be discarded by the assembler. This diff --git a/include/llvm/MC/MCObjectWriter.h b/include/llvm/MC/MCObjectWriter.h index 0316f51..f70a3d1 100644 --- a/include/llvm/MC/MCObjectWriter.h +++ b/include/llvm/MC/MCObjectWriter.h @@ -16,6 +16,7 @@ namespace llvm { class MCAsmFixup; +class MCAsmLayout; class MCAssembler; class MCFragment; class MCValue; @@ -69,6 +70,7 @@ public: /// information about the relocation so that it can be emitted during /// WriteObject(). virtual void RecordRelocation(const MCAssembler &Asm, + const MCAsmLayout &Layout, const MCFragment *Fragment, const MCAsmFixup &Fixup, MCValue Target, uint64_t &FixedValue) = 0; @@ -78,7 +80,8 @@ public: /// This routine is called by the assembler after layout and relaxation is /// complete, fixups have been evaluate and applied, and relocations /// generated. - virtual void WriteObject(const MCAssembler &Asm) = 0; + virtual void WriteObject(const MCAssembler &Asm, + const MCAsmLayout &Layout) = 0; /// @} /// @name Binary Output diff --git a/include/llvm/MC/MachObjectWriter.h b/include/llvm/MC/MachObjectWriter.h index c2edf63..844025d 100644 --- a/include/llvm/MC/MachObjectWriter.h +++ b/include/llvm/MC/MachObjectWriter.h @@ -31,11 +31,12 @@ public: virtual void ExecutePostLayoutBinding(MCAssembler &Asm); virtual void RecordRelocation(const MCAssembler &Asm, + const MCAsmLayout &Layout, const MCFragment *Fragment, const MCAsmFixup &Fixup, MCValue Target, uint64_t &FixedValue); - virtual void WriteObject(const MCAssembler &Asm); + virtual void WriteObject(const MCAssembler &Asm, const MCAsmLayout &Layout); }; } // End llvm namespace |