summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 5e90cd1bf10..e9bc5074039 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -583,7 +583,8 @@ static void writeComdats(const ValueEnumerator &VE, BitstreamWriter &Stream) {
/// after the real VST is written. Returns the bit offset to backpatch.
static uint64_t WriteValueSymbolTableForwardDecl(const ValueSymbolTable &VST,
BitstreamWriter &Stream) {
- if (VST.empty()) return 0;
+ if (VST.empty())
+ return 0;
// Write a placeholder value in for the offset of the real VST,
// which is written after the function blocks so that it can include
@@ -2220,8 +2221,8 @@ static void WriteValueSymbolTable(
// 8-bit fixed-width VST_FNENTRY function strings.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_FNENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
FnEntry8BitAbbrev = Stream.EmitAbbrev(Abbv);
@@ -2229,8 +2230,8 @@ static void WriteValueSymbolTable(
// 7-bit fixed width VST_FNENTRY function strings.
Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_FNENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
FnEntry7BitAbbrev = Stream.EmitAbbrev(Abbv);
@@ -2238,8 +2239,8 @@ static void WriteValueSymbolTable(
// 6-bit char6 VST_FNENTRY function strings.
Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_FNENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
FnEntry6BitAbbrev = Stream.EmitAbbrev(Abbv);
@@ -2303,7 +2304,8 @@ static void WriteValueSymbolTable(
AbbrevToUse = VST_ENTRY_7_ABBREV;
}
- for (const auto P : Name.getKey()) NameVals.push_back((unsigned char)P);
+ for (const auto P : Name.getKey())
+ NameVals.push_back((unsigned char)P);
// Emit the finished record.
Stream.EmitRecord(Code, NameVals, AbbrevToUse);
@@ -2321,7 +2323,7 @@ static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index,
// 8-bit fixed-width VST_COMBINED_FNENTRY function strings.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_FNENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
unsigned FnEntry8BitAbbrev = Stream.EmitAbbrev(Abbv);
@@ -2329,7 +2331,7 @@ static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index,
// 7-bit fixed width VST_COMBINED_FNENTRY function strings.
Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_FNENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
unsigned FnEntry7BitAbbrev = Stream.EmitAbbrev(Abbv);
@@ -2337,7 +2339,7 @@ static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index,
// 6-bit char6 VST_COMBINED_FNENTRY function strings.
Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_FNENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
unsigned FnEntry6BitAbbrev = Stream.EmitAbbrev(Abbv);
@@ -2361,7 +2363,8 @@ static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index,
else if (Bits == SE_Fixed7)
AbbrevToUse = FnEntry7BitAbbrev;
- for (const auto P : FuncName) NameVals.push_back((unsigned char)P);
+ for (const auto P : FuncName)
+ NameVals.push_back((unsigned char)P);
// Emit the finished record.
Stream.EmitRecord(bitc::VST_CODE_COMBINED_FNENTRY, NameVals, AbbrevToUse);
@@ -2466,7 +2469,8 @@ static void WriteFunction(
I != E; ++I) {
WriteInstruction(*I, InstID, VE, Stream, Vals);
- if (!isa<DbgInfoIntrinsic>(I)) ++NumInsts;
+ if (!isa<DbgInfoIntrinsic>(I))
+ ++NumInsts;
if (!I->getType()->isVoidTy())
++InstID;
@@ -2728,7 +2732,8 @@ static void WriteModStrings(const FunctionInfoIndex &I,
NameVals.push_back(MPSE.getValue());
- for (const auto P : MPSE.getKey()) NameVals.push_back((unsigned char)P);
+ for (const auto P : MPSE.getKey())
+ NameVals.push_back((unsigned char)P);
// Emit the finished record.
Stream.EmitRecord(bitc::MST_CODE_ENTRY, NameVals, AbbrevToUse);
@@ -2761,16 +2766,17 @@ static void WritePerModuleFunctionSummary(
// Abbrev for FS_CODE_PERMODULE_ENTRY.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::FS_CODE_PERMODULE_ENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // islocal
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // instcount
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // islocal
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // instcount
unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
SmallVector<unsigned, 64> NameVals;
for (auto &I : FunctionIndex) {
// Skip anonymous functions. We will emit a function summary for
// any aliases below.
- if (!I.first->hasName()) continue;
+ if (!I.first->hasName())
+ continue;
WritePerModuleFunctionSummaryRecord(
NameVals, I.second->functionSummary(),
@@ -2779,9 +2785,11 @@ static void WritePerModuleFunctionSummary(
}
for (const GlobalAlias &A : M->aliases()) {
- if (!A.getBaseObject()) continue;
+ if (!A.getBaseObject())
+ continue;
const Function *F = dyn_cast<Function>(A.getBaseObject());
- if (!F || F->isDeclaration()) continue;
+ if (!F || F->isDeclaration())
+ continue;
assert(FunctionIndex.count(F) == 1);
WritePerModuleFunctionSummaryRecord(
@@ -2802,8 +2810,8 @@ static void WriteCombinedFunctionSummary(const FunctionInfoIndex &I,
// Abbrev for FS_CODE_COMBINED_ENTRY.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::FS_CODE_COMBINED_ENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // instcount
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // instcount
unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
SmallVector<unsigned, 64> NameVals;
OpenPOWER on IntegriCloud