[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / llvm / lib / ObjCopy / wasm / WasmObject.h
blobf860ec697e5684df87b1b3c3f502d47c0dc0b502
1 //===- WasmObject.h ---------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_OBJCOPY_WASM_WASMOBJECT_H
10 #define LLVM_LIB_OBJCOPY_WASM_WASMOBJECT_H
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/Object/Wasm.h"
15 #include "llvm/Support/MemoryBuffer.h"
16 #include <vector>
18 namespace llvm {
19 namespace objcopy {
20 namespace wasm {
22 struct Section {
23 // For now, each section is only an opaque binary blob with no distinction
24 // between custom and known sections.
25 uint8_t SectionType;
26 std::optional<uint8_t> HeaderSecSizeEncodingLen;
27 StringRef Name;
28 ArrayRef<uint8_t> Contents;
31 struct Object {
32 llvm::wasm::WasmObjectHeader Header;
33 // For now don't discriminate between kinds of sections.
34 std::vector<Section> Sections;
36 void addSectionWithOwnedContents(Section NewSection,
37 std::unique_ptr<MemoryBuffer> &&Content);
38 void removeSections(function_ref<bool(const Section &)> ToRemove);
40 private:
41 std::vector<std::unique_ptr<MemoryBuffer>> OwnedContents;
44 } // end namespace wasm
45 } // end namespace objcopy
46 } // end namespace llvm
48 #endif // LLVM_LIB_OBJCOPY_WASM_WASMOBJECT_H