[ThinLTO] Parse module summary index from assembly
Summary:
Adds assembly parsing support for the module summary index (follow on
to r333335 which added the assembly writing support).
I added support to llvm-as to invoke the index parsing, so that it can
create either a bitcode file with a Module and a per-module index, or
a combined index without a Module.
I will send follow on patches soon to do the following:
- add support to tools such as llvm-lto2 to parse the per-module indexes
from assembly instead of bitcode when testing the thin link.
- verification support.
Depends on D47844 and D47842.
Reviewers: pcc, dexonsmith, mehdi_amini
Subscribers: inglorion, eraman, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D47905
llvm-svn: 335602
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index 640b825..4370ece 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -159,7 +159,8 @@
LLLexer::LLLexer(StringRef StartBuf, SourceMgr &sm, SMDiagnostic &Err,
LLVMContext &C)
- : CurBuf(StartBuf), ErrorInfo(Err), SM(sm), Context(C), APFloatVal(0.0) {
+ : CurBuf(StartBuf), ErrorInfo(Err), SM(sm), Context(C), APFloatVal(0.0),
+ IgnoreColonInIdentifiers(false) {
CurPtr = CurBuf.begin();
}
@@ -221,6 +222,8 @@
case '!': return LexExclaim();
case '^':
return LexCaret();
+ case ':':
+ return lltok::colon;
case '#': return LexHash();
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
@@ -461,8 +464,9 @@
KeywordEnd = CurPtr;
}
- // If we stopped due to a colon, this really is a label.
- if (*CurPtr == ':') {
+ // If we stopped due to a colon, unless we were directed to ignore it,
+ // this really is a label.
+ if (!IgnoreColonInIdentifiers && *CurPtr == ':') {
StrVal.assign(StartChar-1, CurPtr++);
return lltok::LabelStr;
}
@@ -715,6 +719,73 @@
KEYWORD(catch);
KEYWORD(filter);
+ // Summary index keywords.
+ KEYWORD(path);
+ KEYWORD(hash);
+ KEYWORD(gv);
+ KEYWORD(guid);
+ KEYWORD(name);
+ KEYWORD(summaries);
+ KEYWORD(flags);
+ KEYWORD(linkage);
+ KEYWORD(notEligibleToImport);
+ KEYWORD(live);
+ KEYWORD(dsoLocal);
+ KEYWORD(function);
+ KEYWORD(insts);
+ KEYWORD(funcFlags);
+ KEYWORD(readNone);
+ KEYWORD(readOnly);
+ KEYWORD(noRecurse);
+ KEYWORD(returnDoesNotAlias);
+ KEYWORD(calls);
+ KEYWORD(callee);
+ KEYWORD(hotness);
+ KEYWORD(unknown);
+ KEYWORD(hot);
+ KEYWORD(critical);
+ KEYWORD(relbf);
+ KEYWORD(variable);
+ KEYWORD(aliasee);
+ KEYWORD(refs);
+ KEYWORD(typeIdInfo);
+ KEYWORD(typeTests);
+ KEYWORD(typeTestAssumeVCalls);
+ KEYWORD(typeCheckedLoadVCalls);
+ KEYWORD(typeTestAssumeConstVCalls);
+ KEYWORD(typeCheckedLoadConstVCalls);
+ KEYWORD(vFuncId);
+ KEYWORD(offset);
+ KEYWORD(args);
+ KEYWORD(typeid);
+ KEYWORD(summary);
+ KEYWORD(typeTestRes);
+ KEYWORD(kind);
+ KEYWORD(unsat);
+ KEYWORD(byteArray);
+ KEYWORD(inline);
+ KEYWORD(single);
+ KEYWORD(allOnes);
+ KEYWORD(sizeM1BitWidth);
+ KEYWORD(alignLog2);
+ KEYWORD(sizeM1);
+ KEYWORD(bitMask);
+ KEYWORD(inlineBits);
+ KEYWORD(wpdResolutions);
+ KEYWORD(wpdRes);
+ KEYWORD(indir);
+ KEYWORD(singleImpl);
+ KEYWORD(branchFunnel);
+ KEYWORD(singleImplName);
+ KEYWORD(resByArg);
+ KEYWORD(byArg);
+ KEYWORD(uniformRetVal);
+ KEYWORD(uniqueRetVal);
+ KEYWORD(virtualConstProp);
+ KEYWORD(info);
+ KEYWORD(byte);
+ KEYWORD(bit);
+
#undef KEYWORD
// Keywords for types.