aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-01 01:50:31 +0000
committerChris Lattner <sabre@nondot.org>2004-02-01 01:50:31 +0000
commitfff663b47a5da518bf1dc56f8f8748e19b9cb1f7 (patch)
tree38de2068d5f933cc662ee9778ea76f1eee8f6d1a /lib/Bytecode
parent4f67b8664889d9e93b452a9a5f099d41d1bd235a (diff)
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
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Writer/ConstantWriter.cpp21
-rw-r--r--lib/Bytecode/Writer/InstructionWriter.cpp37
-rw-r--r--lib/Bytecode/Writer/Writer.cpp31
3 files changed, 0 insertions, 89 deletions
diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp
index 2b75b9b4a7..6fe596872e 100644
--- a/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/lib/Bytecode/Writer/ConstantWriter.cpp
@@ -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 @@ void BytecodeWriter::outputType(const Type *T) {
<< " 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 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
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 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
<< " type '" << CPV->getType()->getName() << "'\n";
break;
}
- ConstantBytes += Out.size();
return;
}
@@ -225,8 +209,6 @@ void BytecodeWriter::outputConstantStrings() {
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 @@ void BytecodeWriter::outputConstantStrings() {
// 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();
}
diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp
index b93a812d52..4b845996bf 100644
--- a/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -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 @@ typedef unsigned char uchar;
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 @@ static void outputInstructionFormat0(const Instruction *I, unsigned Opcode,
}
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
// 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 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
outputInstructionFormat1(&I, Opcode, Table, Slots, Type, Out);
return;
}
- if (Type >= (1 << 12)-1)
- NumOversidedBecauseOfTypes++;
-
- NumOversized1OpInstrs++;
break;
case 2:
@@ -306,9 +276,6 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
outputInstructionFormat2(&I, Opcode, Table, Slots, Type, Out);
return;
}
- if (Type >= (1 << 8))
- NumOversidedBecauseOfTypes++;
- NumOversized2OpInstrs++;
break;
case 3:
@@ -316,12 +283,8 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
outputInstructionFormat3(&I, Opcode, Table, Slots, Type, Out);
return;
}
- if (Type >= (1 << 6))
- NumOversidedBecauseOfTypes++;
- NumOversized3OpInstrs++;
break;
default:
- ++NumHugeOperandInstrs;
break;
}
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 7cdae16395..432a39fb33 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -38,18 +38,6 @@ static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer");
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 @@ void BytecodeWriter::outputConstantsInPlane(const std::vector<const Value*>
// 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 @@ void BytecodeWriter::outputConstantsInPlane(const std::vector<const Value*>
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 @@ static inline bool hasNullValue(unsigned TyID) {
}
void BytecodeWriter::outputConstants(bool isFunction) {
- ConstantTotalBytes -= Out.size(); {
BytecodeBlock CPool(BytecodeFormat::ConstantPool, Out,
true /* Elide block if empty */);
@@ -197,7 +179,6 @@ void BytecodeWriter::outputConstants(bool isFunction) {
outputConstantsInPlane(Plane, ValNo);
}
}
- }ConstantTotalBytes += Out.size();
}
static unsigned getEncodedLinkage(const GlobalValue *GV) {
@@ -212,8 +193,6 @@ static unsigned getEncodedLinkage(const GlobalValue *GV) {
}
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 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
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::outputCompactionTablePlane(unsigned PlaneNo,
}
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 @@ void BytecodeWriter::outputCompactionTable() {
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 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
// space!
if (MST.begin() == MST.end()) return;
- SymTabBytes -= Out.size(); {
-
BytecodeBlock SymTabBlock(BytecodeFormat::SymbolTable, Out,
true/* ElideIfEmpty*/);
@@ -365,8 +336,6 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
output(I->first, Out, false); // Don't force alignment...
}
}
-
- }SymTabBytes += Out.size();
}
void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) {