summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h
blob: 79dabf4f6321af2a869103659ef6fbb91eb6e4b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//=====-- PPCTargetAsmInfo.h - PPC asm properties -------------*- C++ -*--====//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the DarwinTargetAsmInfo class.
//
//===----------------------------------------------------------------------===//

#ifndef PPCTARGETASMINFO_H
#define PPCTARGETASMINFO_H

#include "PPCTargetMachine.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/DarwinTargetAsmInfo.h"
#include "llvm/Target/ELFTargetAsmInfo.h"
#include "llvm/Support/Compiler.h"

namespace llvm {

  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();
    }
  };

  typedef PPCTargetAsmInfo<TargetAsmInfo> PPCGenericTargetAsmInfo;

  EXTERN_TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);

  struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo<DarwinTargetAsmInfo> {
    explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
  };

  struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
    explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
  };

} // namespace llvm

#endif
OpenPOWER on IntegriCloud