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
This commit is contained in:
Anton Korobeynikov 2008-09-24 22:22:03 +00:00
parent 8490322fa9
commit 93ed1029ec
2 changed files with 22 additions and 23 deletions

View File

@ -19,21 +19,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::dwarf; 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): PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
PPCTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) { PPCTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
PCSymbol = "."; PCSymbol = ".";
CommentString = ";"; CommentString = ";";
GlobalPrefix = "_"; GlobalPrefix = "_";
@ -103,7 +90,7 @@ PPCDarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) : PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
PPCTargetAsmInfo(TM), ELFTargetAsmInfo(TM) { PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
CommentString = "#"; CommentString = "#";
GlobalPrefix = ""; GlobalPrefix = "";
PrivateGlobalPrefix = ""; PrivateGlobalPrefix = "";

View File

@ -14,28 +14,40 @@
#ifndef PPCTARGETASMINFO_H #ifndef PPCTARGETASMINFO_H
#define PPCTARGETASMINFO_H #define PPCTARGETASMINFO_H
#include "PPCTargetMachine.h"
#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/DarwinTargetAsmInfo.h" #include "llvm/Target/DarwinTargetAsmInfo.h"
#include "llvm/Target/ELFTargetAsmInfo.h" #include "llvm/Target/ELFTargetAsmInfo.h"
namespace llvm { namespace llvm {
// Forward declaration. template <class BaseTAI>
class PPCTargetMachine; struct PPCTargetAsmInfo : public BaseTAI {
explicit PPCTargetAsmInfo(const PPCTargetMachine &TM):
BaseTAI(TM) {
const PPCSubtarget *Subtarget = &TM.getSubtarget<PPCSubtarget>();
bool isPPC64 = Subtarget->isPPC64();
struct PPCTargetAsmInfo : public virtual TargetAsmInfo { BaseTAI::ZeroDirective = "\t.space\t";
explicit PPCTargetAsmInfo(const PPCTargetMachine &TM); 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, typedef PPCTargetAsmInfo<TargetAsmInfo> PPCGenericTargetAsmInfo;
public DarwinTargetAsmInfo {
struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo<DarwinTargetAsmInfo> {
explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM); explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const; bool Global) const;
}; };
struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo, struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
public ELFTargetAsmInfo {
explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM); explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason, virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const; bool Global) const;