summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-04 20:58:35 +0000
committerChris Lattner <sabre@nondot.org>2007-05-04 20:58:35 +0000
commitfd1ad10e61b8bf6affff37dd0a86bb8ff9dc2161 (patch)
tree9a1e75b1d657c830aeb16c11124998dc91acfe6d /llvm/lib/Bitcode
parent4d92598ab090a67204dce41ea83f7566b8c552fb (diff)
downloadbcm5719-llvm-fd1ad10e61b8bf6affff37dd0a86bb8ff9dc2161.tar.gz
bcm5719-llvm-fd1ad10e61b8bf6affff37dd0a86bb8ff9dc2161.zip
shave another 150K off of kc++, by using a 7-bit encoding for BB names
where we can. This shrinks kc++'s down to 3368K, with a VST record of: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.29508e+07b/1.61885e+06B/404713W Average Size: 5522.73b/690.342B/172.585W % of file: 48.0645 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 7035/3 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 Isn't it nice to be able to optimizer bc size without touching the reader? :) llvm-svn: 36759
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 172db3ac785..938be87b452 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -32,7 +32,8 @@ enum {
// VALUE_SYMTAB_BLOCK abbrev id's.
VST_ENTRY_8_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
- VST_ENTRY_7_ABBREV
+ VST_ENTRY_7_ABBREV,
+ VST_BBENTRY_7_ABBREV
};
@@ -732,6 +733,15 @@ static void WriteValueSymbolTable(const ValueSymbolTable &VST,
if (Stream.EmitAbbrev(Abbv) != VST_ENTRY_7_ABBREV)
assert(0 && "Unexpected abbrev ordering!");
}
+ { // 7-bit fixed width VST_BBENTRY strings.
+ BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+ Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_BBENTRY));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
+ if (Stream.EmitAbbrev(Abbv) != VST_BBENTRY_7_ABBREV)
+ assert(0 && "Unexpected abbrev ordering!");
+ }
// FIXME: Set up the abbrev, we know how many values there are!
@@ -759,6 +769,7 @@ static void WriteValueSymbolTable(const ValueSymbolTable &VST,
unsigned Code;
if (isa<BasicBlock>(SI->getValue())) {
Code = bitc::VST_CODE_BBENTRY;
+ if (is7Bit) AbbrevToUse = VST_BBENTRY_7_ABBREV;
} else {
Code = bitc::VST_CODE_ENTRY;
AbbrevToUse = is7Bit ? VST_ENTRY_7_ABBREV : VST_ENTRY_8_ABBREV;
OpenPOWER on IntegriCloud