Remove all of the annoying statistics now that I'm finished (for the near

term) working on bytecode size stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11046 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-02-01 01:50:31 +00:00
parent 4f67b86648
commit fff663b47a
3 changed files with 0 additions and 89 deletions

View File

@ -19,21 +19,11 @@
#include "Support/Statistic.h" #include "Support/Statistic.h"
using namespace llvm; 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) { void BytecodeWriter::outputType(const Type *T) {
TypeBytes -= Out.size();
output_vbr((unsigned)T->getPrimitiveID(), Out); output_vbr((unsigned)T->getPrimitiveID(), Out);
// That's all there is to handling primitive types... // That's all there is to handling primitive types...
if (T->isPrimitiveType()) { if (T->isPrimitiveType()) {
TypeBytes += Out.size();
return; // We might do this if we alias a prim type: %x = type int return; // We might do this if we alias a prim type: %x = type int
} }
@ -107,16 +97,12 @@ void BytecodeWriter::outputType(const Type *T) {
<< " Type '" << T->getDescription() << "'\n"; << " Type '" << T->getDescription() << "'\n";
break; break;
} }
TypeBytes += Out.size();
} }
void BytecodeWriter::outputConstant(const Constant *CPV) { void BytecodeWriter::outputConstant(const Constant *CPV) {
ConstantBytes -= Out.size();
assert((CPV->getType()->isPrimitiveType() || !CPV->isNullValue()) && assert((CPV->getType()->isPrimitiveType() || !CPV->isNullValue()) &&
"Shouldn't output null constants!"); "Shouldn't output null constants!");
++NumConstants;
// We must check for a ConstantExpr before switching by type because // We must check for a ConstantExpr before switching by type because
// a ConstantExpr can be of any type, and has no explicit value. // a ConstantExpr can be of any type, and has no explicit value.
// //
@ -133,7 +119,6 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
Slot = Table.getSlot((*OI)->getType()); Slot = Table.getSlot((*OI)->getType());
output_vbr((unsigned)Slot, Out); output_vbr((unsigned)Slot, Out);
} }
ConstantBytes += Out.size();
return; return;
} else { } else {
output_vbr(0U, Out); // flag as not a ConstantExpr output_vbr(0U, Out); // flag as not a ConstantExpr
@ -211,7 +196,6 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
<< " type '" << CPV->getType()->getName() << "'\n"; << " type '" << CPV->getType()->getName() << "'\n";
break; break;
} }
ConstantBytes += Out.size();
return; return;
} }
@ -225,8 +209,6 @@ void BytecodeWriter::outputConstantStrings() {
output_vbr(unsigned(E-I), Out); output_vbr(unsigned(E-I), Out);
output_vbr(Type::VoidTyID, Out); output_vbr(Type::VoidTyID, Out);
ConstantBytes -= Out.size();
// Emit all of the strings. // Emit all of the strings.
for (I = Table.string_begin(); I != E; ++I) { for (I = Table.string_begin(); I != E; ++I) {
const ConstantArray *Str = *I; const ConstantArray *Str = *I;
@ -238,8 +220,5 @@ void BytecodeWriter::outputConstantStrings() {
// emit all of the characters. // emit all of the characters.
std::string Val = Str->getAsString(); std::string Val = Str->getAsString();
output_data(Val.c_str(), Val.c_str()+Val.size(), Out); output_data(Val.c_str(), Val.c_str()+Val.size(), Out);
++NumConstants;
} }
ConstantBytes += Out.size();
} }

View File

