1//===-- WebAssemblyTargetInfo.cpp - WebAssembly Target Implementation -----===//
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 registers the WebAssembly target.
11///
12//===----------------------------------------------------------------------===//
13
14#include "TargetInfo/WebAssemblyTargetInfo.h"
15#include "llvm/MC/TargetRegistry.h"
16using namespace llvm;
17
18#define DEBUG_TYPE "wasm-target-info"
19
20Target &llvm::getTheWebAssemblyTarget32() {
21 static Target TheWebAssemblyTarget32;
22 return TheWebAssemblyTarget32;
23}
24Target &llvm::getTheWebAssemblyTarget64() {
25 static Target TheWebAssemblyTarget64;
26 return TheWebAssemblyTarget64;
27}
28
29extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyTargetInfo() {
30 RegisterTarget<Triple::wasm32> X(getTheWebAssemblyTarget32(), "wasm32",
31 "WebAssembly 32-bit", "WebAssembly");
32 RegisterTarget<Triple::wasm64> Y(getTheWebAssemblyTarget64(), "wasm64",
33 "WebAssembly 64-bit", "WebAssembly");
34}
35
36// Defines llvm::WebAssembly::getWasm64Opcode llvm::WebAssembly::getStackOpcode
37// which have to be in a shared location between CodeGen and MC.
38#define GET_INSTRMAP_INFO 1
39#define GET_INSTRINFO_ENUM 1
40#define GET_INSTRINFO_MC_HELPER_DECLS
41#include "WebAssemblyGenInstrInfo.inc"
42