blob: a87d743fed5b839fa7a59adeda4d035866ed4188 [file] [log] [blame]
Dan Gohman10e730a2015-06-29 23:51:55 +00001//==- WebAssemblyMCTargetDesc.h - WebAssembly Target Descriptions -*- C++ -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief This file provides WebAssembly-specific target descriptions.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
16#define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
17
Dan Gohmana11fb232016-01-12 03:09:16 +000018#include "llvm/MC/MCInstrDesc.h"
Dan Gohman10e730a2015-06-29 23:51:55 +000019#include "llvm/Support/DataTypes.h"
Dan Gohman10e730a2015-06-29 23:51:55 +000020
21namespace llvm {
22
Dan Gohman10e730a2015-06-29 23:51:55 +000023class MCAsmBackend;
24class MCCodeEmitter;
25class MCContext;
26class MCInstrInfo;
Dan Gohman10e730a2015-06-29 23:51:55 +000027class MCObjectWriter;
Dan Gohman10e730a2015-06-29 23:51:55 +000028class MCSubtargetInfo;
Dan Gohman10e730a2015-06-29 23:51:55 +000029class Target;
30class Triple;
Dan Gohman53828fd2015-11-23 16:50:18 +000031class raw_pwrite_stream;
Dan Gohman10e730a2015-06-29 23:51:55 +000032
Dan Gohmand82494b2015-07-01 21:42:34 +000033extern Target TheWebAssemblyTarget32;
34extern Target TheWebAssemblyTarget64;
Dan Gohman10e730a2015-06-29 23:51:55 +000035
Dan Gohmancff79832016-01-19 21:31:41 +000036MCCodeEmitter *createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII);
Dan Gohman53828fd2015-11-23 16:50:18 +000037
Dan Gohmancceedf72016-01-08 00:43:54 +000038MCAsmBackend *createWebAssemblyAsmBackend(const Triple &TT);
Dan Gohman10e730a2015-06-29 23:51:55 +000039
Dan Gohman05ac43f2015-12-17 01:39:00 +000040MCObjectWriter *createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS,
41 bool Is64Bit, uint8_t OSABI);
42
Dan Gohmana11fb232016-01-12 03:09:16 +000043namespace WebAssembly {
44enum OperandType {
45 /// Basic block label in a branch construct.
46 OPERAND_BASIC_BLOCK = MCOI::OPERAND_FIRST_TARGET,
47 /// Floating-point immediate.
48 OPERAND_FPIMM
49};
Dan Gohman3469ee12016-01-12 20:30:51 +000050
51/// WebAssembly-specific directive identifiers.
52enum Directive {
53 // FIXME: This is not the real binary encoding.
54 DotParam = UINT64_MAX - 0, ///< .param
55 DotResult = UINT64_MAX - 1, ///< .result
56 DotLocal = UINT64_MAX - 2, ///< .local
57 DotEndFunc = UINT64_MAX - 3, ///< .endfunc
58};
59
Dan Gohmana11fb232016-01-12 03:09:16 +000060} // end namespace WebAssembly
61
62namespace WebAssemblyII {
63enum {
64 // For variadic instructions, this flag indicates whether an operand
65 // in the variable_ops range is an immediate value.
Dan Gohman3469ee12016-01-12 20:30:51 +000066 VariableOpIsImmediate = (1 << 0),
Dan Gohman1d68e80f2016-01-12 19:14:46 +000067 // For immediate values in the variable_ops range, this flag indicates
68 // whether the value represents a control-flow label.
Dan Gohman3469ee12016-01-12 20:30:51 +000069 VariableOpImmediateIsLabel = (1 << 1),
Dan Gohmana11fb232016-01-12 03:09:16 +000070};
71} // end namespace WebAssemblyII
72
Dan Gohman10e730a2015-06-29 23:51:55 +000073} // end namespace llvm
74
75// Defines symbolic names for WebAssembly registers. This defines a mapping from
76// register name to register number.
77//
JF Bastien5ca0bac2015-07-10 18:23:10 +000078#define GET_REGINFO_ENUM
79#include "WebAssemblyGenRegisterInfo.inc"
80
JF Bastienb9073fb2015-07-22 21:28:15 +000081// Defines symbolic names for the WebAssembly instructions.
82//
83#define GET_INSTRINFO_ENUM
84#include "WebAssemblyGenInstrInfo.inc"
85
Dan Gohman10e730a2015-06-29 23:51:55 +000086#define GET_SUBTARGETINFO_ENUM
87#include "WebAssemblyGenSubtargetInfo.inc"
88
Dan Gohman10e730a2015-06-29 23:51:55 +000089#endif