xref: /freebsd/contrib/llvm-project/llvm/lib/MC/MCAsmInfoXCOFF.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //===- MC/MCAsmInfoXCOFF.cpp - XCOFF asm properties ------------ *- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #include "llvm/MC/MCAsmInfoXCOFF.h"
105ffd83dbSDimitry Andric #include "llvm/ADT/StringExtras.h"
11e8d8bef9SDimitry Andric #include "llvm/Support/CommandLine.h"
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric using namespace llvm;
140b57cec5SDimitry Andric 
15*fe6060f1SDimitry Andric namespace llvm {
16e8d8bef9SDimitry Andric extern cl::opt<cl::boolOrDefault> UseLEB128Directives;
17*fe6060f1SDimitry Andric }
18e8d8bef9SDimitry Andric 
anchor()190b57cec5SDimitry Andric void MCAsmInfoXCOFF::anchor() {}
200b57cec5SDimitry Andric 
MCAsmInfoXCOFF()210b57cec5SDimitry Andric MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
220b57cec5SDimitry Andric   IsLittleEndian = false;
235ffd83dbSDimitry Andric   HasVisibilityOnlyWithLinkage = true;
24*fe6060f1SDimitry Andric   HasBasenameOnlyForFileDirective = false;
25*fe6060f1SDimitry Andric   HasFourStringsDotFile = true;
26*fe6060f1SDimitry Andric 
27*fe6060f1SDimitry Andric   // For XCOFF, string constant consists of any number of characters enclosed in
28*fe6060f1SDimitry Andric   // "" (double quotation marks).
29*fe6060f1SDimitry Andric   HasPairedDoubleQuoteStringConstants = true;
30*fe6060f1SDimitry Andric 
315ffd83dbSDimitry Andric   PrivateGlobalPrefix = "L..";
325ffd83dbSDimitry Andric   PrivateLabelPrefix = "L..";
335ffd83dbSDimitry Andric   SupportsQuotedNames = false;
348bcb0991SDimitry Andric   UseDotAlignForAlignment = true;
35*fe6060f1SDimitry Andric   UsesDwarfFileAndLocDirectives = false;
36*fe6060f1SDimitry Andric   DwarfSectionSizeRequired = false;
37e8d8bef9SDimitry Andric   if (UseLEB128Directives == cl::BOU_UNSET)
38e8d8bef9SDimitry Andric     HasLEB128Directives = false;
395ffd83dbSDimitry Andric   ZeroDirective = "\t.space\t";
405ffd83dbSDimitry Andric   ZeroDirectiveSupportsNonZeroValue = false;
418bcb0991SDimitry Andric   AsciiDirective = nullptr; // not supported
428bcb0991SDimitry Andric   AscizDirective = nullptr; // not supported
43e8d8bef9SDimitry Andric   ByteListDirective = "\t.byte\t";
44*fe6060f1SDimitry Andric   PlainStringDirective = "\t.string\t";
45e8d8bef9SDimitry Andric   CharacterLiteralSyntax = ACLS_SingleQuotePrefix;
465ffd83dbSDimitry Andric 
475ffd83dbSDimitry Andric   // Use .vbyte for data definition to avoid directives that apply an implicit
485ffd83dbSDimitry Andric   // alignment.
495ffd83dbSDimitry Andric   Data16bitsDirective = "\t.vbyte\t2, ";
505ffd83dbSDimitry Andric   Data32bitsDirective = "\t.vbyte\t4, ";
515ffd83dbSDimitry Andric 
525ffd83dbSDimitry Andric   COMMDirectiveAlignmentIsInBytes = false;
535ffd83dbSDimitry Andric   LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
545ffd83dbSDimitry Andric   HasDotTypeDotSizeDirective = false;
55*fe6060f1SDimitry Andric   ParseInlineAsmUsingAsmParser = true;
568bcb0991SDimitry Andric   NeedsFunctionDescriptors = true;
57e8d8bef9SDimitry Andric 
58e8d8bef9SDimitry Andric   ExceptionsType = ExceptionHandling::AIX;
598bcb0991SDimitry Andric }
608bcb0991SDimitry Andric 
isAcceptableChar(char C) const61480093f4SDimitry Andric bool MCAsmInfoXCOFF::isAcceptableChar(char C) const {
62480093f4SDimitry Andric   // QualName is allowed for a MCSymbolXCOFF, and
63480093f4SDimitry Andric   // QualName contains '[' and ']'.
64480093f4SDimitry Andric   if (C == '[' || C == ']')
658bcb0991SDimitry Andric     return true;
668bcb0991SDimitry Andric 
675ffd83dbSDimitry Andric   // For AIX assembler, symbols may consist of numeric digits,
685ffd83dbSDimitry Andric   // underscores, periods, uppercase or lowercase letters, or
695ffd83dbSDimitry Andric   // any combination of these.
705ffd83dbSDimitry Andric   return isAlnum(C) || C == '_' || C == '.';
710b57cec5SDimitry Andric }
72