Remove all of the annoying statistics now that I'm finished (for the near
authorChris Lattner <sabre@nondot.org>
Sun, 1 Feb 2004 01:50:31 +0000 (01:50 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 1 Feb 2004 01:50:31 +0000 (01:50 +0000)
term) working on bytecode size stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11046 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Writer/ConstantWriter.cpp
lib/Bytecode/Writer/InstructionWriter.cpp
lib/Bytecode/Writer/Writer.cpp

index 2b75b9b4a7955dc9cf28417a089263b97fcb2e30..6fe596872ea0bb1da2ac99c2d4f94e95c5e9d65d 100644 (file)
 #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();
 }
index b93a812d52c4e9980189dc503c76932f3c7252bc..4b845996bfb70404fb7dfe4ec8dbb89a75afb442 100644 (file)
 #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;
   }
 
index 7cdae163957fcd55f98f463fd1e4b2e7bb653099..432a39fb3308bf1cd9636338d65fca771a81851d 100644 (file)
@@ -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) {