[llvm-commits] [llvm] r56586 - in /llvm/trunk/lib/Target/PowerPC: PPCTargetAsmInfo.cpp PPCTargetAsmInfo.h

Anton Korobeynikov asl at math.spbu.ru
Wed Sep 24 15:22:03 PDT 2008


Author: asl
Date: Wed Sep 24 17:22:03 2008
New Revision: 56586

URL: http://llvm.org/viewvc/llvm-project?rev=56586&view=rev
Log:
Get rid of virtual inheritance for PPC TAI

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
    llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=56586&r1=56585&r2=56586&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Wed Sep 24 17:22:03 2008
@@ -19,21 +19,8 @@
 using namespace llvm;
 using namespace llvm::dwarf;
 
-PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
-  bool isPPC64 = TM.getSubtargetImpl()->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 = TM.getSubtargetImpl()->getAsmFlavor();
-}
-
 PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
-  PPCTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
+  PPCTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
   PCSymbol = ".";
   CommentString = ";";
   GlobalPrefix = "_";
@@ -103,7 +90,7 @@
 
 
 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
-  PPCTargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
+  PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
   CommentString = "#";
   GlobalPrefix = "";
   PrivateGlobalPrefix = "";

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h?rev=56586&r1=56585&r2=56586&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h Wed Sep 24 17:22:03 2008
@@ -14,28 +14,40 @@
 #ifndef PPCTARGETASMINFO_H
 #define PPCTARGETASMINFO_H
 
+#include "PPCTargetMachine.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/DarwinTargetAsmInfo.h"
 #include "llvm/Target/ELFTargetAsmInfo.h"
 
 namespace llvm {
 
-  // Forward declaration.
-  class PPCTargetMachine;
-
-  struct PPCTargetAsmInfo : public virtual TargetAsmInfo {
-    explicit PPCTargetAsmInfo(const PPCTargetMachine &TM);
+  template <class BaseTAI>
+  struct PPCTargetAsmInfo : public BaseTAI {
+    explicit PPCTargetAsmInfo(const PPCTargetMachine &TM):
+      BaseTAI(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();
+    }
   };
 
-  struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo,
-                                  public DarwinTargetAsmInfo {
+  typedef PPCTargetAsmInfo<TargetAsmInfo> PPCGenericTargetAsmInfo;
+
+  struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo<DarwinTargetAsmInfo> {
     explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
                                            bool Global) const;
   };
 
-  struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo,
-                                 public ELFTargetAsmInfo {
+  struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
     explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
                                            bool Global) const;





More information about the llvm-commits mailing list