blob: 33a4cd33f8d37b7b1f7654adc4b89cbdb8630154 [file] [log] [blame]
Dan Gohman10e730a2015-06-29 23:51:55 +00001//- 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 Gohmanad664b32015-12-08 03:33:51 +00009///
10/// \file
11/// \brief This is a target description file for the WebAssembly architecture,
12/// which is also known as "wasm".
13///
Dan Gohman10e730a2015-06-29 23:51:55 +000014//===----------------------------------------------------------------------===//
15
16//===----------------------------------------------------------------------===//
17// Target-independent interfaces which we are implementing
18//===----------------------------------------------------------------------===//
19
20include "llvm/Target/Target.td"
21
22//===----------------------------------------------------------------------===//
23// WebAssembly Subtarget features.
24//===----------------------------------------------------------------------===//
25
Derek Schuff39bf39f2016-08-02 23:16:09 +000026def FeatureSIMD128 : SubtargetFeature<"simd128", "HasSIMD128", "true",
JF Bastien03855df2015-07-01 23:41:25 +000027 "Enable 128-bit SIMD">;
Derek Schuff18ba1922017-08-30 18:07:45 +000028def FeatureAtomics : SubtargetFeature<"atomics", "HasAtomics", "true",
29 "Enable Atomics">;
Dan Gohmancdd48b82017-11-28 01:13:40 +000030def FeatureNontrappingFPToInt :
31 SubtargetFeature<"nontrapping-fptoint",
32 "HasNontrappingFPToInt", "true",
33 "Enable non-trapping float-to-int conversion operators">;
Dan Gohman10e730a2015-06-29 23:51:55 +000034
Dan Gohman5d2b9352018-01-19 17:16:24 +000035def FeatureSignExt :
36 SubtargetFeature<"sign-ext",
37 "HasSignExt", "true",
38 "Enable sign extension operators">;
39
Heejin Ahn9386bde2018-02-24 00:40:50 +000040def FeatureExceptionHandling :
41 SubtargetFeature<"exception-handling", "HasExceptionHandling", "true",
42 "Enable Wasm exception handling">;
43
Dan Gohman10e730a2015-06-29 23:51:55 +000044//===----------------------------------------------------------------------===//
45// Architectures.
46//===----------------------------------------------------------------------===//
47
48//===----------------------------------------------------------------------===//
49// Register File Description
50//===----------------------------------------------------------------------===//
51
52include "WebAssemblyRegisterInfo.td"
53
54//===----------------------------------------------------------------------===//
55// Instruction Descriptions
56//===----------------------------------------------------------------------===//
57
58include "WebAssemblyInstrInfo.td"
59
60def WebAssemblyInstrInfo : InstrInfo;
61
62//===----------------------------------------------------------------------===//
63// WebAssembly Processors supported.
64//===----------------------------------------------------------------------===//
65
JF Bastien03855df2015-07-01 23:41:25 +000066// Minimal Viable Product.
67def : ProcessorModel<"mvp", NoSchedModel, []>;
68
JF Bastien088c47e2015-07-27 23:25:54 +000069// Generic processor: latest stable version.
70def : ProcessorModel<"generic", NoSchedModel, []>;
71
JF Bastien03855df2015-07-01 23:41:25 +000072// Latest and greatest experimental version of WebAssembly. Bugs included!
Derek Schuff18ba1922017-08-30 18:07:45 +000073def : ProcessorModel<"bleeding-edge", NoSchedModel,
74 [FeatureSIMD128, FeatureAtomics]>;
Dan Gohman10e730a2015-06-29 23:51:55 +000075
76//===----------------------------------------------------------------------===//
77// Target Declaration
78//===----------------------------------------------------------------------===//
79
Derek Schuffe4825972018-03-20 20:06:35 +000080def WebAssemblyAsmParser : AsmParser {
81 // The physical register names are not in the binary format or asm text
82 let ShouldEmitMatchRegisterName = 0;
83}
Reid Kleckner440219d52018-03-21 21:46:47 +000084
85def WebAssembly : Target {
86 let InstructionSet = WebAssemblyInstrInfo;
87 let AssemblyParsers = [WebAssemblyAsmParser];
88}