Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 1 | //===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===// |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 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 | |
Chris Lattner | 7b26fce | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 14 | #include "llvm/MC/MCAsmInfoCOFF.h" |
Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 15 | #include "llvm/MC/MCDirectives.h" |
| 16 | |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 17 | using namespace llvm; |
| 18 | |
Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 19 | void MCAsmInfoCOFF::anchor() {} |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 20 | |
Chris Lattner | 2b4364f | 2010-01-20 06:34:14 +0000 | [diff] [blame] | 21 | MCAsmInfoCOFF::MCAsmInfoCOFF() { |
Benjamin Kramer | 68b9f05 | 2012-09-07 21:08:01 +0000 | [diff] [blame] | 22 | // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte |
| 23 | // alignment. |
| 24 | COMMDirectiveAlignmentIsInBytes = false; |
| 25 | LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 26 | HasDotTypeDotSizeDirective = false; |
Reid Kleckner | 98bbd07 | 2018-12-21 23:35:48 +0000 | [diff] [blame] | 27 | HasSingleParameterDotFile = true; |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 28 | WeakRefDirective = "\t.weak\t"; |
Rafael Espindola | 04867ce | 2013-12-02 23:04:51 +0000 | [diff] [blame] | 29 | HasLinkOnceDirective = true; |
Jim Grosbach | dc1e36e | 2012-05-11 01:41:30 +0000 | [diff] [blame] | 30 | |
Chris Lattner | 0bfd279 | 2010-01-23 06:53:23 +0000 | [diff] [blame] | 31 | // Doesn't support visibility: |
Eli Friedman | 64a4bf1 | 2011-09-23 00:13:02 +0000 | [diff] [blame] | 32 | HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid; |
| 33 | ProtectedVisibilityAttr = MCSA_Invalid; |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 34 | |
| 35 | // Set up DWARF directives |
Chris Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 36 | SupportsDebugInformation = true; |
Matt Arsenault | 034ca0f | 2013-04-22 22:49:11 +0000 | [diff] [blame] | 37 | NeedsDwarfSectionOffsetDirective = true; |
Daniel Sanders | 753e176 | 2014-02-13 14:44:26 +0000 | [diff] [blame] | 38 | |
| 39 | UseIntegratedAssembler = true; |
Ahmed Bougacha | 1905287 | 2015-04-28 01:37:11 +0000 | [diff] [blame] | 40 | |
Ahmed Bougacha | 4a85643 | 2015-11-11 00:51:36 +0000 | [diff] [blame] | 41 | // At least MSVC inline-asm does AShr. |
Ahmed Bougacha | 1905287 | 2015-04-28 01:37:11 +0000 | [diff] [blame] | 42 | UseLogicalShr = false; |
Reid Kleckner | 13c9ee6 | 2018-06-21 20:27:38 +0000 | [diff] [blame] | 43 | |
| 44 | // If this is a COFF target, assume that it supports associative comdats. It's |
| 45 | // part of the spec. |
| 46 | HasCOFFAssociativeComdats = true; |
Martin Storsjo | 9dafd6f | 2018-07-26 10:48:20 +0000 | [diff] [blame] | 47 | |
| 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 Lattner | 1814e81 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 52 | } |
Michael J. Spencer | de3a211 | 2011-11-29 18:00:06 +0000 | [diff] [blame] | 53 | |
Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 54 | void MCAsmInfoMicrosoft::anchor() {} |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 55 | |
Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 56 | MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default; |
Michael J. Spencer | de3a211 | 2011-11-29 18:00:06 +0000 | [diff] [blame] | 57 | |
Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 58 | void MCAsmInfoGNUCOFF::anchor() {} |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 59 | |
Reid Kleckner | 13c9ee6 | 2018-06-21 20:27:38 +0000 | [diff] [blame] | 60 | MCAsmInfoGNUCOFF::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 Storsjo | 9dafd6f | 2018-07-26 10:48:20 +0000 | [diff] [blame] | 65 | |
| 66 | // We don't create constants in comdat sections for MinGW. |
| 67 | HasCOFFComdatConstants = false; |
Reid Kleckner | 13c9ee6 | 2018-06-21 20:27:38 +0000 | [diff] [blame] | 68 | } |