Add a MCAsmInfoELF class and factor some code into it.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 16 Oct 2013 01:34:32 +0000 (01:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 16 Oct 2013 01:34:32 +0000 (01:34 +0000)
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

23 files changed:
include/llvm/MC/MCAsmInfoELF.h [new file with mode: 0644]
lib/MC/CMakeLists.txt
lib/MC/MCAsmInfoELF.cpp [new file with mode: 0644]
lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.h
lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCAsmInfo.h
lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.cpp
lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h
lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.h
lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h
lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h
lib/Target/XCore/MCTargetDesc/XCoreMCAsmInfo.cpp
lib/Target/XCore/MCTargetDesc/XCoreMCAsmInfo.h

diff --git a/include/llvm/MC/MCAsmInfoELF.h b/include/llvm/MC/MCAsmInfoELF.h
new file mode 100644 (file)
index 0000000..27fea84
--- /dev/null
@@ -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
index fffe886a4a19ccd50a6ce4303e79585cc6e62d06..fa844efacf5fdf0d47d617d6b622e4414018c02d 100644 (file)
@@ -4,6 +4,7 @@ add_llvm_library(LLVMMC
   MCAsmInfo.cpp
   MCAsmInfoCOFF.cpp
   MCAsmInfoDarwin.cpp
+  MCAsmInfoELF.cpp
   MCAsmStreamer.cpp
   MCAssembler.cpp
   MCAtom.cpp
diff --git a/lib/MC/MCAsmInfoELF.cpp b/lib/MC/MCAsmInfoELF.cpp
new file mode 100644 (file)
index 0000000..8cf4e4f
--- /dev/null
@@ -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";
+}
index 8ec8cbf1c5255da52ab0f73452e101a78773f2de..dd12e2c08c5a765f0d31be09b61f57de5da867e4 100644 (file)
@@ -31,8 +31,6 @@ AArch64ELFMCAsmInfo::AArch64ELFMCAsmInfo() {
 
   UseDataRegionDirectives = true;
 
-  WeakRefDirective = "\t.weak\t";
-
   HasLEB128 = true;
   SupportsDebugInformation = true;
 
index a20bc471c20dfaba7e741139f4d8d73140f18b0a..ae0a674fa8324dcd5e2ca3b3482cc96a7b15e295 100644 (file)
 #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();
   };
 
index c1aab9c72ccabe6e50c8f349855dd4d009aa0a9b..ad796e660e96d7816938e1d8d4314194db3ef369 100644 (file)
@@ -49,8 +49,6 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
   Code16Directive = ".code\t16";
   Code32Directive = ".code\t32";
 
-  WeakRefDirective = "\t.weak\t";
-
   HasLEB128 = true;
   SupportsDebugInformation = true;
 
index f0b289c6f3b6192e57126edbe8a08284d5a7b1ac..e1f716d936ad8eb2f308723596325707b689f5ca 100644 (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();
index 495dbb97b0289675dd8fda10e4e0e4259c5a381d..b9fef0ce4d72d4a3b9f83cd590da029cbf846434 100644 (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;
index 0b94d2141c0c18f30353066e2faaed6b0ae597e1..b2c1d377a326b1cb240e458157e369c0b296cce4 100644 (file)
 #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);
   };
index ab8c81efededdc11ffb2dbf1a64bfc9aaebbcd94..991bf560051ad6a0b524acc0a636be3d8e5e5d1e 100644 (file)
@@ -21,7 +21,6 @@ MSP430MCAsmInfo::MSP430MCAsmInfo(StringRef TT) {
   PointerSize = CalleeSaveStackSlotSize = 2;
 
   PrivateGlobalPrefix = ".L";
-  WeakRefDirective ="\t.weak\t";
   CommentString = ";";
 
   AlignmentIsInBytes = false;
index feb040d13b9044801c3d52459e6eb7080e9dfea1..a7e0e589418428ba1bb02eec118d5f7a3a406e14 100644 (file)
 #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);
index 33f6f9620ecd364ebd63378cc1be993a696a2bcb..6aa3c762d9dba5fda5afe55453396ef7e9b77456 100644 (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;
index 772234eb718a13aab8c28b774ccaea8311e0168c..1000113351b407fd66a91485bb3051afc69382ff 100644 (file)
 #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);
index 91578a9b5043874102d701a3450ec63bfa8967d1..f3dddce30120976371f477a8ff3a9e7fb0754eed 100644 (file)
@@ -46,8 +46,7 @@ PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
   CommentString = "#";
   GlobalPrefix = "";
   PrivateGlobalPrefix = ".L";
-  WeakRefDirective = "\t.weak\t";
-  
+
   // Uses '.section' before '.bss' directive
   UsesELFSectionDirectiveForBSS = true;  
 
index 7b4ed9f14eb6d93a25bd177e30130f7bcdc63ee6..1530e774cfc77df21a867a722bc140d1733b7a26 100644 (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);
index 06b1df6dbf7712700710fc85d3d48fc24483012d..baac36b1db64cbe217c7f5540f89a5c2b72a68fd 100644 (file)
@@ -41,8 +41,6 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(StringRef TT) {
   SunStyleELFSectionSwitchSyntax = true;
   UsesELFSectionDirectiveForBSS = true;
 
-  WeakRefDirective = "\t.weak\t";
-
   PrivateGlobalPrefix = ".L";
 }
 
index 621e8ffadfaf885fe3656e3c4a89e0d6ccc75107..1e58e37ce14b1f6f2b6d104b5f3e5d92e9d55ac3 100644 (file)
 #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);
index 1d39140a79485380fc266167654b218f42954582..965c41e2d15101188153034ea63b5918f43ca8f0 100644 (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;
index d440787de54805c26e478106367741bc40e70bda..b9ac92a6934f59ff335d5dd6680ccb349e644842 100644 (file)
 #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);
 
index 032e910bbcea9b600133c41dc45b8760c4f6ec97..d3f5258a8df1045bf37a3429ef46db1e23e88a9e 100644 (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)
index b6b70fd3e8555ddf31012cd622f889466b369466..80979dda677075fc8c5986bf6e6cb51733d24c87 100644 (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);
index 19b97efeaf0b08aa5bb1e89cbabf97c407a6ba36..720cb1898bf74a2b88d9f68b2672672fd6842598 100644 (file)
@@ -23,7 +23,6 @@ XCoreMCAsmInfo::XCoreMCAsmInfo(StringRef TT) {
     
   PrivateGlobalPrefix = ".L";
   AscizDirective = ".asciiz";
-  WeakRefDirective = "\t.weak\t";
 
   HiddenVisibilityAttr = MCSA_Invalid;
   HiddenDeclarationVisibilityAttr = MCSA_Invalid;
index b5a9660d5fb20ef9426e1724c8812f5e117e98a3..e53c96b8f745519b5546bf07f49739af163ea5e7 100644 (file)
 #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);