Get rid of virtual inheritance for PPC TAI
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetAsmInfo.h
1 //=====-- PPCTargetAsmInfo.h - PPC asm properties -------------*- C++ -*--====//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the DarwinTargetAsmInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef PPCTARGETASMINFO_H
15 #define PPCTARGETASMINFO_H
16
17 #include "PPCTargetMachine.h"
18 #include "llvm/Target/TargetAsmInfo.h"
19 #include "llvm/Target/DarwinTargetAsmInfo.h"
20 #include "llvm/Target/ELFTargetAsmInfo.h"
21
22 namespace llvm {
23
24   template <class BaseTAI>
25   struct PPCTargetAsmInfo : public BaseTAI {
26     explicit PPCTargetAsmInfo(const PPCTargetMachine &TM):
27       BaseTAI(TM) {
28       const PPCSubtarget *Subtarget = &TM.getSubtarget<PPCSubtarget>();
29       bool isPPC64 = Subtarget->isPPC64();
30
31       BaseTAI::ZeroDirective = "\t.space\t";
32       BaseTAI::SetDirective = "\t.set";
33       BaseTAI::Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
34       BaseTAI::AlignmentIsInBytes = false;
35       BaseTAI::LCOMMDirective = "\t.lcomm\t";
36       BaseTAI::InlineAsmStart = "# InlineAsm Start";
37       BaseTAI::InlineAsmEnd = "# InlineAsm End";
38       BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
39     }
40   };
41
42   typedef PPCTargetAsmInfo<TargetAsmInfo> PPCGenericTargetAsmInfo;
43
44   struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo<DarwinTargetAsmInfo> {
45     explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
46     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
47                                            bool Global) const;
48   };
49
50   struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
51     explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
52     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
53                                            bool Global) const;
54   };
55
56 } // namespace llvm
57
58 #endif