@ -20,26 +20,6 @@
#include <algorithm> #include <algorithm>
using namespace llvm; 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; typedef unsigned char uchar;
// outputInstructionFormat0 - Output those wierd instructions that have a large // outputInstructionFormat0 - Output those wierd instructions that have a large
@ -50,9 +30,6 @@ typedef unsigned char uchar;
static void outputInstructionFormat0(const Instruction *I, unsigned Opcode, static void outputInstructionFormat0(const Instruction *I, unsigned Opcode,
const SlotCalculator &Table, const SlotCalculator &Table,
unsigned Type, std::deque<uchar> &Out) { unsigned Type, std::deque<uchar> &Out) {
NumOversizedInstrs++;
BytesOversizedInstrs -= Out.size();
// Opcode must have top two bits clear... // Opcode must have top two bits clear...
output_vbr(Opcode << 2, Out); // Instruction Opcode ID output_vbr(Opcode << 2, Out); // Instruction Opcode ID
output_vbr(Type, Out); // Result type output_vbr(Type, Out); // Result type
@ -78,7 +55,6 @@ static void outputInstructionFormat0(const Instruction *I, unsigned Opcode,
} }
align32(Out); // We must maintain correct alignment! align32(Out); // We must maintain correct alignment!
BytesOversizedInstrs += Out.size();
} }
@ -281,8 +257,6 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
} }
} }
++NumInstrs;
// Decide which instruction encoding to use. This is determined primarily by // Decide which instruction encoding to use. This is determined primarily by
// the number of operands, and secondarily by whether or not the max operand // the number of operands, and secondarily by whether or not the max operand
// will fit into the instruction encoding. More operands == fewer bits per // will fit into the instruction encoding. More operands == fewer bits per
@ -295,10 +269,6 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
outputInstructionFormat1(&I, Opcode, Table, Slots, Type, Out); outputInstructionFormat1(&I, Opcode, Table, Slots, Type, Out);
return; return;
} }
if (Type >= (1 << 12)-1)
NumOversidedBecauseOfTypes++;
NumOversized1OpInstrs++;
break; break;
case 2: case 2:
@ -306,9 +276,6 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
outputInstructionFormat2(&I, Opcode, Table, Slots, Type, Out); outputInstructionFormat2(&I, Opcode, Table, Slots, Type, Out);
return; return;
} }
if (Type >= (1 << 8))
NumOversidedBecauseOfTypes++;
NumOversized2OpInstrs++;
break; break;
case 3: case 3:
@ -316,12 +283,8 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
outputInstructionFormat3(&I, Opcode, Table, Slots, Type, Out); outputInstructionFormat3(&I, Opcode, Table, Slots, Type, Out);
return; return;
} }
if (Type >= (1 << 6))
NumOversidedBecauseOfTypes++;
NumOversized3OpInstrs++;
break; break;
default: default:
++NumHugeOperandInstrs;
break; break;
} }

View File

