[llvm-commits] CVS: llvm/lib/Bytecode/Writer/ConstantWriter.cpp InstructionWriter.cpp Writer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Jan 31 19:51:03 PST 2004
Changes in directory llvm/lib/Bytecode/Writer:
ConstantWriter.cpp updated: 1.33 -> 1.34
InstructionWriter.cpp updated: 1.38 -> 1.39
Writer.cpp updated: 1.60 -> 1.61
---
Log message:
Remove all of the annoying statistics now that I'm finished (for the near
term) working on bytecode size stuff.
---
Diffs of the changes: (+0 -89)
Index: llvm/lib/Bytecode/Writer/ConstantWriter.cpp
diff -u llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.33 llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.34
--- llvm/lib/Bytecode/Writer/ConstantWriter.cpp:1.33 Sun Jan 18 15:08:52 2004
+++ llvm/lib/Bytecode/Writer/ConstantWriter.cpp Sat Jan 31 19:50:31 2004
@@ -19,21 +19,11 @@
#include "Support/Statistic.h"
using namespace llvm;
-static Statistic<>
-TypeBytes("bytecodewriter", "Bytes of types");
-static Statistic<>
-ConstantBytes("bytecodewriter", "Bytes of constants");
-static Statistic<>
-NumConstants("bytecodewriter", "Number of constants");
-
-
void BytecodeWriter::outputType(const Type *T) {
- TypeBytes -= Out.size();
output_vbr((unsigned)T->getPrimitiveID(), Out);
// That's all there is to handling primitive types...
if (T->isPrimitiveType()) {
- TypeBytes += Out.size();
return; // We might do this if we alias a prim type: %x = type int
}
@@ -107,16 +97,12 @@
<< " Type '" << T->getDescription() << "'\n";
break;
}
- TypeBytes += Out.size();
}
void BytecodeWriter::outputConstant(const Constant *CPV) {
- ConstantBytes -= Out.size();
assert((CPV->getType()->isPrimitiveType() || !CPV->isNullValue()) &&
"Shouldn't output null constants!");
- ++NumConstants;
-
// We must check for a ConstantExpr before switching by type because
// a ConstantExpr can be of any type, and has no explicit value.
//
@@ -133,7 +119,6 @@
Slot = Table.getSlot((*OI)->getType());
output_vbr((unsigned)Slot, Out);
}
- ConstantBytes += Out.size();
return;
} else {
output_vbr(0U, Out); // flag as not a ConstantExpr
@@ -211,7 +196,6 @@
<< " type '" << CPV->getType()->getName() << "'\n";
break;
}
- ConstantBytes += Out.size();
return;
}
@@ -225,8 +209,6 @@
output_vbr(unsigned(E-I), Out);
output_vbr(Type::VoidTyID, Out);
- ConstantBytes -= Out.size();
-
// Emit all of the strings.
for (I = Table.string_begin(); I != E; ++I) {
const ConstantArray *Str = *I;
@@ -238,8 +220,5 @@
// emit all of the characters.
std::string Val = Str->getAsString();
output_data(Val.c_str(), Val.c_str()+Val.size(), Out);
-
- ++NumConstants;
}
- ConstantBytes += Out.size();
}
Index: llvm/lib/Bytecode/Writer/InstructionWriter.cpp
diff -u llvm/lib/Bytecode/Writer/InstructionWriter.cpp:1.38 llvm/lib/Bytecode/Writer/InstructionWriter.cpp:1.39
--- llvm/lib/Bytecode/Writer/InstructionWriter.cpp:1.38 Sun Jan 18 15:08:52 2004
+++ llvm/lib/Bytecode/Writer/InstructionWriter.cpp Sat Jan 31 19:50:31 2004
@@ -20,26 +20,6 @@
#include <algorithm>
using namespace llvm;
-static Statistic<>
-NumInstrs("bytecodewriter", "Number of instructions");
-static Statistic<>
-NumOversizedInstrs("bytecodewriter", "Number of oversized instructions");
-static Statistic<>
-BytesOversizedInstrs("bytecodewriter", "Bytes of oversized instructions");
-
-static Statistic<>
-NumHugeOperandInstrs("bytecodewriter", "Number of instructions with > 3 operands");
-static Statistic<>
-NumOversized1OpInstrs("bytecodewriter", "Number of oversized 1 operand instrs");
-static Statistic<>
-NumOversized2OpInstrs("bytecodewriter", "Number of oversized 2 operand instrs");
-static Statistic<>
-NumOversized3OpInstrs("bytecodewriter", "Number of oversized 3 operand instrs");
-
-static Statistic<>
-NumOversidedBecauseOfTypes("bytecodewriter", "Number of oversized instructions because of their type");
-
-
typedef unsigned char uchar;
// outputInstructionFormat0 - Output those wierd instructions that have a large
@@ -50,9 +30,6 @@
static void outputInstructionFormat0(const Instruction *I, unsigned Opcode,
const SlotCalculator &Table,
unsigned Type, std::deque<uchar> &Out) {
- NumOversizedInstrs++;
- BytesOversizedInstrs -= Out.size();
-
// Opcode must have top two bits clear...
output_vbr(Opcode << 2, Out); // Instruction Opcode ID
output_vbr(Type, Out); // Result type
@@ -78,7 +55,6 @@
}
align32(Out); // We must maintain correct alignment!
- BytesOversizedInstrs += Out.size();
}
@@ -281,8 +257,6 @@
}
}
- ++NumInstrs;
-
// Decide which instruction encoding to use. This is determined primarily by
// the number of operands, and secondarily by whether or not the max operand
// will fit into the instruction encoding. More operands == fewer bits per
@@ -295,10 +269,6 @@
outputInstructionFormat1(&I, Opcode, Table, Slots, Type, Out);
return;
}
- if (Type >= (1 << 12)-1)
- NumOversidedBecauseOfTypes++;
-
- NumOversized1OpInstrs++;
break;
case 2:
@@ -306,9 +276,6 @@
outputInstructionFormat2(&I, Opcode, Table, Slots, Type, Out);
return;
}
- if (Type >= (1 << 8))
- NumOversidedBecauseOfTypes++;
- NumOversized2OpInstrs++;
break;
case 3:
@@ -316,12 +283,8 @@
outputInstructionFormat3(&I, Opcode, Table, Slots, Type, Out);
return;
}
- if (Type >= (1 << 6))
- NumOversidedBecauseOfTypes++;
- NumOversized3OpInstrs++;
break;
default:
- ++NumHugeOperandInstrs;
break;
}
Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.60 llvm/lib/Bytecode/Writer/Writer.cpp:1.61
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.60 Mon Jan 19 18:54:06 2004
+++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Jan 31 19:50:31 2004
@@ -38,18 +38,6 @@
static Statistic<>
BytesWritten("bytecodewriter", "Number of bytecode bytes written");
-static Statistic<>
-ConstantTotalBytes("bytecodewriter", "Bytes of constants total");
-static Statistic<>
-ConstantPlaneHeaderBytes("bytecodewriter", "Constant plane header bytes");
-static Statistic<>
-InstructionBytes("bytecodewriter", "Bytes of instructions");
-static Statistic<>
-SymTabBytes("bytecodewriter", "Bytes of symbol table");
-static Statistic<>
-ModuleInfoBytes("bytecodewriter", "Bytes of module info");
-static Statistic<>
-CompactionTableBytes("bytecodewriter", "Bytes of compaction tables");
BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
: Out(o), Table(M, true) {
@@ -125,8 +113,6 @@
// FIXME: Most slabs only have 1 or 2 entries! We should encode this much
// more compactly.
- ConstantPlaneHeaderBytes -= Out.size();
-
// Output type header: [num entries][type id number]
//
output_vbr(NC, Out);
@@ -136,9 +122,6 @@
assert (Slot != -1 && "Type in constant pool but not in function!!");
output_vbr((unsigned)Slot, Out);
- ConstantPlaneHeaderBytes += Out.size();
-
-
//cerr << "Emitting " << NC << " constants of type '"
// << Plane.front()->getType()->getName() << "' = Slot #" << Slot << "\n";
@@ -160,7 +143,6 @@
}
void BytecodeWriter::outputConstants(bool isFunction) {
- ConstantTotalBytes -= Out.size(); {
BytecodeBlock CPool(BytecodeFormat::ConstantPool, Out,
true /* Elide block if empty */);
@@ -197,7 +179,6 @@
outputConstantsInPlane(Plane, ValNo);
}
}
- }ConstantTotalBytes += Out.size();
}
static unsigned getEncodedLinkage(const GlobalValue *GV) {
@@ -212,8 +193,6 @@
}
void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
- ModuleInfoBytes -= Out.size();
-
BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfo, Out);
// Output the types for the global variables in the module...
@@ -244,17 +223,13 @@
output_vbr((unsigned)Slot, Out);
}
output_vbr((unsigned)Table.getSlot(Type::VoidTy), Out);
-
- ModuleInfoBytes += Out.size();
}
void BytecodeWriter::outputInstructions(const Function *F) {
BytecodeBlock ILBlock(BytecodeFormat::InstructionList, Out);
- InstructionBytes -= Out.size();
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; ++I)
outputInstruction(*I);
- InstructionBytes += Out.size();
}
void BytecodeWriter::outputFunction(const Function *F) {
@@ -316,7 +291,6 @@
}
void BytecodeWriter::outputCompactionTable() {
- CompactionTableBytes -= Out.size(); {
BytecodeBlock CTB(BytecodeFormat::CompactionTable, Out, true/*ElideIfEmpty*/);
const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable();
@@ -328,7 +302,6 @@
for (unsigned i = 0, e = CT.size(); i != e; ++i)
if (i != Type::TypeTyID)
outputCompactionTablePlane(i, CT[i], 0);
- } CompactionTableBytes += Out.size();
}
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
@@ -336,8 +309,6 @@
// space!
if (MST.begin() == MST.end()) return;
- SymTabBytes -= Out.size(); {
-
BytecodeBlock SymTabBlock(BytecodeFormat::SymbolTable, Out,
true/* ElideIfEmpty*/);
@@ -365,8 +336,6 @@
output(I->first, Out, false); // Don't force alignment...
}
}
-
- }SymTabBytes += Out.size();
}
void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) {
More information about the llvm-commits
mailing list