blob: 9f19d163f57bc5fb8968f16446043d30f1640c87 [file] [log] [blame]
Eugene Zelenkod3a6c892017-02-11 00:27:28 +00001//===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===//
Chris Lattner1814e812009-07-27 16:45:59 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Chris Lattner1814e812009-07-27 16:45:59 +00006//
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
Chris Lattner7b26fce2009-08-22 20:48:53 +000014#include "llvm/MC/MCAsmInfoCOFF.h"
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000015#include "llvm/MC/MCDirectives.h"
16
Chris Lattner1814e812009-07-27 16:45:59 +000017using namespace llvm;
18
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000019void MCAsmInfoCOFF::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000020
Chris Lattner2b4364f2010-01-20 06:34:14 +000021MCAsmInfoCOFF::MCAsmInfoCOFF() {
Benjamin Kramer68b9f052012-09-07 21:08:01 +000022 // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
23 // alignment.
24 COMMDirectiveAlignmentIsInBytes = false;
25 LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
Chris Lattner1814e812009-07-27 16:45:59 +000026 HasDotTypeDotSizeDirective = false;
Reid Kleckner98bbd072018-12-21 23:35:48 +000027 HasSingleParameterDotFile = true;
Chris Lattner1814e812009-07-27 16:45:59 +000028 WeakRefDirective = "\t.weak\t";
Rafael Espindola04867ce2013-12-02 23:04:51 +000029 HasLinkOnceDirective = true;
Jim Grosbachdc1e36e2012-05-11 01:41:30 +000030
Chris Lattner0bfd2792010-01-23 06:53:23 +000031 // Doesn't support visibility:
Eli Friedman64a4bf12011-09-23 00:13:02 +000032 HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid;
33 ProtectedVisibilityAttr = MCSA_Invalid;
Chris Lattner1814e812009-07-27 16:45:59 +000034
35 // Set up DWARF directives
Chris Lattner1814e812009-07-27 16:45:59 +000036 SupportsDebugInformation = true;
Matt Arsenault034ca0f2013-04-22 22:49:11 +000037 NeedsDwarfSectionOffsetDirective = true;
Daniel Sanders753e1762014-02-13 14:44:26 +000038
39 UseIntegratedAssembler = true;
Ahmed Bougacha19052872015-04-28 01:37:11 +000040
Ahmed Bougacha4a856432015-11-11 00:51:36 +000041 // At least MSVC inline-asm does AShr.
Ahmed Bougacha19052872015-04-28 01:37:11 +000042 UseLogicalShr = false;
Reid Kleckner13c9ee62018-06-21 20:27:38 +000043
44 // If this is a COFF target, assume that it supports associative comdats. It's
45 // part of the spec.
46 HasCOFFAssociativeComdats = true;
Martin Storsjo9dafd6f2018-07-26 10:48:20 +000047
48 // We can generate constants in comdat sections that can be shared,
49 // but in order not to create null typed symbols, we actually need to
50 // make them global symbols as well.
51 HasCOFFComdatConstants = true;
Chris Lattner1814e812009-07-27 16:45:59 +000052}
Michael J. Spencerde3a2112011-11-29 18:00:06 +000053
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000054void MCAsmInfoMicrosoft::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000055
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000056MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default;
Michael J. Spencerde3a2112011-11-29 18:00:06 +000057
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000058void MCAsmInfoGNUCOFF::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000059
Reid Kleckner13c9ee62018-06-21 20:27:38 +000060MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() {
61 // If this is a GNU environment (mingw or cygwin), don't use associative
62 // comdats for jump tables, unwind information, and other data associated with
63 // a function.
64 HasCOFFAssociativeComdats = false;
Martin Storsjo9dafd6f2018-07-26 10:48:20 +000065
66 // We don't create constants in comdat sections for MinGW.
67 HasCOFFComdatConstants = false;
Reid Kleckner13c9ee62018-06-21 20:27:38 +000068}