diff options
author | Victor Hernandez <vhernandez@apple.com> | 2010-01-10 07:14:18 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2010-01-10 07:14:18 +0000 |
commit | 24e64df7ec25b55aa872c2ef33728dfbb8c353c4 (patch) | |
tree | 7bd02b0cd86413d8a5202b7356d5670522ec2c93 /lib/Bitcode | |
parent | f4fb91181cbd3f63d487a2519c7f7be9d5e51709 (diff) |
Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 8 | ||||
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 87c4fd77f3..a417c684de 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -766,6 +766,7 @@ bool BitcodeReader::ParseMetadata() { continue; } + bool IsFunctionLocal = false; // Read a record. Record.clear(); switch (Stream.ReadRecord(Code, Record)) { @@ -804,6 +805,9 @@ bool BitcodeReader::ParseMetadata() { MDValueList.AssignValue(V, NextValueNo++); break; } + case bitc::METADATA_FN_NODE: + IsFunctionLocal = true; + // fall-through case bitc::METADATA_NODE: { if (Record.empty() || Record.size() % 2 == 1) return Error("Invalid METADATA_NODE record"); @@ -819,7 +823,9 @@ bool BitcodeReader::ParseMetadata() { else Elts.push_back(NULL); } - Value *V = MDNode::get(Context, &Elts[0], Elts.size()); + Value *V = MDNode::getWhenValsUnresolved(Context, &Elts[0], Elts.size(), + IsFunctionLocal); + IsFunctionLocal = false; MDValueList.AssignValue(V, NextValueNo++); break; } diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index d34e24ccb5..26c922a781 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -484,7 +484,9 @@ static void WriteMDNode(const MDNode *N, Record.push_back(0); } } - Stream.EmitRecord(bitc::METADATA_NODE, Record, 0); + unsigned MDCode = N->isFunctionLocal() ? bitc::METADATA_FN_NODE : + bitc::METADATA_NODE; + Stream.EmitRecord(MDCode, Record, 0); Record.clear(); } |