1 //===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===//
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 // This file defines target asm properties related what form asm statements
10 // should take in general on COFF-based targets
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/MC/MCAsmInfoCOFF.h"
15 #include "llvm/MC/MCDirectives.h"
16 
17 using namespace llvm;
18 
anchor()19 void MCAsmInfoCOFF::anchor() {}
20 
MCAsmInfoCOFF()21 MCAsmInfoCOFF::MCAsmInfoCOFF() {
22   // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
23   // alignment.
24   COMMDirectiveAlignmentIsInBytes = false;
25   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
26   HasDotTypeDotSizeDirective = false;
27   HasSingleParameterDotFile = true;
28   WeakRefDirective = "\t.weak\t";
29   AvoidWeakIfComdat = true;
30 
31   // Doesn't support visibility:
32   HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid;
33   ProtectedVisibilityAttr = MCSA_Invalid;
34 
35   // Set up DWARF directives
36   SupportsDebugInformation = true;
37   NeedsDwarfSectionOffsetDirective = true;
38 
39   // At least MSVC inline-asm does AShr.
40   UseLogicalShr = false;
41 
42   // If this is a COFF target, assume that it supports associative comdats. It's
43   // part of the spec.
44   HasCOFFAssociativeComdats = true;
45 
46   // We can generate constants in comdat sections that can be shared,
47   // but in order not to create null typed symbols, we actually need to
48   // make them global symbols as well.
49   HasCOFFComdatConstants = true;
50 }
51 
anchor()52 void MCAsmInfoMicrosoft::anchor() {}
53 
54 MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default;
55 
anchor()56 void MCAsmInfoGNUCOFF::anchor() {}
57 
MCAsmInfoGNUCOFF()58 MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() {
59   // If this is a GNU environment (mingw or cygwin), don't use associative
60   // comdats for jump tables, unwind information, and other data associated with
61   // a function.
62   HasCOFFAssociativeComdats = false;
63 
64   // We don't create constants in comdat sections for MinGW.
65   HasCOFFComdatConstants = false;
66 }
67