1 //==- WebAssemblyMCTargetDesc.h - WebAssembly Target Descriptions -*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file provides WebAssembly-specific target descriptions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
16 #define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
18 #include "llvm/MC/MCInstrDesc.h"
19 #include "llvm/Support/DataTypes.h"
28 class MCSubtargetInfo;
31 class raw_pwrite_stream;
33 extern Target TheWebAssemblyTarget32;
34 extern Target TheWebAssemblyTarget64;
36 MCCodeEmitter *createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII,
39 MCAsmBackend *createWebAssemblyAsmBackend(const Triple &TT);
41 MCObjectWriter *createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS,
42 bool Is64Bit, uint8_t OSABI);
44 namespace WebAssembly {
46 /// Basic block label in a branch construct.
47 OPERAND_BASIC_BLOCK = MCOI::OPERAND_FIRST_TARGET,
48 /// Floating-point immediate.
52 /// WebAssembly-specific directive identifiers.
54 // FIXME: This is not the real binary encoding.
55 DotParam = UINT64_MAX - 0, ///< .param
56 DotResult = UINT64_MAX - 1, ///< .result
57 DotLocal = UINT64_MAX - 2, ///< .local
58 DotEndFunc = UINT64_MAX - 3, ///< .endfunc
61 } // end namespace WebAssembly
63 namespace WebAssemblyII {
65 // For variadic instructions, this flag indicates whether an operand
66 // in the variable_ops range is an immediate value.
67 VariableOpIsImmediate = (1 << 0),
68 // For immediate values in the variable_ops range, this flag indicates
69 // whether the value represents a control-flow label.
70 VariableOpImmediateIsLabel = (1 << 1),
72 } // end namespace WebAssemblyII
74 } // end namespace llvm
76 // Defines symbolic names for WebAssembly registers. This defines a mapping from
77 // register name to register number.
79 #define GET_REGINFO_ENUM
80 #include "WebAssemblyGenRegisterInfo.inc"
82 // Defines symbolic names for the WebAssembly instructions.
84 #define GET_INSTRINFO_ENUM
85 #include "WebAssemblyGenInstrInfo.inc"
87 #define GET_SUBTARGETINFO_ENUM
88 #include "WebAssemblyGenSubtargetInfo.inc"