LLVM  3.7.0
AArch64MCAsmInfo.cpp
Go to the documentation of this file.
1 //===-- AArch64MCAsmInfo.cpp - AArch64 asm properties ---------------------===//
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 declarations of the AArch64MCAsmInfo properties.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "AArch64MCAsmInfo.h"
15 #include "llvm/ADT/Triple.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCExpr.h"
18 #include "llvm/MC/MCStreamer.h"
20 using namespace llvm;
21 
23  Default = -1,
24  Generic = 0,
25  Apple = 1
26 };
27 
29  "aarch64-neon-syntax", cl::init(Default),
30  cl::desc("Choose style of NEON code to emit from AArch64 backend:"),
31  cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
32  clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly"),
33  clEnumValEnd));
34 
36  // We prefer NEON instructions to be printed in the short form.
38 
39  PrivateGlobalPrefix = "L";
40  PrivateLabelPrefix = "L";
41  SeparatorString = "%%";
42  CommentString = ";";
44 
45  AlignmentIsInBytes = false;
49 
51 
52  // AArch64 Darwin doesn't have the baggage of X86/ARM, so it's fine to use
53  // LShr instead of AShr.
54  UseLogicalShr = true;
55 }
56 
58  const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const {
59  // On Darwin, we can reference dwarf symbols with foo@GOT-., which
60  // is an indirect pc-relative reference. The default implementation
61  // won't reference using the GOT, so we need this target-specific
62  // version.
63  MCContext &Context = Streamer.getContext();
64  const MCExpr *Res =
66  MCSymbol *PCSym = Context.createTempSymbol();
67  Streamer.EmitLabel(PCSym);
68  const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
69  return MCBinaryExpr::createSub(Res, PC, Context);
70 }
71 
73  if (T.getArch() == Triple::aarch64_be)
74  IsLittleEndian = false;
75 
76  // We prefer NEON instructions to be printed in the short form.
78 
79  PointerSize = 8;
80 
81  // ".comm align is in bytes but .align is pow-2."
82  AlignmentIsInBytes = false;
83 
84  CommentString = "//";
85  PrivateGlobalPrefix = ".L";
86  PrivateLabelPrefix = ".L";
87  Code32Directive = ".code\t32";
88 
89  Data16bitsDirective = "\t.hword\t";
90  Data32bitsDirective = "\t.word\t";
91  Data64bitsDirective = "\t.xword\t";
92 
94 
95  WeakRefDirective = "\t.weak\t";
96 
98 
99  // Exceptions handling
101 
102  UseIntegratedAssembler = true;
103 
104  HasIdentDirective = true;
105 }
ValuesClass< DataType > LLVM_END_WITH_NULL values(const char *Arg, DataType Val, const char *Desc,...)
Definition: CommandLine.h:536
bool UseIntegratedAssembler
Should we use the integrated assembler? The integrated assembler should be enabled by default (by the...
Definition: MCAsmInfo.h:353
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:315
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
#define clEnumValEnd
Definition: CommandLine.h:498
const char * Data64bitsDirective
Definition: MCAsmInfo.h:191
bool IsLittleEndian
True if target is little endian. Default is true.
Definition: MCAsmInfo.h:72
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition: MCAsmInfo.h:69
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:221
const char * PrivateGlobalPrefix
This prefix is used for globals like constant pool entries that are completely private to the ...
Definition: MCAsmInfo.h:127
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line...
Definition: MCAsmInfo.h:109
AArch64MCAsmInfoELF(const Triple &T)
bool UseLogicalShr
True if the integrated assembler should interpret 'a >> b' constant expressions as logical rather t...
Definition: MCAsmInfo.h:360
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:211
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:33
MCContext & getContext() const
Definition: MCStreamer.h:210
Context object for machine code objects.
Definition: MCContext.h:48
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:514
const char * Code32Directive
Definition: MCAsmInfo.h:148
const char * CommentString
This indicates the comment character used by the assembler.
Definition: MCAsmInfo.h:113
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:242
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Definition: MCAsmInfo.h:277
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:325
Streaming machine code generation interface.
Definition: MCStreamer.h:157
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
Definition: MCContext.cpp:222
unsigned PointerSize
Pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:65
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:318
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol...
Definition: MCAsmInfo.h:288
const char * Data16bitsDirective
Definition: MCAsmInfo.h:189
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
virtual void EmitLabel(MCSymbol *Symbol)
Emit a label for Symbol into the current section.
Definition: MCStreamer.cpp:203
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"), clEnumValEnd))
AsmWriterVariantTy
const char * Data32bitsDirective
Definition: MCAsmInfo.h:190
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:497
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition: MCAsmInfo.h:321
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
No exception support.
const char * PrivateLabelPrefix
This prefix is used for labels for basic blocks.
Definition: MCAsmInfo.h:131