LLVM
17.0.0git
lib
ObjCopy
wasm
WasmObject.h
Go to the documentation of this file.
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
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_LIB_OBJCOPY_WASM_WASMOBJECT_H
10
#define LLVM_LIB_OBJCOPY_WASM_WASMOBJECT_H
11
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>
17
18
namespace
llvm
{
19
namespace
objcopy {
20
namespace
wasm {
21
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
StringRef
Name
;
27
ArrayRef<uint8_t>
Contents
;
28
};
29
30
struct
Object
{
31
llvm::wasm::WasmObjectHeader
Header
;
32
// For now don't discriminate between kinds of sections.
33
std::vector<Section>
Sections
;
34
35
void
addSectionWithOwnedContents
(
Section
NewSection,
36
std::unique_ptr<MemoryBuffer> &&
Content
);
37
void
removeSections
(
function_ref
<
bool
(
const
Section
&)>
ToRemove
);
38
39
private
:
40
std::vector<std::unique_ptr<MemoryBuffer>> OwnedContents;
41
};
42
43
}
// end namespace wasm
44
}
// end namespace objcopy
45
}
// end namespace llvm
46
47
#endif // LLVM_LIB_OBJCOPY_WASM_WASMOBJECT_H
llvm::objcopy::wasm::Object::removeSections
void removeSections(function_ref< bool(const Section &)> ToRemove)
Definition:
WasmObject.cpp:27
MemoryBuffer.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::objcopy::wasm::Section::Contents
ArrayRef< uint8_t > Contents
Definition:
WasmObject.h:27
StringRef.h
llvm::objcopy::wasm::Object::addSectionWithOwnedContents
void addSectionWithOwnedContents(Section NewSection, std::unique_ptr< MemoryBuffer > &&Content)
Definition:
WasmObject.cpp:21
ToRemove
ReachingDefAnalysis InstSet & ToRemove
Definition:
ARMLowOverheadLoops.cpp:547
Content
T Content
Definition:
ELFObjHandler.cpp:89
llvm::objcopy::wasm::Object::Sections
std::vector< Section > Sections
Definition:
WasmObject.h:33
Wasm.h
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition:
STLFunctionalExtras.h:36
llvm::objcopy::wasm::Section
Definition:
WasmObject.h:22
ArrayRef.h
llvm::objcopy::wasm::Object
Definition:
WasmObject.h:30
llvm::ArrayRef< uint8_t >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:50
llvm::wasm::WasmObjectHeader
Definition:
Wasm.h:34
llvm::objcopy::wasm::Section::SectionType
uint8_t SectionType
Definition:
WasmObject.h:25
llvm::objcopy::wasm::Object::Header
llvm::wasm::WasmObjectHeader Header
Definition:
WasmObject.h:31
llvm::objcopy::wasm::Section::Name
StringRef Name
Definition:
WasmObject.h:26
Generated on Fri Jan 27 2023 12:41:04 for LLVM by
1.8.17