Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 1 | //===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===// |
Chris Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 2 | // |
| 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 Lattner | af76e59 | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 15 | #include "llvm/MC/MCAsmInfoCOFF.h" |
Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 16 | #include "llvm/MC/MCDirectives.h" |
| 17 | |
Chris Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 18 | using namespace llvm; |
| 19 | |
Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 20 | void MCAsmInfoCOFF::anchor() {} |
David Blaikie | 2d24e2a | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 21 | |
Chris Lattner | 8eeba35 | 2010-01-20 06:34:14 +0000 | [diff] [blame] | 22 | MCAsmInfoCOFF::MCAsmInfoCOFF() { |
Benjamin Kramer | a9e37c5 | 2012-09-07 21:08:01 +0000 | [diff] [blame] | 23 | // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte |
| 24 | // alignment. |
| 25 | COMMDirectiveAlignmentIsInBytes = false; |
| 26 | LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; |
Chris Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 27 | HasDotTypeDotSizeDirective = false; |
Reid Kleckner | fe471b0 | 2018-12-21 23:35:48 +0000 | [diff] [blame] | 28 | HasSingleParameterDotFile = true; |
Chris Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 29 | WeakRefDirective = "\t.weak\t"; |
Rafael Espindola | 29a0d2a | 2013-12-02 23:04:51 +0000 | [diff] [blame] | 30 | HasLinkOnceDirective = true; |
Jim Grosbach | 2684d9e | 2012-05-11 01:41:30 +0000 | [diff] [blame] | 31 | |
Chris Lattner | 152a29b | 2010-01-23 06:53:23 +0000 | [diff] [blame] | 32 | // Doesn't support visibility: |
Eli Friedman | 7666c7e | 2011-09-23 00:13:02 +0000 | [diff] [blame] | 33 | HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid; |
| 34 | ProtectedVisibilityAttr = MCSA_Invalid; |
Chris Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 35 | |
| 36 | // Set up DWARF directives |
Chris Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 37 | SupportsDebugInformation = true; |
Matt Arsenault | 9a0e12a | 2013-04-22 22:49:11 +0000 | [diff] [blame] | 38 | NeedsDwarfSectionOffsetDirective = true; |
Daniel Sanders | 38c6b58 | 2014-02-13 14:44:26 +0000 | [diff] [blame] | 39 | |
| 40 | UseIntegratedAssembler = true; |
Ahmed Bougacha | e1f835a | 2015-04-28 01:37:11 +0000 | [diff] [blame] | 41 | |
Ahmed Bougacha | 5d2b5c7 | 2015-11-11 00:51:36 +0000 | [diff] [blame] | 42 | // At least MSVC inline-asm does AShr. |
Ahmed Bougacha | e1f835a | 2015-04-28 01:37:11 +0000 | [diff] [blame] | 43 | UseLogicalShr = false; |
Reid Kleckner | 845b439 | 2018-06-21 20:27:38 +0000 | [diff] [blame] | 44 | |
| 45 | // If this is a COFF target, assume that it supports associative comdats. It's |
| 46 | // part of the spec. |
| 47 | HasCOFFAssociativeComdats = true; |
Martin Storsjo | 078cc9c | 2018-07-26 10:48:20 +0000 | [diff] [blame] | 48 | |
| 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 Lattner | 40412e7 | 2009-07-27 16:45:59 +0000 | [diff] [blame] | 53 | } |
Michael J. Spencer | 116bc79 | 2011-11-29 18:00:06 +0000 | [diff] [blame] | 54 | |
Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 55 | void MCAsmInfoMicrosoft::anchor() {} |
David Blaikie | 2d24e2a | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 56 | |
Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 57 | MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default; |
Michael J. Spencer | 116bc79 | 2011-11-29 18:00:06 +0000 | [diff] [blame] | 58 | |
Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 59 | void MCAsmInfoGNUCOFF::anchor() {} |
David Blaikie | 2d24e2a | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 60 | |
Reid Kleckner | 845b439 | 2018-06-21 20:27:38 +0000 | [diff] [blame] | 61 | MCAsmInfoGNUCOFF::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 Storsjo | 078cc9c | 2018-07-26 10:48:20 +0000 | [diff] [blame] | 66 | |
| 67 | // We don't create constants in comdat sections for MinGW. |
| 68 | HasCOFFComdatConstants = false; |
Reid Kleckner | 845b439 | 2018-06-21 20:27:38 +0000 | [diff] [blame] | 69 | } |