/src/keystone/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
Line | Count | Source |
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" |
19 | | |
20 | | using namespace llvm_ks; |
21 | | |
22 | | enum AsmWriterVariantTy { |
23 | | Default = -1, |
24 | | Generic = 0, |
25 | | Apple = 1 |
26 | | }; |
27 | | |
28 | | static AsmWriterVariantTy AsmWriterVariant = Default; |
29 | | |
30 | 0 | AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() { |
31 | | // We prefer NEON instructions to be printed in the short form. |
32 | 0 | AssemblerDialect = AsmWriterVariant == Default ? 1 : AsmWriterVariant; |
33 | |
|
34 | 0 | PrivateGlobalPrefix = "L"; |
35 | 0 | PrivateLabelPrefix = "L"; |
36 | 0 | SeparatorString = "%%"; |
37 | 0 | CommentString = ";"; |
38 | 0 | PointerSize = CalleeSaveStackSlotSize = 8; |
39 | |
|
40 | 0 | AlignmentIsInBytes = false; |
41 | 0 | UsesELFSectionDirectiveForBSS = true; |
42 | 0 | SupportsDebugInformation = true; |
43 | 0 | UseDataRegionDirectives = true; |
44 | |
|
45 | 0 | ExceptionsType = ExceptionHandling::DwarfCFI; |
46 | 0 | } |
47 | | |
48 | | const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol( |
49 | 0 | const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const { |
50 | | // On Darwin, we can reference dwarf symbols with foo@GOT-., which |
51 | | // is an indirect pc-relative reference. The default implementation |
52 | | // won't reference using the GOT, so we need this target-specific |
53 | | // version. |
54 | 0 | MCContext &Context = Streamer.getContext(); |
55 | 0 | const MCExpr *Res = |
56 | 0 | MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, Context); |
57 | 0 | MCSymbol *PCSym = Context.createTempSymbol(); |
58 | 0 | Streamer.EmitLabel(PCSym); |
59 | 0 | const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context); |
60 | 0 | return MCBinaryExpr::createSub(Res, PC, Context); |
61 | 0 | } |
62 | | |
63 | 1.96k | AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) { |
64 | 1.96k | if (T.getArch() == Triple::aarch64_be) |
65 | 0 | IsLittleEndian = false; |
66 | | |
67 | | // We prefer NEON instructions to be printed in the short form. |
68 | 1.96k | AssemblerDialect = AsmWriterVariant == Default ? 0 : AsmWriterVariant; |
69 | | |
70 | 1.96k | PointerSize = 8; |
71 | | |
72 | | // ".comm align is in bytes but .align is pow-2." |
73 | 1.96k | AlignmentIsInBytes = false; |
74 | | |
75 | 1.96k | CommentString = "//"; |
76 | 1.96k | PrivateGlobalPrefix = ".L"; |
77 | 1.96k | PrivateLabelPrefix = ".L"; |
78 | 1.96k | Code32Directive = ".code\t32"; |
79 | | |
80 | 1.96k | Data16bitsDirective = "\t.hword\t"; |
81 | 1.96k | Data32bitsDirective = "\t.word\t"; |
82 | 1.96k | Data64bitsDirective = "\t.xword\t"; |
83 | | |
84 | 1.96k | UseDataRegionDirectives = false; |
85 | | |
86 | 1.96k | WeakRefDirective = "\t.weak\t"; |
87 | | |
88 | 1.96k | SupportsDebugInformation = true; |
89 | | |
90 | | // Exceptions handling |
91 | 1.96k | ExceptionsType = ExceptionHandling::DwarfCFI; |
92 | | |
93 | 1.96k | UseIntegratedAssembler = true; |
94 | | |
95 | 1.96k | HasIdentDirective = true; |
96 | 1.96k | } |