/llvm-project/llvm/include/llvm/BinaryFormat/ |
H A D | WasmTraits.h | 1 //===- WasmTraits.h - DenseMap traits for the Wasm structures ---*- C++ -*-===// 9 // This file provides llvm::DenseMapInfo traits for the Wasm structures. 17 #include "llvm/BinaryFormat/Wasm.h" 22 template <> struct DenseMapInfo<wasm::WasmSignature, void> { 23 static wasm::WasmSignature getEmptyKey() { 24 wasm::WasmSignature Sig; 25 Sig.State = wasm::WasmSignature::Empty; 28 static wasm::WasmSignature getTombstoneKey() { 29 wasm::WasmSignature Sig; 30 Sig.State = wasm::WasmSignature::Tombstone; [all …]
|
/llvm-project/llvm/lib/Target/WebAssembly/ |
H A D | WebAssemblyRuntimeLibcallSignatures.cpp | 553 SmallVectorImpl<wasm::ValType> &Rets, in getLibcallSignature() 554 SmallVectorImpl<wasm::ValType> &Params) { in getLibcallSignature() 558 wasm::ValType PtrTy = in getLibcallSignature() 559 Subtarget.hasAddr64() ? wasm::ValType::I64 : wasm::ValType::I32; in getLibcallSignature() 566 Rets.push_back(wasm::ValType::F32); in getLibcallSignature() 567 Params.push_back(wasm::ValType::F32); in getLibcallSignature() 570 Rets.push_back(wasm::ValType::F32); in getLibcallSignature() 571 Params.push_back(wasm::ValType::F64); in getLibcallSignature() 574 Rets.push_back(wasm in getLibcallSignature() [all...] |
/llvm-project/llvm/test/tools/llvm-readobj/wasm/ |
H A D | relocations.test | 3 # RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.wasm \ 4 # RUN: | FileCheck %s --check-prefix WASM 6 # WASM: Relocations [ 7 # WASM-NEXT: Section (4) CODE { 8 # WASM-NEXT: Relocation { 9 # WASM-NEXT: Type: R_WASM_MEMORY_ADDR_SLEB (4) 10 # WASM-NEXT: Offset: 0x4 11 # WASM-NEXT: Symbol: .L.str 12 # WASM-NEXT: Addend: 0 13 # WASM-NEXT: } [all …]
|
/llvm-project/llvm/lib/Object/ |
H A D | WasmObjectFile.cpp | 1 //===- WasmObjectFile.cpp - Wasm object file implementation ---------------===// 15 #include "llvm/BinaryFormat/Wasm.h" 20 #include "llvm/Object/Wasm.h" 32 #define DEBUG_TYPE "wasm-object" 39 << ", Kind=" << toString(wasm::WasmSymbolType(Info.Kind)) << ", Flags=0x" 42 case wasm::WASM_SYMBOL_BINDING_GLOBAL: Out << "global"; break; in print() 43 case wasm::WASM_SYMBOL_BINDING_LOCAL: Out << "local"; break; in print() 44 case wasm::WASM_SYMBOL_BINDING_WEAK: Out << "weak"; break; in print() 175 static wasm::ValType parseValType(WasmObjectFile::ReadContext &Ctx, in readOpcode() 180 case wasm in parseValType() [all...] |
/llvm-project/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/ |
H A D | trunc.ll | 7 declare i32 @llvm.wasm.trunc.signed.i32.f32(float) 8 declare i32 @llvm.wasm.trunc.unsigned.i32.f32(float) 9 declare i32 @llvm.wasm.trunc.signed.i32.f64(double) 10 declare i32 @llvm.wasm.trunc.unsigned.i32.f64(double) 11 declare i64 @llvm.wasm.trunc.signed.i64.f32(float) 12 declare i64 @llvm.wasm.trunc.unsigned.i64.f32(float) 13 declare i64 @llvm.wasm.trunc.signed.i64.f64(double) 14 declare i64 @llvm.wasm.trunc.unsigned.i64.f64(double) 32 ; CHECK-NEXT: [[T14:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0x41E0000000000000) 34 ; CHECK-NEXT: [[T15:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0xC1E0000020000000) [all …]
|
/llvm-project/llvm/include/llvm/Object/ |
H A D | Wasm.h | 1 //===- Wasm.h - Wasm object file implementation -----------------*- C++ -*-===// 10 // interface for Wasm files. 21 #include "llvm/BinaryFormat/Wasm.h" 37 WasmSymbol(const wasm::WasmSymbolInfo &Info, in WasmSymbol() 38 const wasm::WasmGlobalType *GlobalType, in WasmSymbol() 39 const wasm::WasmTableType *TableType, in WasmSymbol() 40 const wasm::WasmSignature *Signature) in WasmSymbol() 43 assert(!Signature || Signature->Kind != wasm::WasmSignature::Placeholder); in WasmSymbol() 48 wasm::WasmSymbolInfo Info; 49 const wasm::WasmGlobalType *GlobalType; [all …]
|
/llvm-project/llvm/lib/MC/ |
H A D | WasmObjectWriter.cpp | 1 //===- lib/MC/WasmObjectWriter.cpp - Wasm File Writer ---------------------===// 9 // This file implements Wasm object file writer information. 14 #include "llvm/BinaryFormat/Wasm.h" 57 // A wasm data segment. A wasm binary contains only a single data section 60 // wasm data segment. 71 // A wasm function to be written into the function section. 77 // A wasm global to be written into the global section. 79 wasm::WasmGlobalType Type; 105 bool hasAddend() const { return wasm [all...] |
/llvm-project/llvm/include/llvm/MC/ |
H A D | MCSymbolWasm.h | 11 #include "llvm/BinaryFormat/Wasm.h" 18 std::optional<wasm::WasmSymbolType> Type; 28 wasm::WasmSignature *Signature = nullptr; 29 std::optional<wasm::WasmGlobalType> GlobalType; 30 std::optional<wasm::WasmTableType> TableType; 44 bool isFunction() const { return Type == wasm::WASM_SYMBOL_TYPE_FUNCTION; } in isFunction() 46 bool isData() const { return !Type || Type == wasm::WASM_SYMBOL_TYPE_DATA; } in isData() 47 bool isGlobal() const { return Type == wasm::WASM_SYMBOL_TYPE_GLOBAL; } in isGlobal() 48 bool isTable() const { return Type == wasm::WASM_SYMBOL_TYPE_TABLE; } in isTable() 49 bool isSection() const { return Type == wasm::WASM_SYMBOL_TYPE_SECTION; } in isSection() [all …]
|
/llvm-project/llvm/lib/Target/WebAssembly/MCTargetDesc/ |
H A D | WebAssemblyMCTypeUtilities.cpp | 20 std::optional<wasm::ValType> WebAssembly::parseType(StringRef Type) { in parseType() 21 return llvm::StringSwitch<std::optional<wasm::ValType>>{Type} in parseType() 22 .Case("i32", wasm::ValType::I32) in parseType() 23 .Case("i64", wasm::ValType::I64) in parseType() 24 .Case("f32", wasm::ValType::F32) in parseType() 25 .Case("f64", wasm::ValType::F64) in parseType() 27 wasm::ValType::V128) in parseType() 28 .Case("funcref", wasm::ValType::FUNCREF) in parseType() 29 .Case("externref", wasm::ValType::EXTERNREF) in parseType() 30 .Case("exnref", wasm::ValType::EXNREF) in parseType() [all …]
|
H A D | WebAssemblyWasmObjectWriter.cpp | 1 //===-- WebAssemblyWasmObjectWriter.cpp - WebAssembly Wasm Writer ---------===// 10 /// This file handles Wasm-specific object emission, converting LLVM's 17 #include "llvm/BinaryFormat/Wasm.h" 77 return wasm::R_WASM_GLOBAL_INDEX_LEB; in getRelocType() 80 return is64Bit() ? wasm::R_WASM_TABLE_INDEX_REL_SLEB64 in getRelocType() 81 : wasm::R_WASM_TABLE_INDEX_REL_SLEB; in getRelocType() 83 return is64Bit() ? wasm::R_WASM_MEMORY_ADDR_TLS_SLEB64 in getRelocType() 84 : wasm::R_WASM_MEMORY_ADDR_TLS_SLEB; in getRelocType() 87 return is64Bit() ? wasm::R_WASM_MEMORY_ADDR_REL_SLEB64 in getRelocType() 88 : wasm in getRelocType() [all...] |
H A D | WebAssemblyMCTypeUtilities.h | 18 #include "llvm/BinaryFormat/Wasm.h" 28 I32 = unsigned(wasm::ValType::I32), 29 I64 = unsigned(wasm::ValType::I64), 30 F32 = unsigned(wasm::ValType::F32), 31 F64 = unsigned(wasm::ValType::F64), 32 V128 = unsigned(wasm::ValType::V128), 33 Externref = unsigned(wasm::ValType::EXTERNREF), 34 Funcref = unsigned(wasm::ValType::FUNCREF), 35 Exnref = unsigned(wasm::ValType::EXNREF), 48 inline bool isRefType(wasm in isRefType() [all...] |
/llvm-project/llvm/test/CodeGen/WebAssembly/ |
H A D | eh-option-errors.ll | 3 ; RUN: not --crash llc < %s -enable-emscripten-cxx-exceptions -wasm-enable-eh 2>&1 | FileCheck %s --check-prefix=EM_EH_W_WASM_EH 4 ; EM_EH_W_WASM_EH: LLVM ERROR: -enable-emscripten-cxx-exceptions not allowed with -wasm-enable-eh 6 ; RUN: not --crash llc < %s -enable-emscripten-sjlj -wasm-enable-sjlj 2>&1 | FileCheck %s --check-prefix=EM_SJLJ_W_WASM_SJLJ 7 ; EM_SJLJ_W_WASM_SJLJ: LLVM ERROR: -enable-emscripten-sjlj not allowed with -wasm-enable-sjlj 9 ; RUN: not --crash llc < %s -enable-emscripten-cxx-exceptions -wasm-enable-sjlj 2>&1 | FileCheck %s --check-prefix=EM_EH_W_WASM_SJLJ 10 ; EM_EH_W_WASM_SJLJ: LLVM ERROR: -enable-emscripten-cxx-exceptions not allowed with -wasm-enable-sjlj 12 ; RUN: not --crash llc < %s -wasm-enable-eh -exception-model=dwarf 2>&1 | FileCheck %s --check-prefix=EH_MODEL_DWARF 13 ; EH_MODEL_DWARF: LLVM ERROR: -exception-model should be either 'none' or 'wasm' 15 ; RUN: not --crash llc < %s -enable-emscripten-cxx-exceptions -exception-model=wasm 2>&1 | FileCheck %s --check-prefix=EM_EH_W_MODEL_WASM 16 ; EM_EH_W_MODEL_WASM: LLVM ERROR: -exception-model=wasm no [all...] |
H A D | wasm-eh-prepare.ll | 1 ; RUN: opt < %s -win-eh-prepare -demote-catchswitch-only -wasm-eh-prepare -S | FileCheck %s 2 ; RUN: opt < %s -win-eh-prepare -demote-catchswitch-only -wasm-eh-prepare -S --mattr=+atomics,+bulk… 3 ; RUN: opt < %s -passes='win-eh-prepare<demote-catchswitch-only>,wasm-eh-prepare' -S | FileCheck %s 4 ; RUN: opt < %s -passes='win-eh-prepare<demote-catchswitch-only>,wasm-eh-prepare' -S --mattr=+atomi… 5 ; RUN: llc < %s -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling -stop-after=wasm-e… 16 ; A wasm.catch() call, wasm.lsda() call, and personality call to generate a 37 %2 = call ptr @llvm.wasm.get.exception(token %1) 38 %3 = call i32 @llvm.wasm.get.ehselector(token %1) 44 ; CHECK-NEXT: %[[EXN:.*]] = call ptr @llvm.wasm.catch(i32 0) 45 ; CHECK-NEXT: call void @llvm.wasm.landingpad.index(token %[[CATCHPAD]], i32 0) [all …]
|
H A D | exception-legacy.ll | 1 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh -wasm-use-legacy-eh -exception-model=wasm -mattr=+exception-handling -verify-machineinstrs | FileCheck --implicit-check-not=ehgcr -allow-deprecated-dag-overlap %s 2 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm [all...] |
H A D | eh-lsda.ll | 1 …-mtriple=wasm32-unknown-unknown -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh… 2 …-mtriple=wasm64-unknown-unknown -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh… 3 …riple=wasm32-unknown-emscripten -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh… 4 …riple=wasm64-unknown-emscripten -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh… 5 …riple=wasm32-unknown-emscripten -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh… 6 …riple=wasm64-unknown-emscripten -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-eh… 30 %2 = call ptr @llvm.wasm.get.exception(token %1) 31 %3 = call i32 @llvm.wasm.get.ehselector(token %1) 141 %2 = call ptr @llvm.wasm.get.exception(token %1) 142 %3 = call i32 @llvm.wasm.get.ehselector(token %1) [all …]
|
/llvm-project/lld/test/wasm/ |
H A D | whole-archive.test | 7 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o %t.a 8 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=NOTADDED %s 14 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive %t.a 15 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=ADDED %s 21 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive --no-whole-archive %t.a 22 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=NOTADDED %s 25 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o %t.a --whole-archive --no-whole-archive 26 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=NOTADDED %s 27 RUN: wasm-ld --no-gc-sections -o %t.wasm %t.o --whole-archive %t.a --no-whole-archive 28 RUN: obj2yaml %t.wasm | FileCheck --check-prefix=ADDED %s [all …]
|
H A D | tag-section.ll | 2 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section1.ll -o %t1.o 3 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section2.ll -o %t2.o 4 ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %s -o %t.o 5 ; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o 6 ; RUN: wasm-ld --export-all -o %t-export-all.wasm [all...] |
H A D | initial-heap.test | 4 RUN: wasm-ld %t.o -o %t1.wasm --stack-first -z stack-size=65536 --initial-heap=131072 5 RUN: obj2yaml %t1.wasm | FileCheck %s --check-prefixes=CHECK,CHECK-2P 8 RUN: wasm-ld %t.o -o %t2.wasm --stack-first -z stack-size=65536 --initial-heap=4294901760 9 RUN: obj2yaml %t2.wasm | FileCheck %s --check-prefixes=CHECK,CHECK-4G 17 RUN: not wasm-ld %t.o -o %t3.wasm --initial-heap=131073 2>&1 | FileCheck %s --check-prefix NOT-PAGE… 18 RUN: not wasm-ld %t.o -o %t4.wasm --stack-first -z stack-size=65536 --initial-heap=4295032832 2>&1 … 19 RUN: not wasm-ld %t.o -o %t5.wasm --stack-first -z stack-size=131072 --initial-heap=4294901760 2>&1… 20 RUN: not wasm-ld %t.o -o %t6.wasm --stack-first -z stack-size=65536 --initial-heap=131072 --initial… 21 RUN: not wasm-ld %t.o -o %t7.wasm --stack-first -z stack-size=65536 --initial-heap=131072 --max-mem…
|
H A D | compress-relocs.ll | 3 ; RUN: wasm-ld --export-dynamic -o %t.wasm %t2.o %t.o 4 ; RUN: obj2yaml %t.wasm | FileCheck %s 5 ; RUN: wasm-ld --export-dynamic -O2 -o %t-opt.wasm %t2.o %t.o 6 ; RUN: obj2yaml %t-opt.wasm | FileCheck %s 7 ; RUN: not wasm-ld --compress-relocations -o %t-compressed.wasm %t2.o %t.o 2>&1 | FileCheck %s -check-prefix=ERROR 8 ; RUN: wasm-ld --export-dynamic --strip-debug --compress-relocations -o %t-compressed.wasm [all...] |
H A D | unresolved-symbols.s | 7 # RUN: not wasm-ld --no-gc-sections %t/main.o %t/secondary.o -o /dev/null 2>&1 | \ 13 # RUN: not wasm-ld --no-gc-sections %t/main.o %t/secondary.o -o /dev/null --unresolved-symbols=report-all 2>&1 | \ 17 # RUN: not wasm-ld %t/main.o -o /dev/null --unresolved-symbols=xxx 2>&1 | \ 21 # RUN: not wasm-ld %t/main.o -o /dev/null --unresolved-symbols xxx 2>&1 | \ 27 # RUN: wasm-ld %t/main.o -o %t2.wasm --unresolved-symbols=ignore-all 28 # RUN: obj2yaml %t2.wasm | FileCheck -check-prefix=IGNORE %s 31 # RUN: wasm-ld %t/main.o -o %t2.wasm --warn-unresolved-symbols 32 # RUN: obj2yaml %t2.wasm | FileChec [all...] |
/llvm-project/llvm/lib/ObjectYAML/ |
H A D | WasmYAML.cpp | 1 //===- WasmYAML.cpp - Wasm YAMLIO implementation --------------------------===// 9 // This file defines classes for handling the YAML representation of wasm. 15 #include "llvm/BinaryFormat/Wasm.h" 40 IO.mapTag("!WASM", true); in mapping() 176 case wasm::WASM_SEC_CUSTOM: { in mapping() 211 case wasm::WASM_SEC_TYPE: in mapping() 216 case wasm::WASM_SEC_IMPORT: in mapping() 221 case wasm::WASM_SEC_FUNCTION: in mapping() 226 case wasm::WASM_SEC_TABLE: in mapping() 231 case wasm in mapping() [all...] |
/llvm-project/llvm/tools/obj2yaml/ |
H A D | wasm2yaml.cpp | 35 static WasmYAML::Limits makeLimits(const wasm::WasmLimits &Limits) { in makeLimits() 44 const wasm::WasmTableType &Type) { in makeTable() 58 const wasm::WasmDylinkInfo& Info = Obj.dylinkInfo(); in dumpCustomSection() 72 for (const llvm::wasm::WasmDebugName &Name : Obj.debugNames()) { in dumpCustomSection() 76 if (Name.Type == llvm::wasm::NameType::FUNCTION) { in dumpCustomSection() 78 } else if (Name.Type == llvm::wasm::NameType::GLOBAL) { in dumpCustomSection() 81 assert(Name.Type == llvm::wasm::NameType::DATA_SEGMENT); in dumpCustomSection() 97 WasmYAML::ComdatEntry{wasm::WASM_COMDAT_FUNCTION, Func.Index}); in dumpCustomSection() 113 WasmYAML::ComdatEntry{wasm::WASM_COMDAT_DATA, SegmentIndex}); in dumpCustomSection() 122 WasmYAML::ComdatEntry{wasm::WASM_COMDAT_SECTION, SectionIndex}); in dumpCustomSection() [all …]
|
/llvm-project/llvm/lib/Target/WebAssembly/AsmParser/ |
H A D | WebAssemblyAsmTypeCheck.cpp | 39 #define DEBUG_TYPE "wasm-asm-parser" 50 void WebAssemblyAsmTypeCheck::funcDecl(const wasm::WasmSignature &Sig) { in funcDecl() 56 const SmallVectorImpl<wasm::ValType> &Locals) { in localDecl() 81 assert(std::get_if<wasm::ValType>(&TypeB)); in typeError() 83 WebAssembly::isRefType(std::get<wasm::ValType>(TypeB))) in typeError() 102 WebAssembly::typeToString(std::get<wasm::ValType>(Types[I - 1]))); in popRefType() 119 WebAssemblyAsmTypeCheck::getTypesString(ArrayRef<wasm::ValType> Types, in getLocal() 126 ArrayRef<wasm::ValType> ValTypes) { in checkStackTop() 129 [](wasm::ValType Val) -> StackType { return Val; }); in checkStackTop() 134 ArrayRef<wasm in checkStackTop() [all...] |
/llvm-project/clang/test/CodeGen/ |
H A D | builtins-wasm.c | 20 // WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32(i32 0) in memory_size() 21 // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.memory.size.i64(i32 0) in memory_size() 26 // WEBASSEMBLY32: call i32 @llvm.wasm.memory.grow.i32(i32 0, i32 %{{.*}}) in memory_grow() 27 // WEBASSEMBLY64: call i64 @llvm.wasm.memory.grow.i64(i32 0, i64 %{{.*}}) in memory_grow() 32 // WEBASSEMBLY32: call i32 @llvm.wasm.tls.size.i32() in tls_size() 33 // WEBASSEMBLY64: call i64 @llvm.wasm.tls.size.i64() in tls_size() 38 // WEBASSEMBLY32: call i32 @llvm.wasm.tls.align.i32() in tls_align() 39 // WEBASSEMBLY64: call i64 @llvm.wasm.tls.align.i64() in tls_align() 44 // WEBASSEMBLY: call ptr @llvm.wasm.tls.base() in tls_base() 49 // WEBASSEMBLY: call void @llvm.wasm in throw() [all...] |
/llvm-project/lld/wasm/ |
H A D | WriterUtils.h | 14 #include "llvm/Object/Wasm.h" 17 namespace wasm { 38 void writeValueType(raw_ostream &os, llvm::wasm::ValType type, 41 void writeSig(raw_ostream &os, const llvm::wasm::WasmSignature &sig); 52 void writeInitExpr(raw_ostream &os, const llvm::wasm::WasmInitExpr &initExpr); 55 const llvm::wasm::WasmInitExprMVP &initExpr); 57 void writeLimits(raw_ostream &os, const llvm::wasm::WasmLimits &limits); 59 void writeGlobalType(raw_ostream &os, const llvm::wasm::WasmGlobalType &type); 61 void writeTableType(raw_ostream &os, const llvm::wasm::WasmTableType &type); 63 void writeImport(raw_ostream &os, const llvm::wasm::WasmImport &import); [all …]
|