move LCOMMDirective = "\t.lcomm\t" up to DarwinTAI, eliminate
authorChris Lattner <sabre@nondot.org>
Tue, 11 Aug 2009 22:06:07 +0000 (22:06 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 11 Aug 2009 22:06:07 +0000 (22:06 +0000)
template in PPC backend for TAI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78727 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMTargetAsmInfo.cpp
lib/Target/ARM/ARMTargetAsmInfo.h
lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/PowerPC/PPCTargetAsmInfo.cpp
lib/Target/PowerPC/PPCTargetAsmInfo.h
lib/Target/X86/X86TargetAsmInfo.cpp

index 653219bf744133fbe51117d10c7329093325451b..755ee15a8d018a4eb899593cfa0d467a298a8f69 100644 (file)
@@ -62,6 +62,8 @@ ARMELFTargetAsmInfo::ARMELFTargetAsmInfo() {
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
   SetDirective = "\t.set\t";
+  LCOMMDirective = "\t.lcomm\t";
+
   DwarfRequiresFrameSection = false;
 
   SupportsDebugInformation = true;
index 9b97cbdc17a5e1941e87f753769a18771bd8e8e0..d897d8cc0fe28bc47f1032cb9497bf90bb63f40e 100644 (file)
@@ -32,7 +32,6 @@ namespace llvm {
       BaseTAI::COMMDirectiveTakesAlignment = false;
       BaseTAI::InlineAsmStart = "@ InlineAsm Start";
       BaseTAI::InlineAsmEnd = "@ InlineAsm End";
-      BaseTAI::LCOMMDirective = "\t.lcomm\t";
     }
   };
 
index ad669f8c035db7cd9aaa9ab9095743dae3dbfbe5..808074f41068f0f68db66a331c3843a71ece8bd1 100644 (file)
@@ -35,7 +35,8 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo() {
   WeakDefDirective = "\t.weak_definition ";
   WeakRefDirective = "\t.weak_reference ";
   HiddenDirective = "\t.private_extern ";
-    
+  LCOMMDirective = "\t.lcomm\t";
+
   // _foo.eh symbols are currently always exported so that the linker knows
   // about them.  This is not necessary on 10.6 and later, but it
   // doesn't hurt anything.
index 52e29865fa511d50793ecb182a6ae262eaacb6d4..41d78dcb017e4f0984b5e4e0b4f943fda3768ae7 100644 (file)
@@ -19,8 +19,7 @@
 using namespace llvm;
 using namespace llvm::dwarf;
 
-PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
-  PPCTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
+PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) {
   PCSymbol = ".";
   CommentString = ";";
   UsedDirective = "\t.no_dead_strip\t";
@@ -28,10 +27,21 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
 
   GlobalEHDirective = "\t.globl\t";
   SupportsWeakOmittedEHFrame = false;
+  
+  const PPCSubtarget *Subtarget = &TM.getSubtarget<PPCSubtarget>();
+  bool isPPC64 = Subtarget->isPPC64();
+  
+  ZeroDirective = "\t.space\t";
+  SetDirective = "\t.set";
+  Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
+  AlignmentIsInBytes = false;
+  LCOMMDirective = "\t.lcomm\t";
+  InlineAsmStart = "# InlineAsm Start";
+  InlineAsmEnd = "# InlineAsm End";
+  AssemblerDialect = Subtarget->getAsmFlavor();
 }
 
-PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
-  PPCTargetAsmInfo<TargetAsmInfo>(TM) {
+PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) {
   CommentString = "#";
   GlobalPrefix = "";
   PrivateGlobalPrefix = ".L";
@@ -47,12 +57,21 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
   // Set up DWARF directives
   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
 
+  const PPCSubtarget *Subtarget = &TM.getSubtarget<PPCSubtarget>();
+  bool isPPC64 = Subtarget->isPPC64();
+
   // Exceptions handling
-  if (!TM.getSubtargetImpl()->isPPC64())
+  if (!isPPC64)
     ExceptionsType = ExceptionHandling::Dwarf;
   AbsoluteEHSectionOffsets = false;
+    
+  ZeroDirective = "\t.space\t";
+  SetDirective = "\t.set";
+  Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
+  AlignmentIsInBytes = false;
+  LCOMMDirective = "\t.lcomm\t";
+  InlineAsmStart = "# InlineAsm Start";
+  InlineAsmEnd = "# InlineAsm End";
+  AssemblerDialect = Subtarget->getAsmFlavor();
 }
 
-
-// Instantiate default implementation.
-TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);
index a84db460d28e3d85b86200e478fb90807cc27d18..0d9285a80fb90b889caaf314bbd807b36698c855 100644 (file)
 
 namespace llvm {
 
-  template <class BaseTAI>
-  struct PPCTargetAsmInfo : public BaseTAI {
-    explicit PPCTargetAsmInfo(const PPCTargetMachine &TM) {
-      const PPCSubtarget *Subtarget = &TM.getSubtarget<PPCSubtarget>();
-      bool isPPC64 = Subtarget->isPPC64();
-
-      BaseTAI::ZeroDirective = "\t.space\t";
-      BaseTAI::SetDirective = "\t.set";
-      BaseTAI::Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
-      BaseTAI::AlignmentIsInBytes = false;
-      BaseTAI::LCOMMDirective = "\t.lcomm\t";
-      BaseTAI::InlineAsmStart = "# InlineAsm Start";
-      BaseTAI::InlineAsmEnd = "# InlineAsm End";
-      BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
-    }
-  };
-
-  typedef PPCTargetAsmInfo<TargetAsmInfo> PPCGenericTargetAsmInfo;
-
-  EXTERN_TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);
-
-  struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo<DarwinTargetAsmInfo> {
+  struct PPCDarwinTargetAsmInfo : public DarwinTargetAsmInfo {
     explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
   };
 
-  struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<TargetAsmInfo> {
+  struct PPCLinuxTargetAsmInfo : public TargetAsmInfo {
     explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
   };
 
index 7712b0225010d281229e7b05ddb3c674382fd8d6..c44703835c8996882feb8d61fea6a744d4015201 100644 (file)
@@ -48,12 +48,10 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
   AlignmentIsInBytes = false;
   TextAlignFillValue = 0x90;
 
-
   if (!is64Bit)
     Data64bitsDirective = 0;       // we can't emit a 64-bit unit
   ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
   ZeroFillDirective = "\t.zerofill\t";  // Uses .zerofill
-  LCOMMDirective = "\t.lcomm\t";
 
   // Leopard and above support aligned common symbols.
   COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);