[PATCH] D43524: Simplify.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 20 13:20:59 PST 2018
ruiu created this revision.
ruiu added a reviewer: sbc100.
Herald added a subscriber: aheejin.
Simplify.
https://reviews.llvm.org/D43524
Files:
lld/wasm/InputFiles.cpp
Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -202,45 +202,36 @@
}
void ObjFile::initializeSymbols() {
- Symbols.reserve(WasmObj->getNumberOfSymbols());
-
for (const WasmImport &Import : WasmObj->imports()) {
- switch (Import.Kind) {
- case WASM_EXTERNAL_FUNCTION:
+ if (Import.Kind == WASM_EXTERNAL_FUNCTION)
++NumFunctionImports;
- break;
- case WASM_EXTERNAL_GLOBAL:
+ else if (Import.Kind == WASM_EXTERNAL_GLOBAL)
++NumGlobalImports;
- break;
- }
}
- FunctionSymbols.resize(NumFunctionImports + WasmObj->functions().size());
- GlobalSymbols.resize(NumGlobalImports + WasmObj->globals().size());
-
ArrayRef<WasmFunction> Funcs = WasmObj->functions();
ArrayRef<uint32_t> FuncTypes = WasmObj->functionTypes();
ArrayRef<WasmSignature> Types = WasmObj->types();
ArrayRef<WasmGlobal> Globals = WasmObj->globals();
- for (const auto &C : WasmObj->comdats())
- Symtab->addComdat(C, this);
-
+ Symbols.reserve(WasmObj->getNumberOfSymbols());
FunctionSymbols.resize(NumFunctionImports + Funcs.size());
GlobalSymbols.resize(NumGlobalImports + Globals.size());
+ for (StringRef S : WasmObj->comdats())
+ Symtab->addComdat(S, this);
+
for (const WasmSegment &S : WasmObj->dataSegments()) {
InputSegment *Seg = make<InputSegment>(S, this);
Seg->copyRelocations(*DataSection);
Segments.emplace_back(Seg);
}
for (size_t I = 0; I < Funcs.size(); ++I) {
- const WasmFunction &Func = Funcs[I];
- const WasmSignature &Sig = Types[FuncTypes[I]];
- InputFunction *F = make<InputFunction>(Sig, &Func, this);
+ InputFunction *F =
+ make<InputFunction>(Types[FuncTypes[I]], &Funcs[I], this);
F->copyRelocations(*CodeSection);
- Functions.emplace_back(F);
+ Functions.push_back(F);
}
// Populate `FunctionSymbols` and `GlobalSymbols` based on the WasmSymbols
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43524.135130.patch
Type: text/x-patch
Size: 2001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180220/284e354a/attachment.bin>
More information about the llvm-commits
mailing list