diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-04-10 21:17:54 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-04-10 21:17:54 +0000 |
commit | f43e0ae7da27230ead43092268a315f87afbe3eb (patch) | |
tree | 7e2bb51baeca1b037b4744363a6e82a66fc248db /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 2bca1a9f40a4340afb2b727e6c979e6876bec831 (diff) | |
download | bcm5719-llvm-f43e0ae7da27230ead43092268a315f87afbe3eb.tar.gz bcm5719-llvm-f43e0ae7da27230ead43092268a315f87afbe3eb.zip |
Bitcode: Merge the code for parsing global value module codes in the summary bitcode reader. NFCI.
This code will need to be taught to handle string tables and it's better if
there is only one copy of it.
Differential Revision: https://reviews.llvm.org/D31829
llvm-svn: 299886
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 80a2c918916..3a5925f0d73 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -4742,33 +4742,13 @@ Error ModuleSummaryIndexBitcodeReader::parseModule(StringRef ModulePath) { // was historically always the start of the regular bitcode header. VSTOffset = Record[0] - 1; break; - // GLOBALVAR: [pointer type, isconst, initid, - // linkage, alignment, section, visibility, threadlocal, - // unnamed_addr, externally_initialized, dllstorageclass, - // comdat] - case bitc::MODULE_CODE_GLOBALVAR: { - if (Record.size() < 6) - return error("Invalid record"); - uint64_t RawLinkage = Record[3]; - GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage); - ValueIdToLinkageMap[ValueId++] = Linkage; - break; - } - // FUNCTION: [type, callingconv, isproto, linkage, paramattr, - // alignment, section, visibility, gc, unnamed_addr, - // prologuedata, dllstorageclass, comdat, prefixdata] - case bitc::MODULE_CODE_FUNCTION: { - if (Record.size() < 8) - return error("Invalid record"); - uint64_t RawLinkage = Record[3]; - GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage); - ValueIdToLinkageMap[ValueId++] = Linkage; - break; - } - // ALIAS: [alias type, addrspace, aliasee val#, linkage, visibility, - // dllstorageclass] + // GLOBALVAR: [pointer type, isconst, initid, linkage, ...] + // FUNCTION: [type, callingconv, isproto, linkage, ...] + // ALIAS: [alias type, addrspace, aliasee val#, linkage, ...] + case bitc::MODULE_CODE_GLOBALVAR: + case bitc::MODULE_CODE_FUNCTION: case bitc::MODULE_CODE_ALIAS: { - if (Record.size() < 6) + if (Record.size() <= 3) return error("Invalid record"); uint64_t RawLinkage = Record[3]; GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage); |