AsmWriter/Bitcode: MDSubrange

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-02-13 01:10:38 +00:00
parent 7473485c0f
commit b984c49449
11 changed files with 119 additions and 9 deletions

View File

@ -1173,6 +1173,8 @@ std::error_code BitcodeReader::ParseValueSymbolTable() {
}
}
static int64_t unrotateSign(uint64_t U) { return U & 1 ? ~(U >> 1) : U >> 1; }
std::error_code BitcodeReader::ParseMetadata() {
unsigned NextMDValueNo = MDValueList.size();
@ -1349,6 +1351,16 @@ std::error_code BitcodeReader::ParseMetadata() {
NextMDValueNo++);
break;
}
case bitc::METADATA_SUBRANGE: {
if (Record.size() != 3)
return Error("Invalid record");
MDValueList.AssignValue(
GET_OR_DISTINCT(MDSubrange, Record[0],
(Context, Record[1], unrotateSign(Record[2]))),
NextMDValueNo++);
break;
}
case bitc::METADATA_STRING: {
std::string String(Record.begin(), Record.end());
llvm::UpgradeMDStringConstant(String);