diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-16 18:23:53 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-16 18:23:53 +0000 |
commit | f230df9af4012f9510de664b6d62b128e26a5861 (patch) | |
tree | 459a596099278874a963dabafad21e27da5046eb /lib/Target/X86/X86AsmBackend.cpp | |
parent | cb2caf738023c0a03f5df1b909431129a16e2c54 (diff) |
Add a MCObjectFormat class so that code common to all targets that use a
single object format can be shared.
This also adds support for
mov zed+(bar-foo), %eax
on ELF and COFF targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86AsmBackend.cpp')
-rw-r--r-- | lib/Target/X86/X86AsmBackend.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp index e641500abf..853d3ed159 100644 --- a/lib/Target/X86/X86AsmBackend.cpp +++ b/lib/Target/X86/X86AsmBackend.cpp @@ -14,6 +14,7 @@ #include "llvm/MC/ELFObjectWriter.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCSectionELF.h" @@ -186,15 +187,20 @@ bool X86AsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const { namespace { class ELFX86AsmBackend : public X86AsmBackend { + MCELFObjectFormat Format; + public: Triple::OSType OSType; ELFX86AsmBackend(const Target &T, Triple::OSType _OSType) : X86AsmBackend(T), OSType(_OSType) { - HasAbsolutizedSet = true; HasScatteredSymbols = true; HasReliableSymbolDifference = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + virtual bool doesSectionRequireSymbols(const MCSection &Section) const { const MCSectionELF &ES = static_cast<const MCSectionELF&>(Section); return ES.getFlags() & MCSectionELF::SHF_MERGE; @@ -242,6 +248,8 @@ public: class WindowsX86AsmBackend : public X86AsmBackend { bool Is64Bit; + MCCOFFObjectFormat Format; + public: WindowsX86AsmBackend(const Target &T, bool is64Bit) : X86AsmBackend(T) @@ -249,6 +257,10 @@ public: HasScatteredSymbols = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + unsigned getPointerSize() const { if (Is64Bit) return 8; @@ -267,13 +279,18 @@ public: }; class DarwinX86AsmBackend : public X86AsmBackend { + MCMachOObjectFormat Format; + public: DarwinX86AsmBackend(const Target &T) : X86AsmBackend(T) { - HasAbsolutizedSet = true; HasScatteredSymbols = true; } + virtual const MCObjectFormat &getObjectFormat() const { + return Format; + } + bool isVirtualSection(const MCSection &Section) const { const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section); return (SMO.getType() == MCSectionMachO::S_ZEROFILL || |