llvm.org GIT mirror llvm / 6fc58a7
Change Metadata Index emission in the bitcode to use 2x32 bits for the placeholder The Bitstream reader and writer are limited to handle a "size_t" at most, which means that we can't backpatch and read back a 64bits value on 32 bits platform. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290693 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 3 years ago
3 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
283283 default: llvm_unreachable("Unknown encoding!");
284284 case BitCodeAbbrevOp::Fixed:
285285 if (Op.getEncodingData())
286 Emit64(V, (unsigned)Op.getEncodingData());
286 Emit((unsigned)V, (unsigned)Op.getEncodingData());
287287 break;
288288 case BitCodeAbbrevOp::VBR:
289289 if (Op.getEncodingData())
19191919
19201920 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
19211921 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_INDEX_OFFSET));
1922 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 64));
1922 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1923 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
19231924 unsigned OffsetAbbrev = Stream.EmitAbbrev(Abbv);
19241925
19251926 Abbv = new BitCodeAbbrev();
19381939 // which is written after the records, so that it can include
19391940 // the offset of each entry. The placeholder offset will be
19401941 // updated after all records are emitted.
1941 uint64_t Vals[] = {0};
1942 uint64_t Vals[] = {0, 0};
19421943 Stream.EmitRecord(bitc::METADATA_INDEX_OFFSET, Vals, OffsetAbbrev);
19431944 }
19441945
608608 // and validate its forward reference offset was correct!
609609 if (BlockID == bitc::METADATA_BLOCK_ID) {
610610 if (Code == bitc::METADATA_INDEX_OFFSET) {
611 MetadataIndexOffset = Stream.GetCurrentBitNo() + Record[0];
611 if (Record.size() != 2)
612 outs() << "(Invalid record)";
613 else {
614 auto Offset = Record[0] + (Record[1] << 32);
615 MetadataIndexOffset = Stream.GetCurrentBitNo() + Offset;
616 }
612617 }
613618 if (Code == bitc::METADATA_INDEX) {
614619 outs() << " (offset ";