Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | //==- 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 Gohman | a11fb23 | 2016-01-12 03:09:16 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCInstrDesc.h" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 19 | #include "llvm/Support/DataTypes.h" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 23 | class MCAsmBackend; |
| 24 | class MCCodeEmitter; |
| 25 | class MCContext; |
| 26 | class MCInstrInfo; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 27 | class MCObjectWriter; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 28 | class MCSubtargetInfo; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 29 | class Target; |
| 30 | class Triple; |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 31 | class raw_pwrite_stream; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 32 | |
Dan Gohman | d82494b | 2015-07-01 21:42:34 +0000 | [diff] [blame] | 33 | extern Target TheWebAssemblyTarget32; |
| 34 | extern Target TheWebAssemblyTarget64; |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 35 | |
Dan Gohman | cff7983 | 2016-01-19 21:31:41 +0000 | [diff] [blame^] | 36 | MCCodeEmitter *createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII); |
Dan Gohman | 53828fd | 2015-11-23 16:50:18 +0000 | [diff] [blame] | 37 | |
Dan Gohman | cceedf7 | 2016-01-08 00:43:54 +0000 | [diff] [blame] | 38 | MCAsmBackend *createWebAssemblyAsmBackend(const Triple &TT); |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 39 | |
Dan Gohman | 05ac43f | 2015-12-17 01:39:00 +0000 | [diff] [blame] | 40 | MCObjectWriter *createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS, |
| 41 | bool Is64Bit, uint8_t OSABI); |
| 42 | |
Dan Gohman | a11fb23 | 2016-01-12 03:09:16 +0000 | [diff] [blame] | 43 | namespace WebAssembly { |
| 44 | enum 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 Gohman | 3469ee1 | 2016-01-12 20:30:51 +0000 | [diff] [blame] | 50 | |
| 51 | /// WebAssembly-specific directive identifiers. |
| 52 | enum 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 Gohman | a11fb23 | 2016-01-12 03:09:16 +0000 | [diff] [blame] | 60 | } // end namespace WebAssembly |
| 61 | |
| 62 | namespace WebAssemblyII { |
| 63 | enum { |
| 64 | // For variadic instructions, this flag indicates whether an operand |
| 65 | // in the variable_ops range is an immediate value. |
Dan Gohman | 3469ee1 | 2016-01-12 20:30:51 +0000 | [diff] [blame] | 66 | VariableOpIsImmediate = (1 << 0), |
Dan Gohman | 1d68e80f | 2016-01-12 19:14:46 +0000 | [diff] [blame] | 67 | // For immediate values in the variable_ops range, this flag indicates |
| 68 | // whether the value represents a control-flow label. |
Dan Gohman | 3469ee1 | 2016-01-12 20:30:51 +0000 | [diff] [blame] | 69 | VariableOpImmediateIsLabel = (1 << 1), |
Dan Gohman | a11fb23 | 2016-01-12 03:09:16 +0000 | [diff] [blame] | 70 | }; |
| 71 | } // end namespace WebAssemblyII |
| 72 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 73 | } // end namespace llvm |
| 74 | |
| 75 | // Defines symbolic names for WebAssembly registers. This defines a mapping from |
| 76 | // register name to register number. |
| 77 | // |
JF Bastien | 5ca0bac | 2015-07-10 18:23:10 +0000 | [diff] [blame] | 78 | #define GET_REGINFO_ENUM |
| 79 | #include "WebAssemblyGenRegisterInfo.inc" |
| 80 | |
JF Bastien | b9073fb | 2015-07-22 21:28:15 +0000 | [diff] [blame] | 81 | // Defines symbolic names for the WebAssembly instructions. |
| 82 | // |
| 83 | #define GET_INSTRINFO_ENUM |
| 84 | #include "WebAssemblyGenInstrInfo.inc" |
| 85 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 86 | #define GET_SUBTARGETINFO_ENUM |
| 87 | #include "WebAssemblyGenSubtargetInfo.inc" |
| 88 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 89 | #endif |