[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Chris Lattner
sabre at nondot.org
Fri May 4 13:35:08 PDT 2007
Changes in directory llvm/lib/Bitcode/Writer:
BitcodeWriter.cpp updated: 1.31 -> 1.32
---
Log message:
Encode all value symtab strings as arrays of 8-bit fixed width integers,
instead of the default inefficient encoding. This shrinks kc++ from 4134K
to 3629K
---
Diffs of the changes: (+15 -15)
BitcodeWriter.cpp | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.31 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.32
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.31 Fri May 4 14:11:41 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 15:34:50 2007
@@ -267,22 +267,22 @@
// Add an abbrev for common globals with no visibility or thread localness.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_GLOBALVAR));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth,
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
Log2_32_Ceil(MaxGlobalType+1)));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 1)); // Constant.
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constant.
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Initializer.
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 3)); // Linkage.
- if (MaxAlignment == 0) // Alignment.
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage.
+ if (MaxAlignment == 0) // Alignment.
Abbv->Add(BitCodeAbbrevOp(0));
else {
unsigned MaxEncAlignment = Log2_32(MaxAlignment)+1;
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth,
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
Log2_32_Ceil(MaxEncAlignment+1)));
}
if (SectionMap.empty()) // Section.
Abbv->Add(BitCodeAbbrevOp(0));
else
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth,
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
Log2_32_Ceil(SectionMap.size()+1)));
// Don't bother emitting vis + thread local.
SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv);
@@ -702,15 +702,14 @@
BitstreamWriter &Stream) {
if (VST.empty()) return;
Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3);
-
-#if 0
+
+ // 8-bit fixed width VST_ENTRY strings.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
- Abbv->Add(BitCodeAbbrevOp(bitc::VST_ENTRY));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth,
- Log2_32_Ceil(MaxGlobalType+1)));
- // Don't bother emitting vis + thread local.
- SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv);
-#endif
+ Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
+ unsigned AbbrevID = Stream.EmitAbbrev(Abbv);
// FIXME: Set up the abbrev, we know how many values there are!
@@ -728,6 +727,7 @@
Code = bitc::VST_CODE_BBENTRY;
} else {
Code = bitc::VST_CODE_ENTRY;
+ AbbrevToUse = AbbrevID;
}
NameVals.push_back(VE.getValueID(SI->getValue()));
@@ -873,7 +873,7 @@
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8); // Value ID
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 3)); // Linkage.
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage.
xxx = Stream.EmitAbbrev(Abbv);
#endif
More information about the llvm-commits
mailing list