Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | //===-- WebAssemblyMCAsmInfo.cpp - WebAssembly asm properties -------------===// |
| 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 | /// \file |
| 11 | /// \brief This file contains the declarations of the WebAssemblyMCAsmInfo |
| 12 | /// properties. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #include "WebAssemblyMCAsmInfo.h" |
| 17 | #include "llvm/ADT/Triple.h" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 18 | using namespace llvm; |
| 19 | |
| 20 | #define DEBUG_TYPE "wasm-mc-asm-info" |
| 21 | |
Dan Gohman | 18eafb6 | 2017-02-22 01:23:18 +0000 | [diff] [blame] | 22 | WebAssemblyMCAsmInfoELF::~WebAssemblyMCAsmInfoELF() {} |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 23 | |
Dan Gohman | 18eafb6 | 2017-02-22 01:23:18 +0000 | [diff] [blame] | 24 | WebAssemblyMCAsmInfoELF::WebAssemblyMCAsmInfoELF(const Triple &T) { |
Benjamin Kramer | 54c781a | 2017-04-17 19:08:41 +0000 | [diff] [blame] | 25 | CodePointerSize = CalleeSaveStackSlotSize = T.isArch64Bit() ? 8 : 4; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 26 | |
| 27 | // TODO: What should MaxInstLength be? |
| 28 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 29 | UseDataRegionDirectives = true; |
| 30 | |
JF Bastien | b9ec4c6 | 2016-01-07 23:18:29 +0000 | [diff] [blame] | 31 | // Use .skip instead of .zero because .zero is confusing when used with two |
| 32 | // arguments (it doesn't actually zero things out). |
| 33 | ZeroDirective = "\t.skip\t"; |
| 34 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 35 | Data8bitsDirective = "\t.int8\t"; |
| 36 | Data16bitsDirective = "\t.int16\t"; |
| 37 | Data32bitsDirective = "\t.int32\t"; |
| 38 | Data64bitsDirective = "\t.int64\t"; |
| 39 | |
| 40 | AlignmentIsInBytes = false; |
| 41 | COMMDirectiveAlignmentIsInBytes = false; |
| 42 | LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment; |
| 43 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 44 | SupportsDebugInformation = true; |
| 45 | |
| 46 | // For now, WebAssembly does not support exceptions. |
| 47 | ExceptionsType = ExceptionHandling::None; |
| 48 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 49 | // TODO: UseIntegratedAssembler? |
Dan Gohman | 2f301f3 | 2016-01-15 23:59:13 +0000 | [diff] [blame] | 50 | |
| 51 | // WebAssembly's stack is never executable. |
| 52 | UsesNonexecutableStackSection = false; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 53 | } |
Dan Gohman | 18eafb6 | 2017-02-22 01:23:18 +0000 | [diff] [blame] | 54 | |
| 55 | WebAssemblyMCAsmInfo::~WebAssemblyMCAsmInfo() {} |
| 56 | |
| 57 | WebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T) { |
Benjamin Kramer | 54c781a | 2017-04-17 19:08:41 +0000 | [diff] [blame] | 58 | CodePointerSize = CalleeSaveStackSlotSize = T.isArch64Bit() ? 8 : 4; |
Dan Gohman | 18eafb6 | 2017-02-22 01:23:18 +0000 | [diff] [blame] | 59 | |
| 60 | // TODO: What should MaxInstLength be? |
| 61 | |
| 62 | UseDataRegionDirectives = true; |
| 63 | |
| 64 | // Use .skip instead of .zero because .zero is confusing when used with two |
| 65 | // arguments (it doesn't actually zero things out). |
| 66 | ZeroDirective = "\t.skip\t"; |
| 67 | |
| 68 | Data8bitsDirective = "\t.int8\t"; |
| 69 | Data16bitsDirective = "\t.int16\t"; |
| 70 | Data32bitsDirective = "\t.int32\t"; |
| 71 | Data64bitsDirective = "\t.int64\t"; |
| 72 | |
| 73 | AlignmentIsInBytes = false; |
| 74 | COMMDirectiveAlignmentIsInBytes = false; |
| 75 | LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment; |
| 76 | |
| 77 | SupportsDebugInformation = true; |
| 78 | |
| 79 | // For now, WebAssembly does not support exceptions. |
| 80 | ExceptionsType = ExceptionHandling::None; |
| 81 | |
| 82 | // TODO: UseIntegratedAssembler? |
| 83 | } |