LLVM  15.0.0git
WasmObject.cpp
Go to the documentation of this file.
1 //===- WasmObject.cpp -----------------------------------------------------===//
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 #include "WasmObject.h"
10 
11 #include "llvm/Support/LEB128.h"
13 
14 namespace llvm {
15 namespace objcopy {
16 namespace wasm {
17 
18 using namespace object;
19 using namespace llvm::wasm;
20 
22  Section NewSection, std::unique_ptr<MemoryBuffer> &&Content) {
23  Sections.push_back(NewSection);
24  OwnedContents.emplace_back(std::move(Content));
25 }
26 
28  // TODO: remove reloc sections for the removed section, handle symbols, etc.
29  llvm::erase_if(Sections, ToRemove);
30 }
31 
32 } // end namespace wasm
33 } // end namespace objcopy
34 } // end namespace llvm
llvm::objcopy::wasm::Object::removeSections
void removeSections(function_ref< bool(const Section &)> ToRemove)
Definition: WasmObject.cpp:27
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
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:542
llvm::erase_if
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
Definition: STLExtras.h:1807
Content
T Content
Definition: ELFObjHandler.cpp:88
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
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
LEB128.h
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::wasm
Definition: Wasm.h:23
raw_ostream.h
WasmObject.h