aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer/Writer.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-30 19:36:46 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-30 19:36:46 +0000
commitd2bb887cd193b8b47fb15fedc7a05ab66997d4c5 (patch)
tree6efd9c6a02e765929fc4d7ca6d337b5d9c9187f8 /lib/Bytecode/Writer/Writer.cpp
parent908504347b0565c4d4817af444012be76ba4b76f (diff)
Bye, Bye Compaction Tables. The benefit compaction tables provides doesn't
outweight its computational costs. This patch removes all compaction table handling from the bcreader and bcwriter. For the record, here's the difference betweeen having and not having compaction tables for some tests: Test With Without Size Chg Olden/mst 5,602 5,598 +0.1% viterbi 18,026 17,795 +1.3% obsequi 162,133 166,663 -2.8% burg 224,090 228,148 -1.8% kimwitu++ 4,933,263 5,121,159 -3.8% 176.gcc 8,470,424 9,141,539 -7.3% It seems that it is more beneficial to larger files, but even on the largest test case we have (176.gcc) it only amounts ot an I/O saving of 7.3%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/Writer.cpp')
-rw-r--r--lib/Bytecode/Writer/Writer.cpp78
1 files changed, 1 insertions, 77 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index d5f3f9301d..a81f41efdd 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -1112,14 +1112,7 @@ void BytecodeWriter::outputFunction(const Function *F) {
// Get slot information about the function...
Table.incorporateFunction(F);
- if (Table.getCompactionTable().empty()) {
- // Output information about the constants in the function if the compaction
- // table is not being used.
- outputConstants(true);
- } else {
- // Otherwise, emit the compaction table.
- outputCompactionTable();
- }
+ outputConstants(true);
// Output all of the instructions in the body of the function
outputInstructions(F);
@@ -1130,75 +1123,6 @@ void BytecodeWriter::outputFunction(const Function *F) {
Table.purgeFunction();
}
-void BytecodeWriter::outputCompactionTablePlane(unsigned PlaneNo,
- const std::vector<const Value*> &Plane,
- unsigned StartNo) {
- unsigned End = Table.getModuleLevel(PlaneNo);
- if (Plane.empty() || StartNo == End || End == 0) return; // Nothing to emit
- assert(StartNo < End && "Cannot emit negative range!");
- assert(StartNo < Plane.size() && End <= Plane.size());
-
- // Do not emit the null initializer!
- ++StartNo;
-
- // Figure out which encoding to use. By far the most common case we have is
- // to emit 0-2 entries in a compaction table plane.
- switch (End-StartNo) {
- case 0: // Avoid emitting two vbr's if possible.
- case 1:
- case 2:
- output_vbr((PlaneNo << 2) | End-StartNo);
- break;
- default:
- // Output the number of things.
- output_vbr((unsigned(End-StartNo) << 2) | 3);
- output_typeid(PlaneNo); // Emit the type plane this is
- break;
- }
-
- for (unsigned i = StartNo; i != End; ++i)
- output_vbr(Table.getGlobalSlot(Plane[i]));
-}
-
-void BytecodeWriter::outputCompactionTypes(unsigned StartNo) {
- // Get the compaction type table from the slot calculator
- const std::vector<const Type*> &CTypes = Table.getCompactionTypes();
-
- // The compaction types may have been uncompactified back to the
- // global types. If so, we just write an empty table
- if (CTypes.size() == 0) {
- output_vbr(0U);
- return;
- }
-
- assert(CTypes.size() >= StartNo && "Invalid compaction types start index");
-
- // Determine how many types to write
- unsigned NumTypes = CTypes.size() - StartNo;
-
- // Output the number of types.
- output_vbr(NumTypes);
-
- for (unsigned i = StartNo; i < StartNo+NumTypes; ++i)
- output_typeid(Table.getGlobalSlot(CTypes[i]));
-}
-
-void BytecodeWriter::outputCompactionTable() {
- // Avoid writing the compaction table at all if there is no content.
- if (Table.getCompactionTypes().size() >= Type::FirstDerivedTyID ||
- (!Table.CompactionTableIsEmpty())) {
- BytecodeBlock CTB(BytecodeFormat::CompactionTableBlockID, *this,
- true/*ElideIfEmpty*/);
- const std::vector<std::vector<const Value*> > &CT =
- Table.getCompactionTable();
-
- // First things first, emit the type compaction table if there is one.
- outputCompactionTypes(Type::FirstDerivedTyID);
-
- for (unsigned i = 0, e = CT.size(); i != e; ++i)
- outputCompactionTablePlane(i, CT[i], 0);
- }
-}
void BytecodeWriter::outputTypeSymbolTable(const TypeSymbolTable &TST) {
// Do not output the block for an empty symbol table, it just wastes