mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-03 02:31:26 +00:00
Bitcode: Add abbreviation for METADATA_NAME
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225715 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
442539c468
commit
0c3289e0bb
@ -798,6 +798,16 @@ static void WriteModuleMetadata(const Module *M,
|
||||
MDSAbbrev = Stream.EmitAbbrev(Abbv);
|
||||
}
|
||||
|
||||
unsigned NameAbbrev = 0;
|
||||
if (!M->named_metadata_empty()) {
|
||||
// Abbrev for METADATA_NAME.
|
||||
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
|
||||
Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_NAME));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
|
||||
NameAbbrev = Stream.EmitAbbrev(Abbv);
|
||||
}
|
||||
|
||||
SmallVector<uint64_t, 64> Record;
|
||||
for (const Metadata *MD : MDs) {
|
||||
if (const MDNode *N = dyn_cast<MDNode>(MD)) {
|
||||
@ -821,9 +831,8 @@ static void WriteModuleMetadata(const Module *M,
|
||||
for (const NamedMDNode &NMD : M->named_metadata()) {
|
||||
// Write name.
|
||||
StringRef Str = NMD.getName();
|
||||
for (unsigned i = 0, e = Str.size(); i != e; ++i)
|
||||
Record.push_back(Str[i]);
|
||||
Stream.EmitRecord(bitc::METADATA_NAME, Record, 0/*TODO*/);
|
||||
Record.append(Str.bytes_begin(), Str.bytes_end());
|
||||
Stream.EmitRecord(bitc::METADATA_NAME, Record, NameAbbrev);
|
||||
Record.clear();
|
||||
|
||||
// Write named metadata operands.
|
||||
|
Loading…
x
Reference in New Issue
Block a user