| Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | //- WebAssembly.td - Describe the WebAssembly Target Machine --*- tablegen -*-// |
| 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 | //===----------------------------------------------------------------------===// |
| Dan Gohman | ad664b3 | 2015-12-08 03:33:51 +0000 | [diff] [blame] | 9 | /// |
| 10 | /// \file |
| Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 11 | /// This is a target description file for the WebAssembly architecture, |
| Dan Gohman | ad664b3 | 2015-12-08 03:33:51 +0000 | [diff] [blame] | 12 | /// which is also known as "wasm". |
| 13 | /// |
| Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | // Target-independent interfaces which we are implementing |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | |
| 20 | include "llvm/Target/Target.td" |
| 21 | |
| 22 | //===----------------------------------------------------------------------===// |
| 23 | // WebAssembly Subtarget features. |
| 24 | //===----------------------------------------------------------------------===// |
| 25 | |
| Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 26 | def FeatureSIMD128 : SubtargetFeature<"simd128", "HasSIMD128", "true", |
| JF Bastien | 03855df | 2015-07-01 23:41:25 +0000 | [diff] [blame] | 27 | "Enable 128-bit SIMD">; |
| Derek Schuff | 18ba192 | 2017-08-30 18:07:45 +0000 | [diff] [blame] | 28 | def FeatureAtomics : SubtargetFeature<"atomics", "HasAtomics", "true", |
| 29 | "Enable Atomics">; |
| Dan Gohman | cdd48b8 | 2017-11-28 01:13:40 +0000 | [diff] [blame] | 30 | def FeatureNontrappingFPToInt : |
| 31 | SubtargetFeature<"nontrapping-fptoint", |
| 32 | "HasNontrappingFPToInt", "true", |
| 33 | "Enable non-trapping float-to-int conversion operators">; |
| Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 34 | |
| Dan Gohman | 5d2b935 | 2018-01-19 17:16:24 +0000 | [diff] [blame] | 35 | def FeatureSignExt : |
| 36 | SubtargetFeature<"sign-ext", |
| 37 | "HasSignExt", "true", |
| 38 | "Enable sign extension operators">; |
| 39 | |
| Heejin Ahn | 9386bde | 2018-02-24 00:40:50 +0000 | [diff] [blame] | 40 | def FeatureExceptionHandling : |
| 41 | SubtargetFeature<"exception-handling", "HasExceptionHandling", "true", |
| 42 | "Enable Wasm exception handling">; |
| 43 | |
| Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 44 | //===----------------------------------------------------------------------===// |
| 45 | // Architectures. |
| 46 | //===----------------------------------------------------------------------===// |
| 47 | |
| 48 | //===----------------------------------------------------------------------===// |
| 49 | // Register File Description |
| 50 | //===----------------------------------------------------------------------===// |
| 51 | |
| 52 | include "WebAssemblyRegisterInfo.td" |
| 53 | |
| 54 | //===----------------------------------------------------------------------===// |
| 55 | // Instruction Descriptions |
| 56 | //===----------------------------------------------------------------------===// |
| 57 | |
| 58 | include "WebAssemblyInstrInfo.td" |
| 59 | |
| 60 | def WebAssemblyInstrInfo : InstrInfo; |
| 61 | |
| 62 | //===----------------------------------------------------------------------===// |
| 63 | // WebAssembly Processors supported. |
| 64 | //===----------------------------------------------------------------------===// |
| 65 | |
| JF Bastien | 03855df | 2015-07-01 23:41:25 +0000 | [diff] [blame] | 66 | // Minimal Viable Product. |
| 67 | def : ProcessorModel<"mvp", NoSchedModel, []>; |
| 68 | |
| JF Bastien | 088c47e | 2015-07-27 23:25:54 +0000 | [diff] [blame] | 69 | // Generic processor: latest stable version. |
| 70 | def : ProcessorModel<"generic", NoSchedModel, []>; |
| 71 | |
| JF Bastien | 03855df | 2015-07-01 23:41:25 +0000 | [diff] [blame] | 72 | // Latest and greatest experimental version of WebAssembly. Bugs included! |
| Derek Schuff | 18ba192 | 2017-08-30 18:07:45 +0000 | [diff] [blame] | 73 | def : ProcessorModel<"bleeding-edge", NoSchedModel, |
| 74 | [FeatureSIMD128, FeatureAtomics]>; |
| Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 75 | |
| 76 | //===----------------------------------------------------------------------===// |
| 77 | // Target Declaration |
| 78 | //===----------------------------------------------------------------------===// |
| 79 | |
| Derek Schuff | e482597 | 2018-03-20 20:06:35 +0000 | [diff] [blame] | 80 | def WebAssemblyAsmParser : AsmParser { |
| 81 | // The physical register names are not in the binary format or asm text |
| 82 | let ShouldEmitMatchRegisterName = 0; |
| 83 | } |
| Reid Kleckner | 440219d5 | 2018-03-21 21:46:47 +0000 | [diff] [blame] | 84 | |
| Sam Clegg | 16c1682 | 2018-05-10 22:16:44 +0000 | [diff] [blame^] | 85 | def WebAssemblyAsmWriter : AsmWriter { |
| 86 | string AsmWriterClassName = "InstPrinter"; |
| 87 | int PassSubtarget = 0; |
| 88 | int Variant = 0; |
| 89 | bit isMCAsmWriter = 1; |
| 90 | } |
| 91 | |
| Reid Kleckner | 440219d5 | 2018-03-21 21:46:47 +0000 | [diff] [blame] | 92 | def WebAssembly : Target { |
| 93 | let InstructionSet = WebAssemblyInstrInfo; |
| 94 | let AssemblyParsers = [WebAssemblyAsmParser]; |
| Sam Clegg | 16c1682 | 2018-05-10 22:16:44 +0000 | [diff] [blame^] | 95 | let AssemblyWriters = [WebAssemblyAsmWriter]; |
| Reid Kleckner | 440219d5 | 2018-03-21 21:46:47 +0000 | [diff] [blame] | 96 | } |