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//===----------------------------------------------------------------------===//
14
15#include "WebAssemblyMCAsmInfo.h"
16#include "WebAssemblyMCTargetDesc.h"
17#include "llvm/MC/MCExpr.h"
18#include "llvm/TargetParser/Triple.h"
19
20using namespace llvm;
21
22#define DEBUG_TYPE "wasm-mc-asm-info"
23
24const MCAsmInfo::AtSpecifier atSpecifiers[] = {
25 {.Kind: WebAssembly::S_TYPEINDEX, .Name: "TYPEINDEX"},
26 {.Kind: WebAssembly::S_TBREL, .Name: "TBREL"},
27 {.Kind: WebAssembly::S_MBREL, .Name: "MBREL"},
28 {.Kind: WebAssembly::S_TLSREL, .Name: "TLSREL"},
29 {.Kind: WebAssembly::S_GOT, .Name: "GOT"},
30 {.Kind: WebAssembly::S_GOT_TLS, .Name: "GOT@TLS"},
31 {.Kind: WebAssembly::S_FUNCINDEX, .Name: "FUNCINDEX"},
32};
33
34WebAssemblyMCAsmInfo::~WebAssemblyMCAsmInfo() = default; // anchor.
35
36WebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T,
37 const MCTargetOptions &Options)
38 : MCAsmInfoWasm(Options) {
39 CodePointerSize = CalleeSaveStackSlotSize = T.isArch64Bit() ? 8 : 4;
40
41 // TODO: What should MaxInstLength be?
42
43 UseDataRegionDirectives = true;
44
45 // Use .skip instead of .zero because .zero is confusing when used with two
46 // arguments (it doesn't actually zero things out).
47 ZeroDirective = "\t.skip\t";
48
49 Data8bitsDirective = "\t.int8\t";
50 Data16bitsDirective = "\t.int16\t";
51 Data32bitsDirective = "\t.int32\t";
52 Data64bitsDirective = "\t.int64\t";
53
54 AlignmentIsInBytes = false;
55 COMMDirectiveAlignmentIsInBytes = false;
56 LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
57
58 SupportsDebugInformation = true;
59 ExceptionsType = ExceptionHandling::None;
60
61 initializeAtSpecifiers(atSpecifiers);
62}
63