Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebAssembly] Output functions individually
The code section is now written out one function at a time rather than all the functions in a given objects being serialized at once. This change lays the groundwork for supporting --gc-sections. Differential Revision: https://reviews.llvm.org/D41315 llvm-svn: 322138
- Loading branch information
Showing
11 changed files
with
266 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//===- InpuFunction.h -------------------------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Linker | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Represents a WebAssembly function in an input file which could also be | ||
// assigned a function index in the output. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLD_WASM_INPUT_FUNCTION_H | ||
#define LLD_WASM_INPUT_FUNCTION_H | ||
|
||
#include "WriterUtils.h" | ||
#include "llvm/Object/Wasm.h" | ||
|
||
using llvm::wasm::WasmRelocation; | ||
using llvm::wasm::WasmFunction; | ||
|
||
namespace lld { | ||
namespace wasm { | ||
|
||
class ObjFile; | ||
|
||
class InputFunction { | ||
public: | ||
InputFunction(const WasmSignature &S, const WasmFunction &Func, | ||
const ObjFile &F) | ||
: Signature(S), Function(Func), File(F) {} | ||
|
||
uint32_t getOutputIndex() const { return OutputIndex.getValue(); }; | ||
bool hasOutputIndex() const { return OutputIndex.hasValue(); }; | ||
|
||
void setOutputIndex(uint32_t Index) { | ||
assert(!hasOutputIndex()); | ||
OutputIndex = Index; | ||
}; | ||
|
||
const WasmSignature &Signature; | ||
const WasmFunction &Function; | ||
int32_t OutputOffset = 0; | ||
std::vector<WasmRelocation> Relocations; | ||
std::vector<OutputRelocation> OutRelocations; | ||
const ObjFile &File; | ||
|
||
protected: | ||
llvm::Optional<uint32_t> OutputIndex; | ||
}; | ||
|
||
} // namespace wasm | ||
} // namespace lld | ||
|
||
#endif // LLD_WASM_INPUT_FUNCTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.