xref: /freebsd/contrib/llvm-project/llvm/lib/MC/MCAsmInfoXCOFF.cpp (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
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"
11*e8d8bef9SDimitry Andric #include "llvm/Support/CommandLine.h"
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric using namespace llvm;
140b57cec5SDimitry Andric 
15*e8d8bef9SDimitry Andric extern cl::opt<cl::boolOrDefault> UseLEB128Directives;
16*e8d8bef9SDimitry Andric 
170b57cec5SDimitry Andric void MCAsmInfoXCOFF::anchor() {}
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
200b57cec5SDimitry Andric   IsLittleEndian = false;
215ffd83dbSDimitry Andric   HasVisibilityOnlyWithLinkage = true;
225ffd83dbSDimitry Andric   PrivateGlobalPrefix = "L..";
235ffd83dbSDimitry Andric   PrivateLabelPrefix = "L..";
245ffd83dbSDimitry Andric   SupportsQuotedNames = false;
258bcb0991SDimitry Andric   UseDotAlignForAlignment = true;
26*e8d8bef9SDimitry Andric   if (UseLEB128Directives == cl::BOU_UNSET)
27*e8d8bef9SDimitry Andric     HasLEB128Directives = false;
285ffd83dbSDimitry Andric   ZeroDirective = "\t.space\t";
295ffd83dbSDimitry Andric   ZeroDirectiveSupportsNonZeroValue = false;
308bcb0991SDimitry Andric   AsciiDirective = nullptr; // not supported
318bcb0991SDimitry Andric   AscizDirective = nullptr; // not supported
32*e8d8bef9SDimitry Andric   ByteListDirective = "\t.byte\t";
33*e8d8bef9SDimitry Andric   CharacterLiteralSyntax = ACLS_SingleQuotePrefix;
345ffd83dbSDimitry Andric 
355ffd83dbSDimitry Andric   // Use .vbyte for data definition to avoid directives that apply an implicit
365ffd83dbSDimitry Andric   // alignment.
375ffd83dbSDimitry Andric   Data16bitsDirective = "\t.vbyte\t2, ";
385ffd83dbSDimitry Andric   Data32bitsDirective = "\t.vbyte\t4, ";
395ffd83dbSDimitry Andric 
405ffd83dbSDimitry Andric   COMMDirectiveAlignmentIsInBytes = false;
415ffd83dbSDimitry Andric   LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
425ffd83dbSDimitry Andric   HasDotTypeDotSizeDirective = false;
435ffd83dbSDimitry Andric   UseIntegratedAssembler = false;
448bcb0991SDimitry Andric   NeedsFunctionDescriptors = true;
45*e8d8bef9SDimitry Andric 
46*e8d8bef9SDimitry Andric   ExceptionsType = ExceptionHandling::AIX;
478bcb0991SDimitry Andric }
488bcb0991SDimitry Andric 
49480093f4SDimitry Andric bool MCAsmInfoXCOFF::isAcceptableChar(char C) const {
50480093f4SDimitry Andric   // QualName is allowed for a MCSymbolXCOFF, and
51480093f4SDimitry Andric   // QualName contains '[' and ']'.
52480093f4SDimitry Andric   if (C == '[' || C == ']')
538bcb0991SDimitry Andric     return true;
548bcb0991SDimitry Andric 
555ffd83dbSDimitry Andric   // For AIX assembler, symbols may consist of numeric digits,
565ffd83dbSDimitry Andric   // underscores, periods, uppercase or lowercase letters, or
575ffd83dbSDimitry Andric   // any combination of these.
585ffd83dbSDimitry Andric   return isAlnum(C) || C == '_' || C == '.';
590b57cec5SDimitry Andric }
60