From 0eb20fbda7a3b7e431f5592716af9bdcbe39bf0a Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 28 Jul 2024 01:34:35 +0200 Subject: Merge llvm-project main llvmorg-19-init-18630-gf2ccf80136a0 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-19-init-18630-gf2ccf80136a0, the last commit before the upstream release/19.x branch was created. PR: 280562 MFC after: 1 month (cherry picked from commit 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583) --- .../Disassembler/WebAssemblyDisassembler.cpp | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp') diff --git a/contrib/llvm-project/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/contrib/llvm-project/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp index ed7757be6615..3585b5f4a5c9 100644 --- a/contrib/llvm-project/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp +++ b/contrib/llvm-project/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp @@ -16,6 +16,7 @@ #include "MCTargetDesc/WebAssemblyMCTypeUtilities.h" #include "TargetInfo/WebAssemblyTargetInfo.h" +#include "llvm/BinaryFormat/Wasm.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDecoderOps.h" #include "llvm/MC/MCDisassembler/MCDisassembler.h" @@ -46,9 +47,10 @@ class WebAssemblyDisassembler final : public MCDisassembler { DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, ArrayRef Bytes, uint64_t Address, raw_ostream &CStream) const override; - std::optional - onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, ArrayRef Bytes, - uint64_t Address, raw_ostream &CStream) const override; + + Expected onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, + ArrayRef Bytes, + uint64_t Address) const override; public: WebAssemblyDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx, @@ -121,31 +123,30 @@ bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef Bytes) { return true; } -std::optional -WebAssemblyDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, - ArrayRef Bytes, - uint64_t Address, - raw_ostream &CStream) const { +Expected WebAssemblyDisassembler::onSymbolStart(SymbolInfoTy &Symbol, + uint64_t &Size, + ArrayRef Bytes, + uint64_t Address) const { Size = 0; - if (Address == 0) { + if (Symbol.Type == wasm::WASM_SYMBOL_TYPE_SECTION) { // Start of a code section: we're parsing only the function count. int64_t FunctionCount; if (!nextLEB(FunctionCount, Bytes, Size, false)) - return std::nullopt; + return false; outs() << " # " << FunctionCount << " functions in section."; } else { // Parse the start of a single function. int64_t BodySize, LocalEntryCount; if (!nextLEB(BodySize, Bytes, Size, false) || !nextLEB(LocalEntryCount, Bytes, Size, false)) - return std::nullopt; + return false; if (LocalEntryCount) { outs() << " .local "; for (int64_t I = 0; I < LocalEntryCount; I++) { int64_t Count, Type; if (!nextLEB(Count, Bytes, Size, false) || !nextLEB(Type, Bytes, Size, false)) - return std::nullopt; + return false; for (int64_t J = 0; J < Count; J++) { if (I || J) outs() << ", "; @@ -155,7 +156,7 @@ WebAssemblyDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, } } outs() << "\n"; - return MCDisassembler::Success; + return true; } MCDisassembler::DecodeStatus WebAssemblyDisassembler::getInstruction( -- cgit v1.2.3