From 93ed1029ecbd6975d7158881ffcc51235f8dd826 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Wed, 24 Sep 2008 22:22:03 +0000 Subject: [PATCH] Get rid of virtual inheritance for PPC TAI git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56586 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 17 ++------------ lib/Target/PowerPC/PPCTargetAsmInfo.h | 30 +++++++++++++++++-------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 6988e78196f..0c1cdcca2d8 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -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(TM) { PCSymbol = "."; CommentString = ";"; GlobalPrefix = "_"; @@ -103,7 +90,7 @@ PPCDarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) : - PPCTargetAsmInfo(TM), ELFTargetAsmInfo(TM) { + PPCTargetAsmInfo(TM) { CommentString = "#"; GlobalPrefix = ""; PrivateGlobalPrefix = ""; diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.h b/lib/Target/PowerPC/PPCTargetAsmInfo.h index c3160e34628..2c78aade1e7 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.h +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.h @@ -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 + struct PPCTargetAsmInfo : public BaseTAI { + explicit PPCTargetAsmInfo(const PPCTargetMachine &TM): + BaseTAI(TM) { + const PPCSubtarget *Subtarget = &TM.getSubtarget(); + 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 PPCGenericTargetAsmInfo; + + struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo { explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM); virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const; }; - struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo, - public ELFTargetAsmInfo { + struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo { explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM); virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, bool Global) const; -- 2.34.1