1 | //===- MC/MCAsmInfoXCOFF.cpp - XCOFF asm properties ------------ *- C++ -*-===// |
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 | #include "llvm/MC/MCAsmInfoXCOFF.h" |
10 | #include "llvm/ADT/StringExtras.h" |
11 | #include "llvm/Support/CommandLine.h" |
12 | |
13 | using namespace llvm; |
14 | |
15 | namespace llvm { |
16 | extern cl::opt<cl::boolOrDefault> UseLEB128Directives; |
17 | } |
18 | |
19 | void MCAsmInfoXCOFF::anchor() {} |
20 | |
21 | MCAsmInfoXCOFF::MCAsmInfoXCOFF() { |
22 | IsLittleEndian = false; |
23 | HasVisibilityOnlyWithLinkage = true; |
24 | HasBasenameOnlyForFileDirective = false; |
25 | HasFourStringsDotFile = true; |
26 | |
27 | // For XCOFF, string constant consists of any number of characters enclosed in |
28 | // "" (double quotation marks). |
29 | HasPairedDoubleQuoteStringConstants = true; |
30 | |
31 | PrivateGlobalPrefix = "L.." ; |
32 | PrivateLabelPrefix = "L.." ; |
33 | SupportsQuotedNames = false; |
34 | UseDotAlignForAlignment = true; |
35 | UsesDwarfFileAndLocDirectives = false; |
36 | DwarfSectionSizeRequired = false; |
37 | if (UseLEB128Directives == cl::BOU_UNSET) |
38 | HasLEB128Directives = false; |
39 | ZeroDirective = "\t.space\t" ; |
40 | ZeroDirectiveSupportsNonZeroValue = false; |
41 | AsciiDirective = nullptr; // not supported |
42 | AscizDirective = nullptr; // not supported |
43 | ByteListDirective = "\t.byte\t" ; |
44 | PlainStringDirective = "\t.string\t" ; |
45 | CharacterLiteralSyntax = ACLS_SingleQuotePrefix; |
46 | |
47 | // Use .vbyte for data definition to avoid directives that apply an implicit |
48 | // alignment. |
49 | Data16bitsDirective = "\t.vbyte\t2, " ; |
50 | Data32bitsDirective = "\t.vbyte\t4, " ; |
51 | |
52 | COMMDirectiveAlignmentIsInBytes = false; |
53 | LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment; |
54 | HasDotTypeDotSizeDirective = false; |
55 | ParseInlineAsmUsingAsmParser = true; |
56 | NeedsFunctionDescriptors = true; |
57 | |
58 | ExceptionsType = ExceptionHandling::AIX; |
59 | } |
60 | |
61 | bool MCAsmInfoXCOFF::isAcceptableChar(char C) const { |
62 | // QualName is allowed for a MCSymbolXCOFF, and |
63 | // QualName contains '[' and ']'. |
64 | if (C == '[' || C == ']') |
65 | return true; |
66 | |
67 | // For AIX assembler, symbols may consist of numeric digits, |
68 | // underscores, periods, uppercase or lowercase letters, or |
69 | // any combination of these. |
70 | return isAlnum(C) || C == '_' || C == '.'; |
71 | } |
72 | |