xref: /freebsd/contrib/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
10b57cec5SDimitry Andric //===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===//
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 // This file defines target asm properties related what form asm statements
100b57cec5SDimitry Andric // should take in general on COFF-based targets
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #include "llvm/MC/MCAsmInfoCOFF.h"
150b57cec5SDimitry Andric #include "llvm/MC/MCDirectives.h"
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric using namespace llvm;
180b57cec5SDimitry Andric 
anchor()190b57cec5SDimitry Andric void MCAsmInfoCOFF::anchor() {}
200b57cec5SDimitry Andric 
MCAsmInfoCOFF()210b57cec5SDimitry Andric MCAsmInfoCOFF::MCAsmInfoCOFF() {
220b57cec5SDimitry Andric   // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
230b57cec5SDimitry Andric   // alignment.
240b57cec5SDimitry Andric   COMMDirectiveAlignmentIsInBytes = false;
250b57cec5SDimitry Andric   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
260b57cec5SDimitry Andric   HasDotTypeDotSizeDirective = false;
270b57cec5SDimitry Andric   HasSingleParameterDotFile = true;
280b57cec5SDimitry Andric   WeakRefDirective = "\t.weak\t";
29*5ffd83dbSDimitry Andric   AvoidWeakIfComdat = true;
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   // Doesn't support visibility:
320b57cec5SDimitry Andric   HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid;
330b57cec5SDimitry Andric   ProtectedVisibilityAttr = MCSA_Invalid;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   // Set up DWARF directives
360b57cec5SDimitry Andric   SupportsDebugInformation = true;
370b57cec5SDimitry Andric   NeedsDwarfSectionOffsetDirective = true;
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric   // At least MSVC inline-asm does AShr.
400b57cec5SDimitry Andric   UseLogicalShr = false;
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric   // If this is a COFF target, assume that it supports associative comdats. It's
430b57cec5SDimitry Andric   // part of the spec.
440b57cec5SDimitry Andric   HasCOFFAssociativeComdats = true;
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   // We can generate constants in comdat sections that can be shared,
470b57cec5SDimitry Andric   // but in order not to create null typed symbols, we actually need to
480b57cec5SDimitry Andric   // make them global symbols as well.
490b57cec5SDimitry Andric   HasCOFFComdatConstants = true;
500b57cec5SDimitry Andric }
510b57cec5SDimitry Andric 
anchor()520b57cec5SDimitry Andric void MCAsmInfoMicrosoft::anchor() {}
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default;
550b57cec5SDimitry Andric 
anchor()560b57cec5SDimitry Andric void MCAsmInfoGNUCOFF::anchor() {}
570b57cec5SDimitry Andric 
MCAsmInfoGNUCOFF()580b57cec5SDimitry Andric MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() {
590b57cec5SDimitry Andric   // If this is a GNU environment (mingw or cygwin), don't use associative
600b57cec5SDimitry Andric   // comdats for jump tables, unwind information, and other data associated with
610b57cec5SDimitry Andric   // a function.
620b57cec5SDimitry Andric   HasCOFFAssociativeComdats = false;
630b57cec5SDimitry Andric 
640b57cec5SDimitry Andric   // We don't create constants in comdat sections for MinGW.
650b57cec5SDimitry Andric   HasCOFFComdatConstants = false;
660b57cec5SDimitry Andric }
67