Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- PPCMCAsmInfo.cpp - PPC asm properties -----------------------------===// |
Jim Laskey | 0e83541 | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jim Laskey | 0e83541 | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Chris Lattner | 0545746 | 2009-08-22 21:03:30 +0000 | [diff] [blame] | 10 | // This file contains the declarations of the MCAsmInfoDarwin properties. |
Jim Laskey | 0e83541 | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Chris Lattner | 7b26fce | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 14 | #include "PPCMCAsmInfo.h" |
David Fang | 1b01849 | 2013-12-10 21:37:41 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/Triple.h" |
| 16 | |
Jim Laskey | 0e83541 | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 17 | using namespace llvm; |
| 18 | |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 19 | void PPCMCAsmInfoDarwin::anchor() { } |
| 20 | |
David Fang | 1b01849 | 2013-12-10 21:37:41 +0000 | [diff] [blame] | 21 | PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) { |
Eli Bendersky | 32aab22 | 2013-01-23 16:22:04 +0000 | [diff] [blame] | 22 | if (is64Bit) { |
| 23 | PointerSize = CalleeSaveStackSlotSize = 8; |
| 24 | } |
Evan Cheng | a83b37a | 2011-07-15 02:09:41 +0000 | [diff] [blame] | 25 | IsLittleEndian = false; |
| 26 | |
Jim Laskey | 28663c7 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 27 | CommentString = ";"; |
Rafael Espindola | 5164e6e | 2011-05-02 15:58:16 +0000 | [diff] [blame] | 28 | ExceptionsType = ExceptionHandling::DwarfCFI; |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 29 | |
Daniel Dunbar | 86c065d | 2009-08-13 17:03:38 +0000 | [diff] [blame] | 30 | if (!is64Bit) |
Craig Topper | 062a2ba | 2014-04-25 05:30:21 +0000 | [diff] [blame] | 31 | Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode. |
Rafael Espindola | 1c8ac8f | 2010-12-04 03:21:47 +0000 | [diff] [blame] | 32 | |
Chris Lattner | 96db1ab | 2009-08-11 23:03:40 +0000 | [diff] [blame] | 33 | AssemblerDialect = 1; // New-Style mnemonics. |
Dale Johannesen | 237b1c1 | 2010-01-06 02:21:00 +0000 | [diff] [blame] | 34 | SupportsDebugInformation= true; // Debug information. |
David Fang | 1b01849 | 2013-12-10 21:37:41 +0000 | [diff] [blame] | 35 | |
Iain Sandoe | 6803858 | 2013-12-13 15:46:48 +0000 | [diff] [blame] | 36 | // The installed assembler for OSX < 10.6 lacks some directives. |
David Fang | 1b01849 | 2013-12-10 21:37:41 +0000 | [diff] [blame] | 37 | // FIXME: this should really be a check on the assembler characteristics |
| 38 | // rather than OS version |
| 39 | if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6)) |
| 40 | HasWeakDefCanBeHiddenDirective = false; |
Daniel Sanders | 753e176 | 2014-02-13 14:44:26 +0000 | [diff] [blame] | 41 | |
| 42 | UseIntegratedAssembler = true; |
Jim Laskey | 28663c7 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Joerg Sonnenberger | 5f233fc | 2014-08-04 18:46:13 +0000 | [diff] [blame] | 45 | void PPCELFMCAsmInfo::anchor() { } |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 46 | |
Joerg Sonnenberger | 5f233fc | 2014-08-04 18:46:13 +0000 | [diff] [blame] | 47 | PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) { |
Rafael Espindola | 86bd6a1 | 2015-03-05 18:55:50 +0000 | [diff] [blame^] | 48 | // FIXME: This is not always needed. For example, it is not needed in the |
| 49 | // v2 abi. |
| 50 | NeedsLocalForSize = true; |
| 51 | |
Eli Bendersky | f759526 | 2013-01-23 17:12:15 +0000 | [diff] [blame] | 52 | if (is64Bit) { |
| 53 | PointerSize = CalleeSaveStackSlotSize = 8; |
| 54 | } |
Ulrich Weigand | cae3a17 | 2014-03-24 18:16:09 +0000 | [diff] [blame] | 55 | IsLittleEndian = T.getArch() == Triple::ppc64le; |
Evan Cheng | de4ae46 | 2011-08-01 19:43:05 +0000 | [diff] [blame] | 56 | |
Rafael Espindola | 4536b9a | 2010-02-06 03:32:21 +0000 | [diff] [blame] | 57 | // ".comm align is in bytes but .align is pow-2." |
| 58 | AlignmentIsInBytes = false; |
| 59 | |
Jim Laskey | 28663c7 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 60 | CommentString = "#"; |
Rafael Espindola | 43c4e24 | 2013-10-16 01:34:32 +0000 | [diff] [blame] | 61 | |
Bruno Cardoso Lopes | 62e6a8b | 2009-08-13 23:30:21 +0000 | [diff] [blame] | 62 | // Uses '.section' before '.bss' directive |
| 63 | UsesELFSectionDirectiveForBSS = true; |
Nick Lewycky | 5805c46 | 2007-07-25 03:48:45 +0000 | [diff] [blame] | 64 | |
Nicolas Geoffray | 80c741e | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 65 | // Debug Information |
Nicolas Geoffray | 80c741e | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 66 | SupportsDebugInformation = true; |
Nicolas Geoffray | 80c741e | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 67 | |
David Majnemer | 0c58bc6 | 2013-09-25 10:47:21 +0000 | [diff] [blame] | 68 | DollarIsPC = true; |
| 69 | |
Nicolas Geoffray | 80c741e | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 70 | // Set up DWARF directives |
Ulrich Weigand | 32d725b | 2013-06-12 14:46:54 +0000 | [diff] [blame] | 71 | MinInstAlignment = 4; |
Nicolas Geoffray | 80c741e | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 72 | |
| 73 | // Exceptions handling |
Roman Divacky | 10a448d | 2012-09-12 15:29:32 +0000 | [diff] [blame] | 74 | ExceptionsType = ExceptionHandling::DwarfCFI; |
Chris Lattner | 7faf1fd | 2009-08-11 22:06:07 +0000 | [diff] [blame] | 75 | |
| 76 | ZeroDirective = "\t.space\t"; |
Craig Topper | 062a2ba | 2014-04-25 05:30:21 +0000 | [diff] [blame] | 77 | Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr; |
Ulrich Weigand | 266db7f | 2013-07-08 20:20:51 +0000 | [diff] [blame] | 78 | AssemblerDialect = 1; // New-Style mnemonics. |
Joerg Sonnenberger | b604f82 | 2014-08-04 18:45:10 +0000 | [diff] [blame] | 79 | LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; |
Daniel Sanders | 753e176 | 2014-02-13 14:44:26 +0000 | [diff] [blame] | 80 | |
Ulrich Weigand | 6b577e2 | 2015-01-13 19:43:45 +0000 | [diff] [blame] | 81 | UseIntegratedAssembler = true; |
Jim Laskey | 28663c7 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 82 | } |
Anton Korobeynikov | d73396b | 2008-02-27 23:49:15 +0000 | [diff] [blame] | 83 | |