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