Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove object format #81

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 2 additions & 34 deletions llvm/include/llvm/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,6 @@ class Triple {
CoreCLR,
LastEnvironmentType = CoreCLR
};
enum ObjectFormatType {
UnknownObjectFormat,

COFF,
ELF,
MachO,
};

private:
std::string Data;
Expand All @@ -209,16 +202,13 @@ class Triple {
/// The parsed Environment type.
EnvironmentType Environment;

/// The object format type.
ObjectFormatType ObjectFormat;

public:
/// @name Constructors
/// @{

/// Default constructor is the same as an empty string and leaves all
/// triple fields unknown.
Triple() : Data(), Arch(), Vendor(), OS(), Environment(), ObjectFormat() {}
Triple() : Data(), Arch(), Vendor(), OS(), Environment() {}

explicit Triple(const Twine &Str);
Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
Expand All @@ -228,8 +218,7 @@ class Triple {
bool operator==(const Triple &Other) const {
return Arch == Other.Arch && SubArch == Other.SubArch &&
Vendor == Other.Vendor && OS == Other.OS &&
Environment == Other.Environment &&
ObjectFormat == Other.ObjectFormat;
Environment == Other.Environment;
}

/// @}
Expand Down Expand Up @@ -279,9 +268,6 @@ class Triple {
void getEnvironmentVersion(unsigned &Major, unsigned &Minor,
unsigned &Micro) const;

/// getFormat - Get the object format for this triple.
ObjectFormatType getObjectFormat() const { return ObjectFormat; }

/// getOSVersion - Parse the version number from the OS name component of the
/// triple, if present.
///
Expand Down Expand Up @@ -519,21 +505,6 @@ class Triple {
return getOS() == Triple::Linux;
}

/// Tests whether the OS uses the ELF binary format.
bool isOSBinFormatELF() const {
return getObjectFormat() == Triple::ELF;
}

/// Tests whether the OS uses the COFF binary format.
bool isOSBinFormatCOFF() const {
return getObjectFormat() == Triple::COFF;
}

/// Tests whether the environment is MachO.
bool isOSBinFormatMachO() const {
return getObjectFormat() == Triple::MachO;
}

/// Tests whether the target is the PS4 CPU
bool isPS4CPU() const {
return getArch() == Triple::x86_64 &&
Expand Down Expand Up @@ -575,9 +546,6 @@ class Triple {
/// to a known type.
void setEnvironment(EnvironmentType Kind);

/// setObjectFormat - Set the object file format
void setObjectFormat(ObjectFormatType Kind);

/// setTriple - Set all components to the new triple \p Str.
void setTriple(const Twine &Str);

Expand Down
21 changes: 0 additions & 21 deletions llvm/include/llvm/MC/MCAsmInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ class MCAsmInfo {
/// True if target stack grow up. Default is false.
bool StackGrowsUp;

/// True if this target has the MachO .subsections_via_symbols directive.
/// Default is false.
bool HasSubsectionsViaSymbols;

/// True if this is a MachO target that supports the macho-specific .zerofill
/// directive for emitting BSS Symbols. Default is false.
bool HasMachoZeroFillDirective;

/// True if this is a MachO target that supports the macho-specific .tbss
/// directive for emitting thread local BSS Symbols. Default is false.
bool HasMachoTBSSDirective;

/// True if the compiler should emit a ".reference .constructors_used" or
/// ".reference .destructors_used" directive after the static ctor/dtor
/// list. This directive is only emitted in Static relocation model. Default
Expand Down Expand Up @@ -276,10 +264,6 @@ class MCAsmInfo {
/// Defaults to false.
bool HasIdentDirective;

/// True if this target supports the MachO .no_dead_strip directive. Defaults
/// to false.
bool HasNoDeadStrip;

/// Used to declare a global as being a weak symbol. Defaults to ".weak".
const char *WeakDirective;

Expand Down Expand Up @@ -378,8 +362,6 @@ class MCAsmInfo {
/// True if target stack grow up.
bool isStackGrowthDirectionUp() const { return StackGrowsUp; }

bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }

// Data directive accessors.

const char *getData8bitsDirective() const { return Data8bitsDirective; }
Expand Down Expand Up @@ -437,8 +419,6 @@ class MCAsmInfo {

// Accessors.

bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
bool hasStaticCtorDtorReferenceInStaticMode() const {
return HasStaticCtorDtorReferenceInStaticMode;
}
Expand Down Expand Up @@ -499,7 +479,6 @@ class MCAsmInfo {
bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; }
bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
bool hasIdentDirective() const { return HasIdentDirective; }
bool hasNoDeadStrip() const { return HasNoDeadStrip; }
const char *getWeakDirective() const { return WeakDirective; }
const char *getWeakRefDirective() const { return WeakRefDirective; }
bool hasWeakDefDirective() const { return HasWeakDefDirective; }
Expand Down
33 changes: 0 additions & 33 deletions llvm/include/llvm/MC/MCAsmInfoCOFF.h

This file was deleted.

29 changes: 0 additions & 29 deletions llvm/include/llvm/MC/MCAsmInfoDarwin.h

This file was deleted.

55 changes: 0 additions & 55 deletions llvm/include/llvm/MC/MCContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ namespace llvm {
class MCRegisterInfo;
class MCLineSection;
class SMLoc;
class MCSectionMachO;
class MCSectionELF;
class MCSectionCOFF;

/// Context object for machine code objects. This class owns all of the
/// sections that it creates.
Expand Down Expand Up @@ -73,9 +71,7 @@ namespace llvm {
/// objects.
BumpPtrAllocator Allocator;

SpecificBumpPtrAllocator<MCSectionCOFF> COFFAllocator;
SpecificBumpPtrAllocator<MCSectionELF> ELFAllocator;
SpecificBumpPtrAllocator<MCSectionMachO> MachOAllocator;

/// Bindings of names to symbols.
SymbolTable Symbols;
Expand Down Expand Up @@ -191,26 +187,7 @@ namespace llvm {
}
};

struct COFFSectionKey {
std::string SectionName;
StringRef GroupName;
int SelectionKey;
COFFSectionKey(StringRef SectionName, StringRef GroupName,
int SelectionKey)
: SectionName(SectionName), GroupName(GroupName),
SelectionKey(SelectionKey) {}
bool operator<(const COFFSectionKey &Other) const {
if (SectionName != Other.SectionName)
return SectionName < Other.SectionName;
if (GroupName != Other.GroupName)
return GroupName < Other.GroupName;
return SelectionKey < Other.SelectionKey;
}
};

StringMap<MCSectionMachO *> MachOUniquingMap;
std::map<ELFSectionKey, MCSectionELF *> ELFUniquingMap;
std::map<COFFSectionKey, MCSectionCOFF *> COFFUniquingMap;
StringMap<bool> ELFRelSecNames;

SpecificBumpPtrAllocator<MCSubtargetInfo> MCSubtargetAllocator;
Expand Down Expand Up @@ -313,20 +290,6 @@ namespace llvm {
/// \name Section Management
/// @{

/// Return the MCSection for the specified mach-o section. This requires
/// the operands to be valid.
MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2, SectionKind K,
const char *BeginSymName = nullptr);

MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
unsigned TypeAndAttributes, SectionKind K,
const char *BeginSymName = nullptr) {
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K,
BeginSymName);
}

MCSectionELF *getELFSection(StringRef Section, unsigned Type,
unsigned Flags) {
return getELFSection(Section, Type, Flags, nullptr);
Expand Down Expand Up @@ -377,24 +340,6 @@ namespace llvm {

MCSectionELF *createELFGroupSection(const MCSymbolELF *Group);

MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
SectionKind Kind, StringRef COMDATSymName,
int Selection,
const char *BeginSymName = nullptr);

MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
SectionKind Kind,
const char *BeginSymName = nullptr);

MCSectionCOFF *getCOFFSection(StringRef Section);

/// Gets or creates a section equivalent to Sec that is associated with the
/// section containing KeySym. For example, to create a debug info section
/// associated with an inline function, pass the normal debug info section
/// as Sec and the function symbol as KeySym.
MCSectionCOFF *getAssociativeCOFFSection(MCSectionCOFF *Sec,
const MCSymbol *KeySym);

// Create and save a copy of STI and return a reference to the copy.
MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);

Expand Down
4 changes: 0 additions & 4 deletions llvm/include/llvm/MC/MCELFStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class MCELFStreamer : public MCObjectStreamer {
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
void BeginCOFFSymbolDef(const MCSymbol *Symbol) override;
void EmitCOFFSymbolStorageClass(int StorageClass) override;
void EmitCOFFSymbolType(int Type) override;
void EndCOFFSymbolDef() override;

void emitELFSize(MCSymbolELF *Symbol, const MCExpr *Value) override;

Expand Down
7 changes: 0 additions & 7 deletions llvm/include/llvm/MC/MCExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ class MCSymbolRefExpr : public MCExpr {
VK_Mips_PCREL_HI16,
VK_Mips_PCREL_LO16,

VK_COFF_IMGREL32, // symbol@imgrel (image-relative)

VK_Hexagon_PCREL,
VK_Hexagon_LO16,
VK_Hexagon_HI16,
Expand All @@ -304,9 +302,6 @@ class MCSymbolRefExpr : public MCExpr {
/// Specifies how the variant kind should be printed.
const unsigned UseParensForSymbolVariant : 1;

// FIXME: Remove this bit.
const unsigned HasSubsectionsViaSymbols : 1;

/// The symbol being referenced.
const MCSymbol *Symbol;

Expand Down Expand Up @@ -336,8 +331,6 @@ class MCSymbolRefExpr : public MCExpr {

void printVariantKind(raw_ostream &OS) const;

bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }

/// @}
/// \name Static Utility Functions
/// @{
Expand Down
Loading