xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //===-- WebAssemblyMCAsmInfo.cpp - WebAssembly asm properties -------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric ///
90b57cec5SDimitry Andric /// \file
100b57cec5SDimitry Andric /// This file contains the declarations of the WebAssemblyMCAsmInfo
110b57cec5SDimitry Andric /// properties.
120b57cec5SDimitry Andric ///
130b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #include "WebAssemblyMCAsmInfo.h"
16*06c3fb27SDimitry Andric #include "WebAssemblyMCTargetDesc.h"
17*06c3fb27SDimitry Andric #include "llvm/TargetParser/Triple.h"
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric using namespace llvm;
200b57cec5SDimitry Andric 
210b57cec5SDimitry Andric #define DEBUG_TYPE "wasm-mc-asm-info"
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric WebAssemblyMCAsmInfo::~WebAssemblyMCAsmInfo() = default; // anchor.
240b57cec5SDimitry Andric 
WebAssemblyMCAsmInfo(const Triple & T,const MCTargetOptions & Options)25480093f4SDimitry Andric WebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T,
26480093f4SDimitry Andric                                            const MCTargetOptions &Options) {
270b57cec5SDimitry Andric   CodePointerSize = CalleeSaveStackSlotSize = T.isArch64Bit() ? 8 : 4;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric   // TODO: What should MaxInstLength be?
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   UseDataRegionDirectives = true;
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric   // Use .skip instead of .zero because .zero is confusing when used with two
340b57cec5SDimitry Andric   // arguments (it doesn't actually zero things out).
350b57cec5SDimitry Andric   ZeroDirective = "\t.skip\t";
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric   Data8bitsDirective = "\t.int8\t";
380b57cec5SDimitry Andric   Data16bitsDirective = "\t.int16\t";
390b57cec5SDimitry Andric   Data32bitsDirective = "\t.int32\t";
400b57cec5SDimitry Andric   Data64bitsDirective = "\t.int64\t";
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric   AlignmentIsInBytes = false;
430b57cec5SDimitry Andric   COMMDirectiveAlignmentIsInBytes = false;
440b57cec5SDimitry Andric   LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   SupportsDebugInformation = true;
470b57cec5SDimitry Andric 
480eae32dcSDimitry Andric   // When compilation is done on a cpp file by clang, the exception model info
490eae32dcSDimitry Andric   // is stored in LangOptions, which is later used to set the info in
500eae32dcSDimitry Andric   // TargetOptions and then MCAsmInfo in LLVMTargetMachine::initAsmInfo(). But
510eae32dcSDimitry Andric   // this process does not happen when compiling bitcode directly with clang, so
520eae32dcSDimitry Andric   // we make sure this info is set correctly.
530eae32dcSDimitry Andric   if (WebAssembly::WasmEnableEH || WebAssembly::WasmEnableSjLj)
540eae32dcSDimitry Andric     ExceptionsType = ExceptionHandling::Wasm;
550b57cec5SDimitry Andric }
56