Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
Line
Count
Source
1
//===-- AArch64MCAsmInfo.cpp - AArch64 asm properties ---------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file contains the declarations of the AArch64MCAsmInfo properties.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "AArch64MCAsmInfo.h"
14
#include "llvm/ADT/Triple.h"
15
#include "llvm/MC/MCContext.h"
16
#include "llvm/MC/MCExpr.h"
17
#include "llvm/MC/MCStreamer.h"
18
#include "llvm/Support/CommandLine.h"
19
using namespace llvm;
20
21
enum AsmWriterVariantTy {
22
  Default = -1,
23
  Generic = 0,
24
  Apple = 1
25
};
26
27
static cl::opt<AsmWriterVariantTy> AsmWriterVariant(
28
    "aarch64-neon-syntax", cl::init(Default),
29
    cl::desc("Choose style of NEON code to emit from AArch64 backend:"),
30
    cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
31
               clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly")));
32
33
7.92k
AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() {
34
7.92k
  // We prefer NEON instructions to be printed in the short, Apple-specific
35
7.92k
  // form when targeting Darwin.
36
7.92k
  AssemblerDialect = AsmWriterVariant == Default ? 
Apple7.91k
:
AsmWriterVariant13
;
37
7.92k
38
7.92k
  PrivateGlobalPrefix = "L";
39
7.92k
  PrivateLabelPrefix = "L";
40
7.92k
  SeparatorString = "%%";
41
7.92k
  CommentString = ";";
42
7.92k
  CodePointerSize = CalleeSaveStackSlotSize = 8;
43
7.92k
44
7.92k
  AlignmentIsInBytes = false;
45
7.92k
  UsesELFSectionDirectiveForBSS = true;
46
7.92k
  SupportsDebugInformation = true;
47
7.92k
  UseDataRegionDirectives = true;
48
7.92k
49
7.92k
  ExceptionsType = ExceptionHandling::DwarfCFI;
50
7.92k
}
51
52
const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(
53
4
    const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const {
54
4
  // On Darwin, we can reference dwarf symbols with foo@GOT-., which
55
4
  // is an indirect pc-relative reference. The default implementation
56
4
  // won't reference using the GOT, so we need this target-specific
57
4
  // version.
58
4
  MCContext &Context = Streamer.getContext();
59
4
  const MCExpr *Res =
60
4
      MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, Context);
61
4
  MCSymbol *PCSym = Context.createTempSymbol();
62
4
  Streamer.EmitLabel(PCSym);
63
4
  const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
64
4
  return MCBinaryExpr::createSub(Res, PC, Context);
65
4
}
66
67
6.30k
AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) {
68
6.30k
  if (T.getArch() == Triple::aarch64_be)
69
44
    IsLittleEndian = false;
70
6.30k
71
6.30k
  // We prefer NEON instructions to be printed in the generic form when
72
6.30k
  // targeting ELF.
73
6.30k
  AssemblerDialect = AsmWriterVariant == Default ? 
Generic6.19k
:
AsmWriterVariant114
;
74
6.30k
75
6.30k
  CodePointerSize = 8;
76
6.30k
77
6.30k
  // ".comm align is in bytes but .align is pow-2."
78
6.30k
  AlignmentIsInBytes = false;
79
6.30k
80
6.30k
  CommentString = "//";
81
6.30k
  PrivateGlobalPrefix = ".L";
82
6.30k
  PrivateLabelPrefix = ".L";
83
6.30k
  Code32Directive = ".code\t32";
84
6.30k
85
6.30k
  Data16bitsDirective = "\t.hword\t";
86
6.30k
  Data32bitsDirective = "\t.word\t";
87
6.30k
  Data64bitsDirective = "\t.xword\t";
88
6.30k
89
6.30k
  UseDataRegionDirectives = false;
90
6.30k
91
6.30k
  WeakRefDirective = "\t.weak\t";
92
6.30k
93
6.30k
  SupportsDebugInformation = true;
94
6.30k
95
6.30k
  // Exceptions handling
96
6.30k
  ExceptionsType = ExceptionHandling::DwarfCFI;
97
6.30k
98
6.30k
  UseIntegratedAssembler = true;
99
6.30k
100
6.30k
  HasIdentDirective = true;
101
6.30k
}
102
103
111
AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
104
111
  PrivateGlobalPrefix = ".L";
105
111
  PrivateLabelPrefix = ".L";
106
111
107
111
  Data16bitsDirective = "\t.hword\t";
108
111
  Data32bitsDirective = "\t.word\t";
109
111
  Data64bitsDirective = "\t.xword\t";
110
111
111
111
  AlignmentIsInBytes = false;
112
111
  SupportsDebugInformation = true;
113
111
  CodePointerSize = 8;
114
111
115
111
  CommentString = ";";
116
111
  ExceptionsType = ExceptionHandling::WinEH;
117
111
  WinEHEncodingType = WinEH::EncodingType::Itanium;
118
111
}
119
120
19
AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
121
19
  PrivateGlobalPrefix = ".L";
122
19
  PrivateLabelPrefix = ".L";
123
19
124
19
  Data16bitsDirective = "\t.hword\t";
125
19
  Data32bitsDirective = "\t.word\t";
126
19
  Data64bitsDirective = "\t.xword\t";
127
19
128
19
  AlignmentIsInBytes = false;
129
19
  SupportsDebugInformation = true;
130
19
  CodePointerSize = 8;
131
19
132
19
  CommentString = "//";
133
19
  ExceptionsType = ExceptionHandling::WinEH;
134
19
  WinEHEncodingType = WinEH::EncodingType::Itanium;
135
19
}