xref: /freebsd/contrib/llvm-project/llvm/lib/MC/MCAsmInfoXCOFF.cpp (revision 744bfb213144c63cbaf38d91a1c4f7aebb9b9fbc)
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   UseIntegratedAssembler = false;
56   ParseInlineAsmUsingAsmParser = true;
57   NeedsFunctionDescriptors = true;
58 
59   ExceptionsType = ExceptionHandling::AIX;
60 }
61 
62 bool MCAsmInfoXCOFF::isAcceptableChar(char C) const {
63   // QualName is allowed for a MCSymbolXCOFF, and
64   // QualName contains '[' and ']'.
65   if (C == '[' || C == ']')
66     return true;
67 
68   // For AIX assembler, symbols may consist of numeric digits,
69   // underscores, periods, uppercase or lowercase letters, or
70   // any combination of these.
71   return isAlnum(C) || C == '_' || C == '.';
72 }
73