Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Show First 20 Lines • Show All 1,397 Lines • ▼ Show 20 Lines | unsigned ModuleBitcodeWriter::createDILocationAbbrev() { | ||||
// location (it's never more expensive than building an array size 1). | // location (it's never more expensive than building an array size 1). | ||||
auto Abbv = std::make_shared<BitCodeAbbrev>(); | auto Abbv = std::make_shared<BitCodeAbbrev>(); | ||||
Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_LOCATION)); | Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_LOCATION)); | ||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); | Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); | ||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); | Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); | ||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); | Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); | ||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); | Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); | ||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); | Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); | ||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); | |||||
return Stream.EmitAbbrev(std::move(Abbv)); | return Stream.EmitAbbrev(std::move(Abbv)); | ||||
} | } | ||||
void ModuleBitcodeWriter::writeDILocation(const DILocation *N, | void ModuleBitcodeWriter::writeDILocation(const DILocation *N, | ||||
SmallVectorImpl<uint64_t> &Record, | SmallVectorImpl<uint64_t> &Record, | ||||
unsigned &Abbrev) { | unsigned &Abbrev) { | ||||
if (!Abbrev) | if (!Abbrev) | ||||
Abbrev = createDILocationAbbrev(); | Abbrev = createDILocationAbbrev(); | ||||
Record.push_back(N->isDistinct()); | Record.push_back(N->isDistinct()); | ||||
Record.push_back(N->getLine()); | Record.push_back(N->getLine()); | ||||
Record.push_back(N->getColumn()); | Record.push_back(N->getColumn()); | ||||
Record.push_back(VE.getMetadataID(N->getScope())); | Record.push_back(VE.getMetadataID(N->getScope())); | ||||
Record.push_back(VE.getMetadataOrNullID(N->getInlinedAt())); | Record.push_back(VE.getMetadataOrNullID(N->getInlinedAt())); | ||||
Record.push_back(N->isImplicitCode()); | |||||
Stream.EmitRecord(bitc::METADATA_LOCATION, Record, Abbrev); | Stream.EmitRecord(bitc::METADATA_LOCATION, Record, Abbrev); | ||||
Record.clear(); | Record.clear(); | ||||
} | } | ||||
unsigned ModuleBitcodeWriter::createGenericDINodeAbbrev() { | unsigned ModuleBitcodeWriter::createGenericDINodeAbbrev() { | ||||
// Assume the column is usually under 128, and always output the inlined-at | // Assume the column is usually under 128, and always output the inlined-at | ||||
// location (it's never more expensive than building an array size 1). | // location (it's never more expensive than building an array size 1). | ||||
▲ Show 20 Lines • Show All 1,660 Lines • ▼ Show 20 Lines | for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); | ||||
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC_AGAIN, Vals); | Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC_AGAIN, Vals); | ||||
continue; | continue; | ||||
} | } | ||||
Vals.push_back(DL->getLine()); | Vals.push_back(DL->getLine()); | ||||
Vals.push_back(DL->getColumn()); | Vals.push_back(DL->getColumn()); | ||||
Vals.push_back(VE.getMetadataOrNullID(DL->getScope())); | Vals.push_back(VE.getMetadataOrNullID(DL->getScope())); | ||||
Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt())); | Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt())); | ||||
Vals.push_back(DL->isImplicitCode()); | |||||
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals); | Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals); | ||||
Vals.clear(); | Vals.clear(); | ||||
LastDL = DL; | LastDL = DL; | ||||
} | } | ||||
// Emit names for all the instructions etc. | // Emit names for all the instructions etc. | ||||
if (auto *Symtab = F.getValueSymbolTable()) | if (auto *Symtab = F.getValueSymbolTable()) | ||||
▲ Show 20 Lines • Show All 1,310 Lines • Show Last 20 Lines |