[llvm-commits] [llvm] r122147 - in /llvm/trunk: include/llvm/MC/MCObjectFormat.h include/llvm/MC/MCObjectWriter.h include/llvm/Target/TargetAsmBackend.h lib/MC/CMakeLists.txt lib/MC/ELFObjectWriter.cpp lib/MC/MCExpr.cpp lib/MC/MCObjectFormat.cpp lib/MC/MachObjectWriter.cpp lib/MC/WinCOFFObjectWriter.cpp lib/Target/ARM/ARMAsmBackend.cpp lib/Target/MBlaze/MBlazeAsmBackend.cpp lib/Target/PowerPC/PPCAsmBackend.cpp lib/Target/X86/X86AsmBackend.cpp
Rafael Espindola
rafael.espindola at gmail.com
Fri Dec 17 21:37:28 PST 2010
Author: rafael
Date: Fri Dec 17 23:37:28 2010
New Revision: 122147
URL: http://llvm.org/viewvc/llvm-project?rev=122147&view=rev
Log:
Remove the MCObjectFormat class.
Removed:
llvm/trunk/include/llvm/MC/MCObjectFormat.h
llvm/trunk/lib/MC/MCObjectFormat.cpp
Modified:
llvm/trunk/include/llvm/MC/MCObjectWriter.h
llvm/trunk/include/llvm/Target/TargetAsmBackend.h
llvm/trunk/lib/MC/CMakeLists.txt
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/MC/MachObjectWriter.cpp
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
llvm/trunk/lib/Target/MBlaze/MBlazeAsmBackend.cpp
llvm/trunk/lib/Target/PowerPC/PPCAsmBackend.cpp
llvm/trunk/lib/Target/X86/X86AsmBackend.cpp
Removed: llvm/trunk/include/llvm/MC/MCObjectFormat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFormat.h?rev=122146&view=auto
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectFormat.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectFormat.h (removed)
@@ -1,54 +0,0 @@
-//===-- llvm/MC/MCObjectFormat.h - Object Format Info -----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCOBJECTFORMAT_H
-#define LLVM_MC_MCOBJECTFORMAT_H
-
-namespace llvm {
-class MCSymbol;
-
-class MCObjectFormat {
-public:
- virtual ~MCObjectFormat();
-
- /// isAbsolute - Check if A - B is an absolute value
- ///
- /// \param InSet - True if this expression is in a set. For example:
- /// a:
- /// ...
- /// b:
- /// tmp = a - b
- /// .long tmp
- /// \param A - LHS
- /// \param B - RHS
- virtual bool isAbsolute(bool InSet, const MCSymbol &A,
- const MCSymbol &B) const = 0;
-};
-
-class MCELFObjectFormat : public MCObjectFormat {
-public:
- virtual bool isAbsolute(bool InSet, const MCSymbol &A,
- const MCSymbol &B) const;
-};
-
-class MCMachOObjectFormat : public MCObjectFormat {
-public:
- virtual bool isAbsolute(bool InSet, const MCSymbol &A,
- const MCSymbol &B) const;
-};
-
-class MCCOFFObjectFormat : public MCObjectFormat {
-public:
- virtual bool isAbsolute(bool InSet, const MCSymbol &A,
- const MCSymbol &B) const;
-};
-
-} // End llvm namespace
-
-#endif
Modified: llvm/trunk/include/llvm/MC/MCObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectWriter.h?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectWriter.h Fri Dec 17 23:37:28 2010
@@ -20,6 +20,7 @@
class MCAssembler;
class MCFixup;
class MCFragment;
+class MCSymbol;
class MCSymbolRefExpr;
class MCValue;
class raw_ostream;
@@ -98,6 +99,9 @@
bool IsPCRel,
const MCFragment *DF) const = 0;
+ virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const = 0;
+
/// Write the object file.
///
/// This routine is called by the assembler after layout and relaxation is
Modified: llvm/trunk/include/llvm/Target/TargetAsmBackend.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmBackend.h?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmBackend.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmBackend.h Fri Dec 17 23:37:28 2010
@@ -18,7 +18,6 @@
namespace llvm {
class MCFixup;
class MCInst;
-class MCObjectFormat;
class MCObjectWriter;
class MCSection;
template<typename T>
@@ -37,8 +36,6 @@
public:
virtual ~TargetAsmBackend();
- virtual const MCObjectFormat &getObjectFormat() const = 0;
-
/// createObjectWriter - Create a new MCObjectWriter instance for use by the
/// assembler backend to emit the final object file.
virtual MCObjectWriter *createObjectWriter(raw_ostream &OS) const = 0;
Modified: llvm/trunk/lib/MC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/MC/CMakeLists.txt (original)
+++ llvm/trunk/lib/MC/CMakeLists.txt Fri Dec 17 23:37:28 2010
@@ -20,7 +20,6 @@
MCMachObjectTargetWriter.cpp
MCNullStreamer.cpp
MCObjectStreamer.cpp
- MCObjectFormat.cpp
MCObjectWriter.cpp
MCPureStreamer.cpp
MCSection.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Fri Dec 17 23:37:28 2010
@@ -352,6 +352,12 @@
return false;
}
+ virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On ELF A - B is absolute if A and B are in the same section.
+ return &A.getSection() == &B.getSection();
+ }
+
virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
const MCValue Target,
bool IsPCRel,
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Fri Dec 17 23:37:28 2010
@@ -14,7 +14,6 @@
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Debug.h"
@@ -388,8 +387,8 @@
if (Asm && A && B) {
const MCSymbol &SA = A->getSymbol();
const MCSymbol &SB = B->getSymbol();
- const MCObjectFormat &F = Asm->getBackend().getObjectFormat();
- if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) {
+ if (SA.isDefined() && SB.isDefined() &&
+ Asm->getWriter().isAbsolute(InSet, SA, SB)) {
MCSymbolData &AD = Asm->getSymbolData(A->getSymbol());
MCSymbolData &BD = Asm->getSymbolData(B->getSymbol());
Removed: llvm/trunk/lib/MC/MCObjectFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFormat.cpp?rev=122146&view=auto
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFormat.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFormat.cpp (removed)
@@ -1,34 +0,0 @@
-//===- lib/MC/MCObjectFormat.cpp - MCObjectFormat implementation ----------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/MC/MCObjectFormat.h"
-#include "llvm/MC/MCSymbol.h"
-
-using namespace llvm;
-
-MCObjectFormat::~MCObjectFormat() {
-}
-
-bool MCELFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
- const MCSymbol &B) const {
- // On ELF A - B is absolute if A and B are in the same section.
- return &A.getSection() == &B.getSection();
-}
-
-bool MCMachOObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
- const MCSymbol &B) const {
- // On MachO A - B is absolute only if in a set.
- return IsSet;
-}
-
-bool MCCOFFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
- const MCSymbol &B) const {
- // On COFF A - B is absolute if A and B are in the same section.
- return &A.getSection() == &B.getSection();
-}
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Fri Dec 17 23:37:28 2010
@@ -1123,6 +1123,12 @@
UndefinedSymbolData);
}
+ bool isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On MachO A - B is absolute only if in a set.
+ return IsSet;
+ }
+
bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
const MCSymbolRefExpr *A,
const MCSymbolRefExpr *B) const {
Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Fri Dec 17 23:37:28 2010
@@ -187,6 +187,12 @@
return false;
}
+ virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On COFF A - B is absolute if A and B are in the same section.
+ return &A.getSection() == &B.getSection();
+ }
+
virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
const MCValue Target,
bool IsPCRel,
Modified: llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp Fri Dec 17 23:37:28 2010
@@ -16,7 +16,6 @@
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCMachObjectWriter.h"
-#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
@@ -350,17 +349,11 @@
// FIXME: This should be in a separate file.
// ELF is an ELF of course...
class ELFARMAsmBackend : public ARMAsmBackend {
- MCELFObjectFormat Format;
-
public:
Triple::OSType OSType;
ELFARMAsmBackend(const Target &T, Triple::OSType _OSType)
: ARMAsmBackend(T), OSType(_OSType) { }
- virtual const MCObjectFormat &getObjectFormat() const {
- return Format;
- }
-
void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
uint64_t Value) const;
@@ -389,14 +382,9 @@
// FIXME: This should be in a separate file.
class DarwinARMAsmBackend : public ARMAsmBackend {
- MCMachOObjectFormat Format;
public:
DarwinARMAsmBackend(const Target &T) : ARMAsmBackend(T) { }
- virtual const MCObjectFormat &getObjectFormat() const {
- return Format;
- }
-
void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
uint64_t Value) const;
Modified: llvm/trunk/lib/Target/MBlaze/MBlazeAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeAsmBackend.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeAsmBackend.cpp Fri Dec 17 23:37:28 2010
@@ -16,7 +16,6 @@
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCELFSymbolFlags.h"
#include "llvm/MC/MCExpr.h"
-#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
@@ -108,18 +107,11 @@
namespace {
class ELFMBlazeAsmBackend : public MBlazeAsmBackend {
- MCELFObjectFormat Format;
-
public:
Triple::OSType OSType;
ELFMBlazeAsmBackend(const Target &T, Triple::OSType _OSType)
: MBlazeAsmBackend(T), OSType(_OSType) { }
- virtual const MCObjectFormat &getObjectFormat() const {
- return Format;
- }
-
-
void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
uint64_t Value) const;
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmBackend.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmBackend.cpp Fri Dec 17 23:37:28 2010
@@ -12,7 +12,6 @@
#include "PPCFixupKinds.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/Object/MachOFormat.h"
#include "llvm/Target/TargetRegistry.h"
@@ -82,14 +81,9 @@
// FIXME: This should be in a separate file.
namespace {
class DarwinPPCAsmBackend : public PPCAsmBackend {
- MCMachOObjectFormat Format;
public:
DarwinPPCAsmBackend(const Target &T) : PPCAsmBackend(T) { }
- virtual const MCObjectFormat &getObjectFormat() const {
- return Format;
- }
-
void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
uint64_t Value) const {
assert(0 && "UNIMP");
Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=122147&r1=122146&r2=122147&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Fri Dec 17 23:37:28 2010
@@ -16,7 +16,6 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixupKindInfo.h"
#include "llvm/MC/MCMachObjectWriter.h"
-#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h"
@@ -295,8 +294,6 @@
namespace {
class ELFX86AsmBackend : public X86AsmBackend {
- MCELFObjectFormat Format;
-
public:
Triple::OSType OSType;
ELFX86AsmBackend(const Target &T, Triple::OSType _OSType)
@@ -304,10 +301,6 @@
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;
@@ -340,7 +333,6 @@
class WindowsX86AsmBackend : public X86AsmBackend {
bool Is64Bit;
- MCCOFFObjectFormat Format;
public:
WindowsX86AsmBackend(const Target &T, bool is64Bit)
@@ -348,25 +340,15 @@
, Is64Bit(is64Bit) {
}
- virtual const MCObjectFormat &getObjectFormat() const {
- return Format;
- }
-
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
return createWinCOFFObjectWriter(OS, Is64Bit);
}
};
class DarwinX86AsmBackend : public X86AsmBackend {
- MCMachOObjectFormat Format;
-
public:
DarwinX86AsmBackend(const Target &T)
: X86AsmBackend(T) { }
-
- virtual const MCObjectFormat &getObjectFormat() const {
- return Format;
- }
};
class DarwinX86_32AsmBackend : public DarwinX86AsmBackend {
More information about the llvm-commits
mailing list