110e730a2SDan Gohman //===-- WebAssemblyMCAsmInfo.cpp - WebAssembly asm properties -------------===// 210e730a2SDan Gohman // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 610e730a2SDan Gohman // 710e730a2SDan Gohman //===----------------------------------------------------------------------===// 810e730a2SDan Gohman /// 910e730a2SDan Gohman /// \file 105f8f34e4SAdrian Prantl /// This file contains the declarations of the WebAssemblyMCAsmInfo 1110e730a2SDan Gohman /// properties. 1210e730a2SDan Gohman /// 1310e730a2SDan Gohman //===----------------------------------------------------------------------===// 1410e730a2SDan Gohman 1510e730a2SDan Gohman #include "WebAssemblyMCAsmInfo.h" 16*4625b848SHeejin Ahn #include "Utils/WebAssemblyUtilities.h" 1710e730a2SDan Gohman #include "llvm/ADT/Triple.h" 18cf2a9e28SSam Clegg 1910e730a2SDan Gohman using namespace llvm; 2010e730a2SDan Gohman 2110e730a2SDan Gohman #define DEBUG_TYPE "wasm-mc-asm-info" 2210e730a2SDan Gohman 2318c56a07SHeejin Ahn WebAssemblyMCAsmInfo::~WebAssemblyMCAsmInfo() = default; // anchor. 2418eafb6cSDan Gohman WebAssemblyMCAsmInfo(const Triple & T,const MCTargetOptions & Options)254b63ca13SMirko BrkusaninWebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T, 264b63ca13SMirko Brkusanin const MCTargetOptions &Options) { 2716f02431SWouter van Oortmerssen CodePointerSize = CalleeSaveStackSlotSize = T.isArch64Bit() ? 8 : 4; 2818eafb6cSDan Gohman 2918eafb6cSDan Gohman // TODO: What should MaxInstLength be? 3018eafb6cSDan Gohman 3118eafb6cSDan Gohman UseDataRegionDirectives = true; 3218eafb6cSDan Gohman 3318eafb6cSDan Gohman // Use .skip instead of .zero because .zero is confusing when used with two 3418eafb6cSDan Gohman // arguments (it doesn't actually zero things out). 3518eafb6cSDan Gohman ZeroDirective = "\t.skip\t"; 3618eafb6cSDan Gohman 3718eafb6cSDan Gohman Data8bitsDirective = "\t.int8\t"; 3818eafb6cSDan Gohman Data16bitsDirective = "\t.int16\t"; 3918eafb6cSDan Gohman Data32bitsDirective = "\t.int32\t"; 4018eafb6cSDan Gohman Data64bitsDirective = "\t.int64\t"; 4118eafb6cSDan Gohman 4218eafb6cSDan Gohman AlignmentIsInBytes = false; 4318eafb6cSDan Gohman COMMDirectiveAlignmentIsInBytes = false; 4418eafb6cSDan Gohman LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment; 4518eafb6cSDan Gohman 4618eafb6cSDan Gohman SupportsDebugInformation = true; 4718eafb6cSDan Gohman 48*4625b848SHeejin Ahn // When compilation is done on a cpp file by clang, the exception model info 49*4625b848SHeejin Ahn // is stored in LangOptions, which is later used to set the info in 50*4625b848SHeejin Ahn // TargetOptions and then MCAsmInfo in LLVMTargetMachine::initAsmInfo(). But 51*4625b848SHeejin Ahn // this process does not happen when compiling bitcode directly with clang, so 52*4625b848SHeejin Ahn // we make sure this info is set correctly. 53*4625b848SHeejin Ahn if (WebAssembly::WasmEnableEH || WebAssembly::WasmEnableSjLj) 54*4625b848SHeejin Ahn ExceptionsType = ExceptionHandling::Wasm; 5518eafb6cSDan Gohman } 56