1285163Sdim//- WebAssembly.td - Describe the WebAssembly Target Machine --*- tablegen -*-// 2285163Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6285163Sdim// 7285163Sdim//===----------------------------------------------------------------------===// 8296417Sdim/// 9296417Sdim/// \file 10341825Sdim/// This is a target description file for the WebAssembly architecture, 11296417Sdim/// which is also known as "wasm". 12296417Sdim/// 13285163Sdim//===----------------------------------------------------------------------===// 14285163Sdim 15285163Sdim//===----------------------------------------------------------------------===// 16285163Sdim// Target-independent interfaces which we are implementing 17285163Sdim//===----------------------------------------------------------------------===// 18285163Sdim 19285163Sdiminclude "llvm/Target/Target.td" 20285163Sdim 21285163Sdim//===----------------------------------------------------------------------===// 22285163Sdim// WebAssembly Subtarget features. 23285163Sdim//===----------------------------------------------------------------------===// 24285163Sdim 25344779Sdimdef FeatureSIMD128 : SubtargetFeature<"simd128", "SIMDLevel", "SIMD128", 26285163Sdim "Enable 128-bit SIMD">; 27344779Sdim 28344779Sdimdef FeatureUnimplementedSIMD128 : 29344779Sdim SubtargetFeature<"unimplemented-simd128", 30344779Sdim "SIMDLevel", "UnimplementedSIMD128", 31344779Sdim "Enable 128-bit SIMD not yet implemented in engines", 32344779Sdim [FeatureSIMD128]>; 33344779Sdim 34327952Sdimdef FeatureAtomics : SubtargetFeature<"atomics", "HasAtomics", "true", 35327952Sdim "Enable Atomics">; 36353358Sdim 37327952Sdimdef FeatureNontrappingFPToInt : 38327952Sdim SubtargetFeature<"nontrapping-fptoint", 39327952Sdim "HasNontrappingFPToInt", "true", 40327952Sdim "Enable non-trapping float-to-int conversion operators">; 41285163Sdim 42341825Sdimdef FeatureSignExt : 43341825Sdim SubtargetFeature<"sign-ext", 44341825Sdim "HasSignExt", "true", 45341825Sdim "Enable sign extension operators">; 46341825Sdim 47353358Sdimdef FeatureTailCall : 48353358Sdim SubtargetFeature<"tail-call", 49353358Sdim "HasTailCall", "true", 50353358Sdim "Enable tail call instructions">; 51353358Sdim 52341825Sdimdef FeatureExceptionHandling : 53341825Sdim SubtargetFeature<"exception-handling", "HasExceptionHandling", "true", 54341825Sdim "Enable Wasm exception handling">; 55341825Sdim 56353358Sdimdef FeatureBulkMemory : 57353358Sdim SubtargetFeature<"bulk-memory", "HasBulkMemory", "true", 58353358Sdim "Enable bulk memory operations">; 59353358Sdim 60353358Sdimdef FeatureMultivalue : 61353358Sdim SubtargetFeature<"multivalue", 62353358Sdim "HasMultivalue", "true", 63353358Sdim "Enable multivalue blocks, instructions, and functions">; 64353358Sdim 65353358Sdimdef FeatureMutableGlobals : 66353358Sdim SubtargetFeature<"mutable-globals", "HasMutableGlobals", "true", 67353358Sdim "Enable mutable globals">; 68353358Sdim 69285163Sdim//===----------------------------------------------------------------------===// 70285163Sdim// Architectures. 71285163Sdim//===----------------------------------------------------------------------===// 72285163Sdim 73285163Sdim//===----------------------------------------------------------------------===// 74285163Sdim// Register File Description 75285163Sdim//===----------------------------------------------------------------------===// 76285163Sdim 77285163Sdiminclude "WebAssemblyRegisterInfo.td" 78285163Sdim 79285163Sdim//===----------------------------------------------------------------------===// 80285163Sdim// Instruction Descriptions 81285163Sdim//===----------------------------------------------------------------------===// 82285163Sdim 83285163Sdiminclude "WebAssemblyInstrInfo.td" 84285163Sdim 85285163Sdimdef WebAssemblyInstrInfo : InstrInfo; 86285163Sdim 87285163Sdim//===----------------------------------------------------------------------===// 88285163Sdim// WebAssembly Processors supported. 89285163Sdim//===----------------------------------------------------------------------===// 90285163Sdim 91285163Sdim// Minimal Viable Product. 92285163Sdimdef : ProcessorModel<"mvp", NoSchedModel, []>; 93285163Sdim 94296417Sdim// Generic processor: latest stable version. 95296417Sdimdef : ProcessorModel<"generic", NoSchedModel, []>; 96296417Sdim 97285163Sdim// Latest and greatest experimental version of WebAssembly. Bugs included! 98327952Sdimdef : ProcessorModel<"bleeding-edge", NoSchedModel, 99344779Sdim [FeatureSIMD128, FeatureAtomics, 100353358Sdim FeatureNontrappingFPToInt, FeatureSignExt, 101353358Sdim FeatureMutableGlobals]>; 102285163Sdim 103285163Sdim//===----------------------------------------------------------------------===// 104285163Sdim// Target Declaration 105285163Sdim//===----------------------------------------------------------------------===// 106285163Sdim 107341825Sdimdef WebAssemblyAsmParser : AsmParser { 108341825Sdim // The physical register names are not in the binary format or asm text 109341825Sdim let ShouldEmitMatchRegisterName = 0; 110341825Sdim} 111341825Sdim 112341825Sdimdef WebAssemblyAsmWriter : AsmWriter { 113341825Sdim string AsmWriterClassName = "InstPrinter"; 114341825Sdim int PassSubtarget = 0; 115341825Sdim int Variant = 0; 116341825Sdim bit isMCAsmWriter = 1; 117341825Sdim} 118341825Sdim 119285163Sdimdef WebAssembly : Target { 120285163Sdim let InstructionSet = WebAssemblyInstrInfo; 121341825Sdim let AssemblyParsers = [WebAssemblyAsmParser]; 122341825Sdim let AssemblyWriters = [WebAssemblyAsmWriter]; 123285163Sdim} 124