From: Sam Clegg Date: Wed, 21 Feb 2018 18:29:23 +0000 (+0000) Subject: [WebAssembly] Rename member DefinedFunctions -> InputFunctions. NFC. X-Git-Tag: llvmorg-7.0.0-rc1~12332 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f9342265130e15e7b43ebfa62c71876acd9b322;p=platform%2Fupstream%2Fllvm.git [WebAssembly] Rename member DefinedFunctions -> InputFunctions. NFC. This avoids confusion with the `DefinedFunction` symbol type. Differential Revision: https://reviews.llvm.org/D43588 llvm-svn: 325705 --- diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 6ffce92..c553d0a 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -122,7 +122,7 @@ private: std::vector ImportedGlobals; std::vector ExportedSymbols; std::vector DefinedDataSymbols; - std::vector DefinedFunctions; + std::vector InputFunctions; std::vector IndirectFunctions; std::vector InitFunctions; @@ -202,14 +202,14 @@ void Writer::createTypeSection() { } void Writer::createFunctionSection() { - if (DefinedFunctions.empty()) + if (InputFunctions.empty()) return; SyntheticSection *Section = createSyntheticSection(WASM_SEC_FUNCTION); raw_ostream &OS = Section->getStream(); - writeUleb128(OS, DefinedFunctions.size(), "function count"); - for (const InputFunction *Func : DefinedFunctions) + writeUleb128(OS, InputFunctions.size(), "function count"); + for (const InputFunction *Func : InputFunctions) writeUleb128(OS, lookupType(Func->Signature), "sig index"); } @@ -323,12 +323,12 @@ void Writer::createElemSection() { } void Writer::createCodeSection() { - if (DefinedFunctions.empty()) + if (InputFunctions.empty()) return; log("createCodeSection"); - auto Section = make(DefinedFunctions); + auto Section = make(InputFunctions); OutputSections.push_back(Section); } @@ -438,7 +438,7 @@ void Writer::createLinkingSection() { struct ComdatEntry { unsigned Kind; uint32_t Index; }; std::map> Comdats; - for (const InputFunction *F : DefinedFunctions) { + for (const InputFunction *F : InputFunctions) { StringRef Comdat = F->getComdat(); if (!Comdat.empty()) Comdats[Comdat].emplace_back( @@ -477,7 +477,7 @@ void Writer::createLinkingSection() { // Create the custom "name" section containing debug symbol names. void Writer::createNameSection() { unsigned NumNames = ImportedFunctions.size(); - for (const InputFunction *F : DefinedFunctions) + for (const InputFunction *F : InputFunctions) if (!F->getName().empty()) ++NumNames; @@ -491,13 +491,13 @@ void Writer::createNameSection() { writeUleb128(OS, NumNames, "name count"); // Names must appear in function index order. As it happens ImportedFunctions - // and DefinedFunctions are numbers in order with imported functions coming + // and InputFunctions are numbers in order with imported functions coming // first. for (const Symbol *S : ImportedFunctions) { writeUleb128(OS, S->getOutputIndex(), "import index"); writeStr(OS, S->getName(), "symbol name"); } - for (const InputFunction *F : DefinedFunctions) { + for (const InputFunction *F : InputFunctions) { if (!F->getName().empty()) { writeUleb128(OS, F->getOutputIndex(), "func index"); writeStr(OS, F->getName(), "symbol name"); @@ -714,13 +714,13 @@ void Writer::calculateTypes() { for (const FunctionSymbol *Sym : ImportedFunctions) registerType(*Sym->getFunctionType()); - for (const InputFunction *F : DefinedFunctions) + for (const InputFunction *F : InputFunctions) registerType(F->Signature); } void Writer::assignIndexes() { uint32_t GlobalIndex = ImportedGlobals.size() + DefinedDataSymbols.size(); - uint32_t FunctionIndex = ImportedFunctions.size() + DefinedFunctions.size(); + uint32_t FunctionIndex = ImportedFunctions.size() + InputFunctions.size(); auto AddDefinedData = [&](DefinedData *Sym) { if (Sym) { @@ -755,7 +755,7 @@ void Writer::assignIndexes() { for (InputFunction *Func : File->Functions) { if (!Func->Live) continue; - DefinedFunctions.emplace_back(Func); + InputFunctions.emplace_back(Func); Func->setOutputIndex(FunctionIndex++); } } @@ -828,7 +828,7 @@ static const int OPCODE_END = 0xb; // Create synthetic "__wasm_call_ctors" function based on ctor functions // in input object. void Writer::createCtorFunction() { - uint32_t FunctionIndex = ImportedFunctions.size() + DefinedFunctions.size(); + uint32_t FunctionIndex = ImportedFunctions.size() + InputFunctions.size(); WasmSym::CallCtors->setOutputIndex(FunctionIndex); // First write the body bytes to a string. @@ -855,7 +855,7 @@ void Writer::createCtorFunction() { CtorFunction = llvm::make_unique( Signature, BodyArray, WasmSym::CallCtors->getName()); CtorFunction->setOutputIndex(FunctionIndex); - DefinedFunctions.emplace_back(CtorFunction.get()); + InputFunctions.emplace_back(CtorFunction.get()); } // Populate InitFunctions vector with init functions from all input objects. @@ -892,7 +892,7 @@ void Writer::run() { calculateTypes(); if (errorHandler().Verbose) { - log("Defined Functions: " + Twine(DefinedFunctions.size())); + log("Defined Functions: " + Twine(InputFunctions.size())); log("Defined Data Syms: " + Twine(DefinedDataSymbols.size())); log("Function Imports : " + Twine(ImportedFunctions.size())); log("Global Imports : " + Twine(ImportedGlobals.size()));