blob: d8fb875b67c6a6c0a1a157901f0a957373380459 [file] [log] [blame]
Eugene Zelenkod3a6c892017-02-11 00:27:28 +00001//===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===//
Chris Lattner1814e812009-07-27 16:45:59 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines target asm properties related what form asm statements
11// should take in general on COFF-based targets
12//
13//===----------------------------------------------------------------------===//
14
Chris Lattner7b26fce2009-08-22 20:48:53 +000015#include "llvm/MC/MCAsmInfoCOFF.h"
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000016#include "llvm/MC/MCDirectives.h"
17
Chris Lattner1814e812009-07-27 16:45:59 +000018using namespace llvm;
19
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000020void MCAsmInfoCOFF::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000021
Chris Lattner2b4364f2010-01-20 06:34:14 +000022MCAsmInfoCOFF::MCAsmInfoCOFF() {
Benjamin Kramer68b9f052012-09-07 21:08:01 +000023 // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
24 // alignment.
25 COMMDirectiveAlignmentIsInBytes = false;
26 LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
Chris Lattner1814e812009-07-27 16:45:59 +000027 HasDotTypeDotSizeDirective = false;
28 HasSingleParameterDotFile = false;
Chris Lattner1814e812009-07-27 16:45:59 +000029 WeakRefDirective = "\t.weak\t";
Rafael Espindola04867ce2013-12-02 23:04:51 +000030 HasLinkOnceDirective = true;
Jim Grosbachdc1e36e2012-05-11 01:41:30 +000031
Chris Lattner0bfd2792010-01-23 06:53:23 +000032 // Doesn't support visibility:
Eli Friedman64a4bf12011-09-23 00:13:02 +000033 HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid;
34 ProtectedVisibilityAttr = MCSA_Invalid;
Chris Lattner1814e812009-07-27 16:45:59 +000035
36 // Set up DWARF directives
Chris Lattner1814e812009-07-27 16:45:59 +000037 SupportsDebugInformation = true;
Matt Arsenault034ca0f2013-04-22 22:49:11 +000038 NeedsDwarfSectionOffsetDirective = true;
Daniel Sanders753e1762014-02-13 14:44:26 +000039
40 UseIntegratedAssembler = true;
Ahmed Bougacha19052872015-04-28 01:37:11 +000041
Ahmed Bougacha4a856432015-11-11 00:51:36 +000042 // At least MSVC inline-asm does AShr.
Ahmed Bougacha19052872015-04-28 01:37:11 +000043 UseLogicalShr = false;
Reid Kleckner13c9ee62018-06-21 20:27:38 +000044
45 // If this is a COFF target, assume that it supports associative comdats. It's
46 // part of the spec.
47 HasCOFFAssociativeComdats = true;
Martin Storsjo9dafd6f2018-07-26 10:48:20 +000048
49 // We can generate constants in comdat sections that can be shared,
50 // but in order not to create null typed symbols, we actually need to
51 // make them global symbols as well.
52 HasCOFFComdatConstants = true;
Chris Lattner1814e812009-07-27 16:45:59 +000053}
Michael J. Spencerde3a2112011-11-29 18:00:06 +000054
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000055void MCAsmInfoMicrosoft::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000056
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000057MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default;
Michael J. Spencerde3a2112011-11-29 18:00:06 +000058
Eugene Zelenkod3a6c892017-02-11 00:27:28 +000059void MCAsmInfoGNUCOFF::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000060
Reid Kleckner13c9ee62018-06-21 20:27:38 +000061MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() {
62 // If this is a GNU environment (mingw or cygwin), don't use associative
63 // comdats for jump tables, unwind information, and other data associated with
64 // a function.
65 HasCOFFAssociativeComdats = false;
Martin Storsjo9dafd6f2018-07-26 10:48:20 +000066
67 // We don't create constants in comdat sections for MinGW.
68 HasCOFFComdatConstants = false;
Reid Kleckner13c9ee62018-06-21 20:27:38 +000069}