@ -38,18 +38,6 @@ static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer");
static Statistic<> static Statistic<>
BytesWritten("bytecodewriter", "Number of bytecode bytes written"); 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) BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
: Out(o), Table(M, true) { : Out(o), Table(M, true) {
@ -125,8 +113,6 @@ void BytecodeWriter::outputConstantsInPlane(const std::vector<const Value*>
// FIXME: Most slabs only have 1 or 2 entries! We should encode this much // FIXME: Most slabs only have 1 or 2 entries! We should encode this much
// more compactly. // more compactly.
ConstantPlaneHeaderBytes -= Out.size();
// Output type header: [num entries][type id number] // Output type header: [num entries][type id number]
// //
output_vbr(NC, Out); output_vbr(NC, Out);
@ -136,9 +122,6 @@ void BytecodeWriter::outputConstantsInPlane(const std::vector<const Value*>
assert (Slot != -1 && "Type in constant pool but not in function!!"); assert (Slot != -1 && "Type in constant pool but not in function!!");
output_vbr((unsigned)Slot, Out); output_vbr((unsigned)Slot, Out);
ConstantPlaneHeaderBytes += Out.size();
//cerr << "Emitting " << NC << " constants of type '" //cerr << "Emitting " << NC << " constants of type '"
// << Plane.front()->getType()->getName() << "' = Slot #" << Slot << "\n"; // << Plane.front()->getType()->getName() << "' = Slot #" << Slot << "\n";
@ -160,7 +143,6 @@ static inline bool hasNullValue(unsigned TyID) {
} }
void BytecodeWriter::outputConstants(bool isFunction) { void BytecodeWriter::outputConstants(bool isFunction) {
ConstantTotalBytes -= Out.size(); {
BytecodeBlock CPool(BytecodeFormat::ConstantPool, Out, BytecodeBlock CPool(BytecodeFormat::ConstantPool, Out,
true /* Elide block if empty */); true /* Elide block if empty */);
@ -197,7 +179,6 @@ void BytecodeWriter::outputConstants(bool isFunction) {
outputConstantsInPlane(Plane, ValNo); outputConstantsInPlane(Plane, ValNo);
} }
} }
}ConstantTotalBytes += Out.size();
} }
static unsigned getEncodedLinkage(const GlobalValue *GV) { static unsigned getEncodedLinkage(const GlobalValue *GV) {
@ -212,8 +193,6 @@ static unsigned getEncodedLinkage(const GlobalValue *GV) {
} }
void BytecodeWriter::outputModuleInfoBlock(const Module *M) { void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
ModuleInfoBytes -= Out.size();
BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfo, Out); BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfo, Out);
// Output the types for the global variables in the module... // Output the types for the global variables in the module...
@ -244,17 +223,13 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
output_vbr((unsigned)Slot, Out); output_vbr((unsigned)Slot, Out);
} }
output_vbr((unsigned)Table.getSlot(Type::VoidTy), Out); output_vbr((unsigned)Table.getSlot(Type::VoidTy), Out);
ModuleInfoBytes += Out.size();
} }
void BytecodeWriter::outputInstructions(const Function *F) { void BytecodeWriter::outputInstructions(const Function *F) {
BytecodeBlock ILBlock(BytecodeFormat::InstructionList, Out); BytecodeBlock ILBlock(BytecodeFormat::InstructionList, Out);
InstructionBytes -= Out.size();
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) 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) for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; ++I)
outputInstruction(*I); outputInstruction(*I);
InstructionBytes += Out.size();
} }
void BytecodeWriter::outputFunction(const Function *F) { void BytecodeWriter::outputFunction(const Function *F) {
@ -316,7 +291,6 @@ void BytecodeWriter::outputCompactionTablePlane(unsigned PlaneNo,
} }
void BytecodeWriter::outputCompactionTable() { void BytecodeWriter::outputCompactionTable() {
CompactionTableBytes -= Out.size(); {
BytecodeBlock CTB(BytecodeFormat::CompactionTable, Out, true/*ElideIfEmpty*/); BytecodeBlock CTB(BytecodeFormat::CompactionTable, Out, true/*ElideIfEmpty*/);
const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable(); const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable();
@ -328,7 +302,6 @@ void BytecodeWriter::outputCompactionTable() {
for (unsigned i = 0, e = CT.size(); i != e; ++i) for (unsigned i = 0, e = CT.size(); i != e; ++i)
if (i != Type::TypeTyID) if (i != Type::TypeTyID)
outputCompactionTablePlane(i, CT[i], 0); outputCompactionTablePlane(i, CT[i], 0);
} CompactionTableBytes += Out.size();
} }
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
@ -336,8 +309,6 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
// space! // space!
if (MST.begin() == MST.end()) return; if (MST.begin() == MST.end()) return;
SymTabBytes -= Out.size(); {
BytecodeBlock SymTabBlock(BytecodeFormat::SymbolTable, Out, BytecodeBlock SymTabBlock(BytecodeFormat::SymbolTable, Out,
true/* ElideIfEmpty*/); true/* ElideIfEmpty*/);
@ -365,8 +336,6 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
output(I->first, Out, false); // Don't force alignment... output(I->first, Out, false); // Don't force alignment...
} }
} }
}SymTabBytes += Out.size();
} }
void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) { void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) {