summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-13 01:25:10 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-13 01:25:10 +0000
commitc1f1acc7514fc534f72e55220463cfdedfdd1cb2 (patch)
tree968d6df67474a629a2fbfb74652ece926f6f6fe9 /llvm/lib/Bitcode
parent2a5c0a27b6fe45e2c556ff94987be39220abfc09 (diff)
downloadbcm5719-llvm-c1f1acc7514fc534f72e55220463cfdedfdd1cb2.tar.gz
bcm5719-llvm-c1f1acc7514fc534f72e55220463cfdedfdd1cb2.zip
AsmWriter/Bitcode: MDCompileUnit
llvm-svn: 229013
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp15
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp27
2 files changed, 38 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 5fc758a93cc..d1c122f70ab 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1437,6 +1437,21 @@ std::error_code BitcodeReader::ParseMetadata() {
NextMDValueNo++);
break;
}
+ case bitc::METADATA_COMPILE_UNIT: {
+ if (Record.size() != 14)
+ return Error("Invalid record");
+
+ MDValueList.AssignValue(
+ GET_OR_DISTINCT(
+ MDCompileUnit, Record[0],
+ (Context, Record[1], getMD(Record[2]), getMDString(Record[3]),
+ Record[4], getMDString(Record[5]), Record[6],
+ getMDString(Record[7]), Record[8], getMDOrNull(Record[9]),
+ getMDOrNull(Record[10]), getMDOrNull(Record[11]),
+ getMDOrNull(Record[12]), getMDOrNull(Record[13]))),
+ NextMDValueNo++);
+ break;
+ }
case bitc::METADATA_STRING: {
std::string String(Record.begin(), Record.end());
llvm::UpgradeMDStringConstant(String);
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 6f275ab7962..5e27f30a48d 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -925,11 +925,30 @@ static void WriteMDFile(const MDFile *N, const ValueEnumerator &VE,
Record.clear();
}
-static void WriteMDCompileUnit(const MDCompileUnit *, const ValueEnumerator &,
- BitstreamWriter &, SmallVectorImpl<uint64_t> &,
- unsigned) {
- llvm_unreachable("write not implemented");
+static void WriteMDCompileUnit(const MDCompileUnit *N,
+ const ValueEnumerator &VE,
+ BitstreamWriter &Stream,
+ SmallVectorImpl<uint64_t> &Record,
+ unsigned Abbrev) {
+ Record.push_back(N->isDistinct());
+ Record.push_back(N->getSourceLanguage());
+ Record.push_back(VE.getMetadataID(N->getFile()));
+ Record.push_back(VE.getMetadataOrNullID(N->getRawProducer()));
+ Record.push_back(N->isOptimized());
+ Record.push_back(VE.getMetadataOrNullID(N->getRawFlags()));
+ Record.push_back(N->getRuntimeVersion());
+ Record.push_back(VE.getMetadataOrNullID(N->getRawSplitDebugFilename()));
+ Record.push_back(N->getEmissionKind());
+ Record.push_back(VE.getMetadataOrNullID(N->getEnumTypes()));
+ Record.push_back(VE.getMetadataOrNullID(N->getRetainedTypes()));
+ Record.push_back(VE.getMetadataOrNullID(N->getSubprograms()));
+ Record.push_back(VE.getMetadataOrNullID(N->getGlobalVariables()));
+ Record.push_back(VE.getMetadataOrNullID(N->getImportedEntities()));
+
+ Stream.EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev);
+ Record.clear();
}
+
static void WriteMDSubprogram(const MDSubprogram *, const ValueEnumerator &,
BitstreamWriter &, SmallVectorImpl<uint64_t> &,
unsigned) {
OpenPOWER on IntegriCloud