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 extern cl::opt<cl::boolOrDefault> UseLEB128Directives;
16 
17 void MCAsmInfoXCOFF::anchor() {}
18 
19 MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
20   IsLittleEndian = false;
21   HasVisibilityOnlyWithLinkage = true;
22   PrivateGlobalPrefix = "L..";
23   PrivateLabelPrefix = "L..";
24   SupportsQuotedNames = false;
25   UseDotAlignForAlignment = true;
26   if (UseLEB128Directives == cl::BOU_UNSET)
27     HasLEB128Directives = false;
28   ZeroDirective = "\t.space\t";
29   ZeroDirectiveSupportsNonZeroValue = false;
30   AsciiDirective = nullptr; // not supported
31   AscizDirective = nullptr; // not supported
32   ByteListDirective = "\t.byte\t";
33   CharacterLiteralSyntax = ACLS_SingleQuotePrefix;
34 
35   // Use .vbyte for data definition to avoid directives that apply an implicit
36   // alignment.
37   Data16bitsDirective = "\t.vbyte\t2, ";
38   Data32bitsDirective = "\t.vbyte\t4, ";
39 
40   COMMDirectiveAlignmentIsInBytes = false;
41   LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
42   HasDotTypeDotSizeDirective = false;
43   UseIntegratedAssembler = false;
44   NeedsFunctionDescriptors = true;
45 
46   ExceptionsType = ExceptionHandling::AIX;
47 }
48 
49 bool MCAsmInfoXCOFF::isAcceptableChar(char C) const {
50   // QualName is allowed for a MCSymbolXCOFF, and
51   // QualName contains '[' and ']'.
52   if (C == '[' || C == ']')
53     return true;
54 
55   // For AIX assembler, symbols may consist of numeric digits,
56   // underscores, periods, uppercase or lowercase letters, or
57   // any combination of these.
58   return isAlnum(C) || C == '_' || C == '.';
59 }
60