Add a MCAsmInfoELF class and factor some code into it.

We had a MCAsmInfoCOFF, but no common class for all the ELF MCAsmInfos before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2013-10-16 01:34:32 +00:00
parent d910c46963
commit 06957f43f6
23 changed files with 68 additions and 32 deletions

View File

@ -0,0 +1,23 @@
//===-- llvm/MC/MCAsmInfoELF.h - ELF Asm 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_MCASMINFOELF_H
#define LLVM_MC_MCASMINFOELF_H
#include "llvm/MC/MCAsmInfo.h"
namespace llvm {
class MCAsmInfoELF : public MCAsmInfo {
virtual void anchor();
protected:
MCAsmInfoELF();
};
}
#endif

View File

@ -4,6 +4,7 @@ add_llvm_library(LLVMMC
MCAsmInfo.cpp
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp
MCAsmInfoELF.cpp
MCAsmStreamer.cpp
MCAssembler.cpp
MCAtom.cpp

23
lib/MC/MCAsmInfoELF.cpp Normal file
View File

@ -0,0 +1,23 @@
//===-- MCAsmInfoELF.cpp - ELF asm properties -------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines target asm properties related what form asm statements
// should take in general on ELF-based targets
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfoELF.h"
using namespace llvm;
void MCAsmInfoELF::anchor() { }
MCAsmInfoELF::MCAsmInfoELF() {
HasIdentDirective = true;
WeakRefDirective = "\t.weak\t";
}

View File

@ -31,8 +31,6 @@ AArch64ELFMCAsmInfo::AArch64ELFMCAsmInfo() {
UseDataRegionDirectives = true;
WeakRefDirective = "\t.weak\t";
HasLEB128 = true;
SupportsDebugInformation = true;

View File

@ -14,11 +14,11 @@
#ifndef LLVM_AARCH64TARGETASMINFO_H
#define LLVM_AARCH64TARGETASMINFO_H
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
struct AArch64ELFMCAsmInfo : public MCAsmInfo {
struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
explicit AArch64ELFMCAsmInfo();
};

View File

@ -49,8 +49,6 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
Code16Directive = ".code\t16";
Code32Directive = ".code\t32";
WeakRefDirective = "\t.weak\t";
HasLEB128 = true;
SupportsDebugInformation = true;

View File

@ -15,6 +15,7 @@
#define LLVM_ARMTARGETASMINFO_H
#include "llvm/MC/MCAsmInfoDarwin.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
@ -24,7 +25,7 @@ namespace llvm {
explicit ARMMCAsmInfoDarwin();
};
class ARMELFMCAsmInfo : public MCAsmInfo {
class ARMELFMCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit ARMELFMCAsmInfo();

View File

@ -29,7 +29,6 @@ HexagonMCAsmInfo::HexagonMCAsmInfo(StringRef TT) {
InlineAsmEnd = "# InlineAsm End";
ZeroDirective = "\t.space\t";
AscizDirective = "\t.string\t";
WeakRefDirective = "\t.weak\t";
SupportsDebugInformation = true;
UsesELFSectionDirectiveForBSS = true;

View File

@ -15,10 +15,10 @@
#define HexagonMCASMINFO_H
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class HexagonMCAsmInfo : public MCAsmInfo {
class HexagonMCAsmInfo : public MCAsmInfoELF {
public:
explicit HexagonMCAsmInfo(StringRef TT);
};

View File

@ -21,7 +21,6 @@ MSP430MCAsmInfo::MSP430MCAsmInfo(StringRef TT) {
PointerSize = CalleeSaveStackSlotSize = 2;
PrivateGlobalPrefix = ".L";
WeakRefDirective ="\t.weak\t";
CommentString = ";";
AlignmentIsInBytes = false;

View File

@ -14,12 +14,12 @@
#ifndef MSP430TARGETASMINFO_H
#define MSP430TARGETASMINFO_H
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class StringRef;
class MSP430MCAsmInfo : public MCAsmInfo {
class MSP430MCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit MSP430MCAsmInfo(StringRef TT);

View File

@ -38,7 +38,6 @@ MipsMCAsmInfo::MipsMCAsmInfo(StringRef TT) {
ZeroDirective = "\t.space\t";
GPRel32Directive = "\t.gpword\t";
GPRel64Directive = "\t.gpdword\t";
WeakRefDirective = "\t.weak\t";
DebugLabelSuffix = "=.";
SupportsDebugInformation = true;
ExceptionsType = ExceptionHandling::DwarfCFI;

View File

@ -14,12 +14,12 @@
#ifndef MIPSTARGETASMINFO_H
#define MIPSTARGETASMINFO_H
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class StringRef;
class MipsMCAsmInfo : public MCAsmInfo {
class MipsMCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit MipsMCAsmInfo(StringRef TT);

View File

@ -46,8 +46,7 @@ PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
CommentString = "#";
GlobalPrefix = "";
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
// Uses '.section' before '.bss' directive
UsesELFSectionDirectiveForBSS = true;

View File

@ -15,6 +15,7 @@
#define PPCTARGETASMINFO_H
#include "llvm/MC/MCAsmInfoDarwin.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
@ -24,7 +25,7 @@ namespace llvm {
explicit PPCMCAsmInfoDarwin(bool is64Bit);
};
class PPCLinuxMCAsmInfo : public MCAsmInfo {
class PPCLinuxMCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit PPCLinuxMCAsmInfo(bool is64Bit);

View File

@ -41,8 +41,6 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(StringRef TT) {
SunStyleELFSectionSwitchSyntax = true;
UsesELFSectionDirectiveForBSS = true;
WeakRefDirective = "\t.weak\t";
PrivateGlobalPrefix = ".L";
}

View File

@ -14,12 +14,12 @@
#ifndef SPARCTARGETASMINFO_H
#define SPARCTARGETASMINFO_H
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class StringRef;
class SparcELFMCAsmInfo : public MCAsmInfo {
class SparcELFMCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit SparcELFMCAsmInfo(StringRef TT);

View File

@ -21,7 +21,6 @@ SystemZMCAsmInfo::SystemZMCAsmInfo(StringRef TT) {
CommentString = "#";
GlobalPrefix = "";
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
ZeroDirective = "\t.space\t";
Data64bitsDirective = "\t.quad\t";
UsesELFSectionDirectiveForBSS = true;

View File

@ -10,13 +10,13 @@
#ifndef SystemZTARGETASMINFO_H
#define SystemZTARGETASMINFO_H
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
#include "llvm/Support/Compiler.h"
namespace llvm {
class StringRef;
class SystemZMCAsmInfo : public MCAsmInfo {
class SystemZMCAsmInfo : public MCAsmInfoELF {
public:
explicit SystemZMCAsmInfo(StringRef TT);

View File

@ -90,8 +90,6 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) {
TextAlignFillValue = 0x90;
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
HasIdentDirective = true;
// Set up DWARF directives
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)

View File

@ -17,6 +17,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoCOFF.h"
#include "llvm/MC/MCAsmInfoDarwin.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class Triple;
@ -35,7 +36,7 @@ namespace llvm {
MCStreamer &Streamer) const;
};
class X86ELFMCAsmInfo : public MCAsmInfo {
class X86ELFMCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit X86ELFMCAsmInfo(const Triple &Triple);

View File

@ -23,7 +23,6 @@ XCoreMCAsmInfo::XCoreMCAsmInfo(StringRef TT) {
PrivateGlobalPrefix = ".L";
AscizDirective = ".asciiz";
WeakRefDirective = "\t.weak\t";
HiddenVisibilityAttr = MCSA_Invalid;
HiddenDeclarationVisibilityAttr = MCSA_Invalid;

View File

@ -14,13 +14,13 @@
#ifndef XCORETARGETASMINFO_H
#define XCORETARGETASMINFO_H
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class StringRef;
class Target;
class XCoreMCAsmInfo : public MCAsmInfo {
class XCoreMCAsmInfo : public MCAsmInfoELF {
virtual void anchor();
public:
explicit XCoreMCAsmInfo(StringRef TT);