[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp
Reid Spencer
reid at x10sys.com
Thu Aug 26 17:38:55 PDT 2004
Changes in directory llvm/lib/Bytecode/Writer:
Writer.cpp updated: 1.76 -> 1.77
---
Log message:
Prevent an empty compaction table from being written to the bytecode file.
---
Diffs of the changes: (+12 -8)
Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.76 llvm/lib/Bytecode/Writer/Writer.cpp:1.77
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.76 Fri Aug 20 01:00:57 2004
+++ llvm/lib/Bytecode/Writer/Writer.cpp Thu Aug 26 19:38:44 2004
@@ -1034,15 +1034,19 @@
}
void BytecodeWriter::outputCompactionTable() {
- BytecodeBlock CTB(BytecodeFormat::CompactionTableBlockID, *this,
- true/*ElideIfEmpty*/);
- const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable();
-
- // First thing is first, emit the type compaction table if there is one.
- outputCompactionTypes(Type::FirstDerivedTyID);
+ // 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);
+ for (unsigned i = 0, e = CT.size(); i != e; ++i)
+ outputCompactionTablePlane(i, CT[i], 0);
+ }
}
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
More information about the llvm-commits
mailing list