[WebAssembly] Add new target feature in support of 'extended-const' proposal
[llvm-project.git] / llvm / lib / Target / WebAssembly / MCTargetDesc / WebAssemblyMCAsmInfo.cpp
blobd8122950e0615fca65e67b5aa122ddf19a306c4b
1 //===-- WebAssemblyMCAsmInfo.cpp - WebAssembly asm properties -------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file contains the declarations of the WebAssemblyMCAsmInfo
11 /// properties.
12 ///
13 //===----------------------------------------------------------------------===//
15 #include "WebAssemblyMCAsmInfo.h"
16 #include "Utils/WebAssemblyUtilities.h"
17 #include "llvm/ADT/Triple.h"
19 using namespace llvm;
21 #define DEBUG_TYPE "wasm-mc-asm-info"
23 WebAssemblyMCAsmInfo::~WebAssemblyMCAsmInfo() = default; // anchor.
25 WebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T,
26 const MCTargetOptions &Options) {
27 CodePointerSize = CalleeSaveStackSlotSize = T.isArch64Bit() ? 8 : 4;
29 // TODO: What should MaxInstLength be?
31 UseDataRegionDirectives = true;
33 // Use .skip instead of .zero because .zero is confusing when used with two
34 // arguments (it doesn't actually zero things out).
35 ZeroDirective = "\t.skip\t";
37 Data8bitsDirective = "\t.int8\t";
38 Data16bitsDirective = "\t.int16\t";
39 Data32bitsDirective = "\t.int32\t";
40 Data64bitsDirective = "\t.int64\t";
42 AlignmentIsInBytes = false;
43 COMMDirectiveAlignmentIsInBytes = false;
44 LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
46 SupportsDebugInformation = true;
48 // When compilation is done on a cpp file by clang, the exception model info
49 // is stored in LangOptions, which is later used to set the info in
50 // TargetOptions and then MCAsmInfo in LLVMTargetMachine::initAsmInfo(). But
51 // this process does not happen when compiling bitcode directly with clang, so
52 // we make sure this info is set correctly.
53 if (WebAssembly::WasmEnableEH || WebAssembly::WasmEnableSjLj)
54 ExceptionsType = ExceptionHandling::Wasm;
56 // TODO: UseIntegratedAssembler?