2015-06-30 01:51:55 +02:00
|
|
|
//- WebAssembly.td - Describe the WebAssembly Target Machine --*- tablegen -*-//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-06-30 01:51:55 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2015-12-08 04:33:51 +01:00
|
|
|
///
|
|
|
|
/// \file
|
2018-05-01 17:54:18 +02:00
|
|
|
/// This is a target description file for the WebAssembly architecture,
|
2015-12-08 04:33:51 +01:00
|
|
|
/// which is also known as "wasm".
|
|
|
|
///
|
2015-06-30 01:51:55 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target-independent interfaces which we are implementing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "llvm/Target/Target.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// WebAssembly Subtarget features.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2019-01-10 23:32:11 +01:00
|
|
|
def FeatureSIMD128 : SubtargetFeature<"simd128", "SIMDLevel", "SIMD128",
|
2015-07-02 01:41:25 +02:00
|
|
|
"Enable 128-bit SIMD">;
|
2019-01-10 23:32:11 +01:00
|
|
|
|
|
|
|
def FeatureUnimplementedSIMD128 :
|
|
|
|
SubtargetFeature<"unimplemented-simd128",
|
|
|
|
"SIMDLevel", "UnimplementedSIMD128",
|
|
|
|
"Enable 128-bit SIMD not yet implemented in engines",
|
|
|
|
[FeatureSIMD128]>;
|
|
|
|
|
2017-08-30 20:07:45 +02:00
|
|
|
def FeatureAtomics : SubtargetFeature<"atomics", "HasAtomics", "true",
|
|
|
|
"Enable Atomics">;
|
2019-05-23 19:26:47 +02:00
|
|
|
|
2017-11-28 02:13:40 +01:00
|
|
|
def FeatureNontrappingFPToInt :
|
|
|
|
SubtargetFeature<"nontrapping-fptoint",
|
|
|
|
"HasNontrappingFPToInt", "true",
|
|
|
|
"Enable non-trapping float-to-int conversion operators">;
|
2015-06-30 01:51:55 +02:00
|
|
|
|
2018-01-19 18:16:24 +01:00
|
|
|
def FeatureSignExt :
|
|
|
|
SubtargetFeature<"sign-ext",
|
|
|
|
"HasSignExt", "true",
|
|
|
|
"Enable sign extension operators">;
|
|
|
|
|
2019-05-23 19:26:47 +02:00
|
|
|
def FeatureTailCall :
|
|
|
|
SubtargetFeature<"tail-call",
|
|
|
|
"HasTailCall", "true",
|
|
|
|
"Enable tail call instructions">;
|
|
|
|
|
2018-02-24 01:40:50 +01:00
|
|
|
def FeatureExceptionHandling :
|
|
|
|
SubtargetFeature<"exception-handling", "HasExceptionHandling", "true",
|
|
|
|
"Enable Wasm exception handling">;
|
|
|
|
|
2019-01-31 22:02:19 +01:00
|
|
|
def FeatureBulkMemory :
|
|
|
|
SubtargetFeature<"bulk-memory", "HasBulkMemory", "true",
|
|
|
|
"Enable bulk memory operations">;
|
|
|
|
|
2019-05-23 19:26:47 +02:00
|
|
|
def FeatureMultivalue :
|
|
|
|
SubtargetFeature<"multivalue",
|
|
|
|
"HasMultivalue", "true",
|
|
|
|
"Enable multivalue blocks, instructions, and functions">;
|
|
|
|
|
[WebAssembly] Add mutable globals feature
Summary:
This feature is not actually used for anything in the WebAssembly
backend, but adding it allows users to get it into the target features
sections of their objects, which makes these objects
future-compatible.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, jdoerfert, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D60013
llvm-svn: 357321
2019-03-29 23:00:18 +01:00
|
|
|
def FeatureMutableGlobals :
|
|
|
|
SubtargetFeature<"mutable-globals", "HasMutableGlobals", "true",
|
|
|
|
"Enable mutable globals">;
|
|
|
|
|
2015-06-30 01:51:55 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Architectures.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Register File Description
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "WebAssemblyRegisterInfo.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Descriptions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "WebAssemblyInstrInfo.td"
|
|
|
|
|
|
|
|
def WebAssemblyInstrInfo : InstrInfo;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// WebAssembly Processors supported.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-07-02 01:41:25 +02:00
|
|
|
// Minimal Viable Product.
|
|
|
|
def : ProcessorModel<"mvp", NoSchedModel, []>;
|
|
|
|
|
2015-07-28 01:25:54 +02:00
|
|
|
// Generic processor: latest stable version.
|
|
|
|
def : ProcessorModel<"generic", NoSchedModel, []>;
|
|
|
|
|
2015-07-02 01:41:25 +02:00
|
|
|
// Latest and greatest experimental version of WebAssembly. Bugs included!
|
2017-08-30 20:07:45 +02:00
|
|
|
def : ProcessorModel<"bleeding-edge", NoSchedModel,
|
2018-11-10 01:11:14 +01:00
|
|
|
[FeatureSIMD128, FeatureAtomics,
|
2019-04-12 22:39:53 +02:00
|
|
|
FeatureNontrappingFPToInt, FeatureSignExt,
|
|
|
|
FeatureMutableGlobals]>;
|
2015-06-30 01:51:55 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target Declaration
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-03-20 21:06:35 +01:00
|
|
|
def WebAssemblyAsmParser : AsmParser {
|
|
|
|
// The physical register names are not in the binary format or asm text
|
|
|
|
let ShouldEmitMatchRegisterName = 0;
|
|
|
|
}
|
2018-03-21 22:46:47 +01:00
|
|
|
|
2018-05-11 00:16:44 +02:00
|
|
|
def WebAssemblyAsmWriter : AsmWriter {
|
|
|
|
string AsmWriterClassName = "InstPrinter";
|
|
|
|
int PassSubtarget = 0;
|
|
|
|
int Variant = 0;
|
|
|
|
bit isMCAsmWriter = 1;
|
|
|
|
}
|
|
|
|
|
2018-03-21 22:46:47 +01:00
|
|
|
def WebAssembly : Target {
|
|
|
|
let InstructionSet = WebAssemblyInstrInfo;
|
|
|
|
let AssemblyParsers = [WebAssemblyAsmParser];
|
2018-05-11 00:16:44 +02:00
|
|
|
let AssemblyWriters = [WebAssemblyAsmWriter];
|
2018-03-21 22:46:47 +01:00
|
|
|
}
|