2015-06-30 07:51:55 +08:00
|
|
|
//- WebAssembly.td - Describe the WebAssembly Target Machine --*- tablegen -*-//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2015-12-08 11:33:51 +08:00
|
|
|
///
|
|
|
|
/// \file
|
2018-05-01 23:54:18 +08:00
|
|
|
/// This is a target description file for the WebAssembly architecture,
|
2015-12-08 11:33:51 +08:00
|
|
|
/// which is also known as "wasm".
|
|
|
|
///
|
2015-06-30 07:51:55 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target-independent interfaces which we are implementing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "llvm/Target/Target.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// WebAssembly Subtarget features.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-08-03 07:16:09 +08:00
|
|
|
def FeatureSIMD128 : SubtargetFeature<"simd128", "HasSIMD128", "true",
|
2015-07-02 07:41:25 +08:00
|
|
|
"Enable 128-bit SIMD">;
|
2017-08-31 02:07:45 +08:00
|
|
|
def FeatureAtomics : SubtargetFeature<"atomics", "HasAtomics", "true",
|
|
|
|
"Enable Atomics">;
|
2017-11-28 09:13:40 +08:00
|
|
|
def FeatureNontrappingFPToInt :
|
|
|
|
SubtargetFeature<"nontrapping-fptoint",
|
|
|
|
"HasNontrappingFPToInt", "true",
|
|
|
|
"Enable non-trapping float-to-int conversion operators">;
|
2015-06-30 07:51:55 +08:00
|
|
|
|
2018-01-20 01:16:24 +08:00
|
|
|
def FeatureSignExt :
|
|
|
|
SubtargetFeature<"sign-ext",
|
|
|
|
"HasSignExt", "true",
|
|
|
|
"Enable sign extension operators">;
|
|
|
|
|
2018-02-24 08:40:50 +08:00
|
|
|
def FeatureExceptionHandling :
|
|
|
|
SubtargetFeature<"exception-handling", "HasExceptionHandling", "true",
|
|
|
|
"Enable Wasm exception handling">;
|
|
|
|
|
2015-06-30 07:51:55 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Architectures.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Register File Description
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "WebAssemblyRegisterInfo.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Descriptions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "WebAssemblyInstrInfo.td"
|
|
|
|
|
|
|
|
def WebAssemblyInstrInfo : InstrInfo;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// WebAssembly Processors supported.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-07-02 07:41:25 +08:00
|
|
|
// Minimal Viable Product.
|
|
|
|
def : ProcessorModel<"mvp", NoSchedModel, []>;
|
|
|
|
|
2015-07-28 07:25:54 +08:00
|
|
|
// Generic processor: latest stable version.
|
|
|
|
def : ProcessorModel<"generic", NoSchedModel, []>;
|
|
|
|
|
2015-07-02 07:41:25 +08:00
|
|
|
// Latest and greatest experimental version of WebAssembly. Bugs included!
|
2017-08-31 02:07:45 +08:00
|
|
|
def : ProcessorModel<"bleeding-edge", NoSchedModel,
|
|
|
|
[FeatureSIMD128, FeatureAtomics]>;
|
2015-06-30 07:51:55 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target Declaration
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-03-21 04:06:35 +08:00
|
|
|
def WebAssemblyAsmParser : AsmParser {
|
|
|
|
// The physical register names are not in the binary format or asm text
|
|
|
|
let ShouldEmitMatchRegisterName = 0;
|
|
|
|
}
|
2018-03-22 05:46:47 +08:00
|
|
|
|
2018-05-11 06:16:44 +08:00
|
|
|
def WebAssemblyAsmWriter : AsmWriter {
|
|
|
|
string AsmWriterClassName = "InstPrinter";
|
|
|
|
int PassSubtarget = 0;
|
|
|
|
int Variant = 0;
|
|
|
|
bit isMCAsmWriter = 1;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:46:47 +08:00
|
|
|
def WebAssembly : Target {
|
|
|
|
let InstructionSet = WebAssemblyInstrInfo;
|
|
|
|
let AssemblyParsers = [WebAssemblyAsmParser];
|
2018-05-11 06:16:44 +08:00
|
|
|
let AssemblyWriters = [WebAssemblyAsmWriter];
|
2018-03-22 05:46:47 +08:00
|
|
|
}
|