LLVM  9.0.0svn
AArch64MCAsmInfo.cpp
Go to the documentation of this file.
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"
19 using namespace llvm;
20 
22  Default = -1,
23  Generic = 0,
24  Apple = 1
25 };
26 
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 
34  // We prefer NEON instructions to be printed in the short, Apple-specific
35  // form when targeting Darwin.
37 
38  PrivateGlobalPrefix = "L";
39  PrivateLabelPrefix = "L";
40  SeparatorString = "%%";
41  CommentString = ";";
43 
44  AlignmentIsInBytes = false;
48 
50 }
51 
53  const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const {
54  // On Darwin, we can reference dwarf symbols with foo@GOT-., which
55  // is an indirect pc-relative reference. The default implementation
56  // won't reference using the GOT, so we need this target-specific
57  // version.
58  MCContext &Context = Streamer.getContext();
59  const MCExpr *Res =
61  MCSymbol *PCSym = Context.createTempSymbol();
62  Streamer.EmitLabel(PCSym);
63  const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
64  return MCBinaryExpr::createSub(Res, PC, Context);
65 }
66 
68  if (T.getArch() == Triple::aarch64_be)
69  IsLittleEndian = false;
70 
71  // We prefer NEON instructions to be printed in the generic form when
72  // targeting ELF.
74 
75  CodePointerSize = 8;
76 
77  // ".comm align is in bytes but .align is pow-2."
78  AlignmentIsInBytes = false;
79 
80  CommentString = "//";
81  PrivateGlobalPrefix = ".L";
82  PrivateLabelPrefix = ".L";
83  Code32Directive = ".code\t32";
84 
85  Data16bitsDirective = "\t.hword\t";
86  Data32bitsDirective = "\t.word\t";
87  Data64bitsDirective = "\t.xword\t";
88 
90 
91  WeakRefDirective = "\t.weak\t";
92 
94 
95  // Exceptions handling
97 
99 
100  HasIdentDirective = true;
101 }
102 
104  PrivateGlobalPrefix = ".L";
105  PrivateLabelPrefix = ".L";
106 
107  Data16bitsDirective = "\t.hword\t";
108  Data32bitsDirective = "\t.word\t";
109  Data64bitsDirective = "\t.xword\t";
110 
111  AlignmentIsInBytes = false;
113  CodePointerSize = 8;
114 
115  CommentString = ";";
118 }
119 
121  PrivateGlobalPrefix = ".L";
122  PrivateLabelPrefix = ".L";
123 
124  Data16bitsDirective = "\t.hword\t";
125  Data32bitsDirective = "\t.word\t";
126  Data64bitsDirective = "\t.xword\t";
127 
128  AlignmentIsInBytes = false;
130  CodePointerSize = 8;
131 
132  CommentString = "//";
134  // The default is dwarf, but WinEH can be enabled optionally, which requires
135  // WinEHEncodingType to be set.
137 }
LLVMContext & Context
bool UseIntegratedAssembler
Should we use the integrated assembler? The integrated assembler should be enabled by default (by the...
Definition: MCAsmInfo.h:370
StringRef PrivateLabelPrefix
This prefix is used for labels for basic blocks.
Definition: MCAsmInfo.h:131
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:322
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
const char * Data64bitsDirective
Definition: MCAsmInfo.h:192
bool IsLittleEndian
True if target is little endian. Default is true.
Definition: MCAsmInfo.h:69
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition: MCAsmInfo.h:66
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition: MCAsmInfo.h:152
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition: MCAsmInfo.h:230
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line...
Definition: MCAsmInfo.h:109
MCContext & getContext() const
Definition: MCStreamer.h:250
AArch64MCAsmInfoELF(const Triple &T)
StringRef CommentString
This indicates the comment character used by the assembler.
Definition: MCAsmInfo.h:113
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:220
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
Context object for machine code objects.
Definition: MCContext.h:62
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:545
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:289
const char * Code32Directive
Definition: MCAsmInfo.h:148
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Definition: MCAsmInfo.h:286
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:422
Streaming machine code generation interface.
Definition: MCStreamer.h:188
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
Definition: MCContext.cpp:216
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:642
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:331
WinEH::EncodingType WinEHEncodingType
Windows exception handling data (.pdata) encoding. Defaults to Invalid.
Definition: MCAsmInfo.h:337
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol...
Definition: MCAsmInfo.h:301
const char * Data16bitsDirective
Definition: MCAsmInfo.h:190
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
AsmWriterVariantTy
const char * Data32bitsDirective
Definition: MCAsmInfo.h:191
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:62
static cl::opt< AsmWriterVariantTy > AsmWriterVariant("aarch64-neon-syntax", cl::init(Default), cl::desc("Choose style of NEON code to emit from AArch64 backend:"), cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"), clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly")))
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:617
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition: MCAsmInfo.h:334
bool UseDataRegionDirectives
This is true if data region markers should be printed as ".data_region/.end_data_region" directives...
Definition: MCAsmInfo.h:165
const MCExpr * getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const override
Windows CE ARM, PowerPC, SH3, SH4.
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Definition: MCStreamer.cpp:346
No exception support.
StringRef PrivateGlobalPrefix
This prefix is used for globals like constant pool entries that are completely private to the ...
Definition: MCAsmInfo.h:127