diff options
author | Eugene Leviant <eleviant@accesssoftek.com> | 2019-07-05 13:26:05 +0000 |
---|---|---|
committer | Eugene Leviant <eleviant@accesssoftek.com> | 2019-07-05 13:26:05 +0000 |
commit | e91f86f0ac70be2bfcb3fb862b4e6d9d9f84cf5f (patch) | |
tree | f5d1b66d575ed369304540880d3e1bed3a6ac194 /llvm/lib/AsmParser/LLParser.cpp | |
parent | 8ca1c65cedb0b86c9706b5ec1a962d80f48af434 (diff) | |
download | bcm5719-llvm-e91f86f0ac70be2bfcb3fb862b4e6d9d9f84cf5f.tar.gz bcm5719-llvm-e91f86f0ac70be2bfcb3fb862b4e6d9d9f84cf5f.zip |
Reverted r365188 due to alignment problems on i686-android
llvm-svn: 365206
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 57 |
1 files changed, 15 insertions, 42 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 085f3bd2999..9bfce74eb0b 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -7860,13 +7860,9 @@ static const auto FwdVIRef = (GlobalValueSummaryMapTy::value_type *)-8; static void resolveFwdRef(ValueInfo *Fwd, ValueInfo &Resolved) { bool ReadOnly = Fwd->isReadOnly(); - bool WriteOnly = Fwd->isWriteOnly(); - assert(!(ReadOnly && WriteOnly)); *Fwd = Resolved; if (ReadOnly) Fwd->setReadOnly(); - if (WriteOnly) - Fwd->setWriteOnly(); } /// Stores the given Name/GUID and associated summary into the Index. @@ -8096,8 +8092,7 @@ bool LLParser::ParseVariableSummary(std::string Name, GlobalValue::GUID GUID, GlobalValueSummary::GVFlags GVFlags = GlobalValueSummary::GVFlags( /*Linkage=*/GlobalValue::ExternalLinkage, /*NotEligibleToImport=*/false, /*Live=*/false, /*IsLocal=*/false, /*CanAutoHide=*/false); - GlobalVarSummary::GVarFlags GVarFlags(/*ReadOnly*/ false, - /* WriteOnly */ false); + GlobalVarSummary::GVarFlags GVarFlags(/*ReadOnly*/ false); std::vector<ValueInfo> Refs; VTableFuncList VTableFuncs; if (ParseToken(lltok::colon, "expected ':' here") || @@ -8438,11 +8433,10 @@ bool LLParser::ParseOptionalRefs(std::vector<ValueInfo> &Refs) { VContexts.push_back(VC); } while (EatIfPresent(lltok::comma)); - // Sort value contexts so that ones with writeonly - // and readonly ValueInfo are at the end of VContexts vector. - // See FunctionSummary::specialRefCounts() + // Sort value contexts so that ones with readonly ValueInfo are at the end + // of VContexts vector. This is needed to match immutableRefCount() behavior. llvm::sort(VContexts, [](const ValueContext &VC1, const ValueContext &VC2) { - return VC1.VI.getAccessSpecifier() < VC2.VI.getAccessSpecifier(); + return VC1.VI.isReadOnly() < VC2.VI.isReadOnly(); }); IdToIndexMapType IdToIndexMap; @@ -8760,41 +8754,24 @@ bool LLParser::ParseGVFlags(GlobalValueSummary::GVFlags &GVFlags) { } /// GVarFlags -/// ::= 'varFlags' ':' '(' 'readonly' ':' Flag -/// ',' 'writeonly' ':' Flag ')' +/// ::= 'varFlags' ':' '(' 'readonly' ':' Flag ')' bool LLParser::ParseGVarFlags(GlobalVarSummary::GVarFlags &GVarFlags) { assert(Lex.getKind() == lltok::kw_varFlags); Lex.Lex(); + unsigned Flag = 0; if (ParseToken(lltok::colon, "expected ':' here") || - ParseToken(lltok::lparen, "expected '(' here")) + ParseToken(lltok::lparen, "expected '(' here") || + ParseToken(lltok::kw_readonly, "expected 'readonly' here") || + ParseToken(lltok::colon, "expected ':' here")) return true; - auto ParseRest = [this](unsigned int &Val) { - Lex.Lex(); - if (ParseToken(lltok::colon, "expected ':'")) - return true; - return ParseFlag(Val); - }; + ParseFlag(Flag); + GVarFlags.ReadOnly = Flag; - do { - unsigned Flag = 0; - switch (Lex.getKind()) { - case lltok::kw_readonly: - if (ParseRest(Flag)) - return true; - GVarFlags.MaybeReadOnly = Flag; - break; - case lltok::kw_writeonly: - if (ParseRest(Flag)) - return true; - GVarFlags.MaybeWriteOnly = Flag; - break; - default: - return Error(Lex.getLoc(), "expected gvar flag type"); - } - } while (EatIfPresent(lltok::comma)); - return ParseToken(lltok::rparen, "expected ')' here"); + if (ParseToken(lltok::rparen, "expected ')' here")) + return true; + return false; } /// ModuleReference @@ -8817,9 +8794,7 @@ bool LLParser::ParseModuleReference(StringRef &ModulePath) { /// GVReference /// ::= SummaryID bool LLParser::ParseGVReference(ValueInfo &VI, unsigned &GVId) { - bool WriteOnly = false, ReadOnly = EatIfPresent(lltok::kw_readonly); - if (!ReadOnly) - WriteOnly = EatIfPresent(lltok::kw_writeonly); + bool ReadOnly = EatIfPresent(lltok::kw_readonly); if (ParseToken(lltok::SummaryID, "expected GV ID")) return true; @@ -8834,7 +8809,5 @@ bool LLParser::ParseGVReference(ValueInfo &VI, unsigned &GVId) { if (ReadOnly) VI.setReadOnly(); - if (WriteOnly) - VI.setWriteOnly(); return false; } |