bc1f0c74cdde80fe0e2f9a4504d205001998dc14
[oota-llvm.git] / lib / Bytecode / Reader / Analyzer.cpp
1 //===-- Analyzer.cpp - Analysis and Dumping of Bytecode 000000---*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the 
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file implements the AnalyzerHandler class and PrintBytecodeAnalysis
11 //  function which together comprise the basic functionality of the llmv-abcd
12 //  tool. The AnalyzerHandler collects information about the bytecode file into
13 //  the BytecodeAnalysis structure. The PrintBytecodeAnalysis function prints
14 //  out the content of that structure.
15 //  @see include/llvm/Bytecode/Analysis.h
16 //
17 //===----------------------------------------------------------------------===//
18
19 #include "Reader.h"
20 #include "llvm/Constants.h"
21 #include "llvm/DerivedTypes.h"
22 #include "llvm/Module.h"
23 #include "llvm/Analysis/Verifier.h"
24 #include "llvm/Bytecode/BytecodeHandler.h"
25 #include <iomanip>
26 #include <sstream>
27
28 using namespace llvm;
29
30 namespace {
31
32 /// @brief Bytecode reading handler for analyzing bytecode.
33 class AnalyzerHandler : public BytecodeHandler {
34   BytecodeAnalysis& bca;     ///< The structure in which data is recorded
35   std::ostringstream dump;   ///< A convenience for dumping data.
36   /// @brief Keeps track of current function
37   BytecodeAnalysis::BytecodeFunctionInfo* currFunc; 
38   Module* M; ///< Keeps track of current module
39
40 /// @name Constructor
41 /// @{
42 public:
43   /// The only way to construct an AnalyzerHandler. All that is needed is a
44   /// reference to the BytecodeAnalysis structure where the output will be
45   /// placed.
46   AnalyzerHandler(BytecodeAnalysis& TheBca) 
47     : bca(TheBca) 
48     , dump()
49     , currFunc(0)
50     { }  
51
52 /// @}
53 /// @name BytecodeHandler Implementations
54 /// @{
55 public:
56   virtual void handleError(const std::string& str ) { 
57     dump << "ERROR: " << str << "\n";
58     bca.BytecodeDump = dump.str() ;
59   }
60
61   virtual void handleStart( Module* Mod, unsigned theSize ) {
62     M = Mod;
63     dump << "Bytecode {\n";
64     bca.byteSize = theSize;
65     bca.ModuleId.clear();
66     bca.numBlocks = 0;
67     bca.numTypes = 0;
68     bca.numValues = 0;
69     bca.numFunctions = 0;
70     bca.numConstants = 0;
71     bca.numGlobalVars = 0;
72     bca.numInstructions = 0;
73     bca.numBasicBlocks = 0;
74     bca.numOperands = 0;
75     bca.numCmpctnTables = 0;
76     bca.numSymTab = 0;
77     bca.maxTypeSlot = 0;
78     bca.maxValueSlot = 0;
79     bca.numAlignment = 0;
80     bca.fileDensity = 0.0;
81     bca.globalsDensity = 0.0;
82     bca.functionDensity = 0.0;
83     bca.instructionSize = 0;
84     bca.longInstructions = 0;
85     bca.vbrCount32 = 0;
86     bca.vbrCount64 = 0;
87     bca.vbrCompBytes = 0;
88     bca.vbrExpdBytes = 0;
89     bca.FunctionInfo.clear();
90     bca.BytecodeDump.clear();
91     bca.BlockSizes[BytecodeFormat::Module] = 0;
92     bca.BlockSizes[BytecodeFormat::Function] = 0;
93     bca.BlockSizes[BytecodeFormat::ConstantPool] = 0;
94     bca.BlockSizes[BytecodeFormat::SymbolTable] = 0;
95     bca.BlockSizes[BytecodeFormat::ModuleGlobalInfo] = 0;
96     bca.BlockSizes[BytecodeFormat::GlobalTypePlane] = 0;
97     bca.BlockSizes[BytecodeFormat::BasicBlock] = 0;
98     bca.BlockSizes[BytecodeFormat::InstructionList] = 0;
99     bca.BlockSizes[BytecodeFormat::CompactionTable] = 0;
100   }
101
102   virtual void handleFinish() {
103     dump << "} End Bytecode\n"; 
104     bca.BytecodeDump = dump.str() ;
105
106     bca.fileDensity = double(bca.byteSize) / double( bca.numTypes + bca.numValues );
107     double globalSize = 0.0;
108     globalSize += double(bca.BlockSizes[BytecodeFormat::ConstantPool]);
109     globalSize += double(bca.BlockSizes[BytecodeFormat::ModuleGlobalInfo]);
110     globalSize += double(bca.BlockSizes[BytecodeFormat::GlobalTypePlane]);
111     bca.globalsDensity = globalSize / double( bca.numTypes + bca.numConstants + 
112       bca.numGlobalVars );
113     bca.functionDensity = double(bca.BlockSizes[BytecodeFormat::Function]) / 
114       double(bca.numFunctions);
115
116     if ( bca.progressiveVerify ) {
117       try {
118         verifyModule(*M, ThrowExceptionAction);
119       } catch ( std::string& msg ) {
120         bca.VerifyInfo += "Verify@Finish: " + msg + "\n";
121       }
122     }
123   }
124
125   virtual void handleModuleBegin(const std::string& id) {
126     dump << "  Module " << id << " {\n";
127     bca.ModuleId = id;
128   }
129
130   virtual void handleModuleEnd(const std::string& id) { 
131     dump << "  } End Module " << id << "\n";
132     if ( bca.progressiveVerify ) {
133       try {
134         verifyModule(*M, ThrowExceptionAction);
135       } catch ( std::string& msg ) {
136         bca.VerifyInfo += "Verify@EndModule: " + msg + "\n";
137       }
138     }
139   }
140
141   virtual void handleVersionInfo(
142     unsigned char RevisionNum,        ///< Byte code revision number
143     Module::Endianness Endianness,    ///< Endianness indicator
144     Module::PointerSize PointerSize   ///< PointerSize indicator
145   ) { 
146     dump << "    RevisionNum: " << int(RevisionNum) 
147          << " Endianness: " << Endianness
148          << " PointerSize: " << PointerSize << "\n";
149   }
150
151   virtual void handleModuleGlobalsBegin() { 
152     dump << "    BLOCK: ModuleGlobalInfo {\n";
153   }
154
155   virtual void handleGlobalVariable( 
156     const Type* ElemType,     
157     bool isConstant,          
158     GlobalValue::LinkageTypes Linkage,
159     unsigned SlotNum,
160     unsigned initSlot
161   ) {
162     bca.numGlobalVars++;
163     bca.numValues++;
164
165     dump << "      GV: "
166          << ( initSlot == 0 ? "Uni" : "I" ) << "nitialized, "
167          << ( isConstant? "Constant, " : "Variable, ")
168          << " Linkage=" << Linkage << " Type=" 
169          << ElemType->getDescription() 
170          << " Slot=" << SlotNum << " InitSlot=" << initSlot 
171          << "\n";
172   }
173
174   virtual void handleType( const Type* Ty ) { 
175     bca.numTypes++; 
176     dump << "      Type: " << Ty->getDescription() << "\n";
177   }
178
179   virtual void handleFunctionDeclaration( 
180     Function* Func            ///< The function
181   ) {
182     bca.numFunctions++;
183     bca.numValues++;
184     dump << "      Function Decl: " << Func->getType()->getDescription() << "\n";
185   }
186
187   virtual void handleGlobalInitializer(GlobalVariable* GV, Constant* CV) {
188     dump << "    Initializer: GV=";
189     GV->print(dump);
190     dump << "      CV=";
191     CV->print(dump);
192     dump << "\n";
193   }
194
195   virtual void handleModuleGlobalsEnd() { 
196     dump << "    } END BLOCK: ModuleGlobalInfo\n";
197     if ( bca.progressiveVerify ) {
198       try {
199         verifyModule(*M, ThrowExceptionAction);
200       } catch ( std::string& msg ) {
201         bca.VerifyInfo += "Verify@EndModuleGlobalInfo: " + msg + "\n";
202       }
203     }
204   }
205
206   virtual void handleCompactionTableBegin() { 
207     dump << "      BLOCK: CompactionTable {\n";
208   }
209
210   virtual void handleCompactionTablePlane( unsigned Ty, unsigned NumEntries) {
211     bca.numCmpctnTables++;
212     dump << "        Plane: Ty=" << Ty << " Size=" << NumEntries << "\n";
213   }
214
215   virtual void handleCompactionTableType( unsigned i, unsigned TypSlot, 
216       const Type* Ty ) {
217     dump << "          Type: " << i << " Slot:" << TypSlot 
218               << " is " << Ty->getDescription() << "\n"; 
219   }
220
221   virtual void handleCompactionTableValue(unsigned i, unsigned TypSlot,
222                                           unsigned ValSlot) { 
223     dump << "          Value: " << i << " TypSlot: " << TypSlot 
224          << " ValSlot:" << ValSlot << "\n";
225   }
226
227   virtual void handleCompactionTableEnd() { 
228     dump << "      } END BLOCK: CompactionTable\n";
229   }
230
231   virtual void handleSymbolTableBegin(Function* CF, SymbolTable* ST) { 
232     bca.numSymTab++; 
233     dump << "    BLOCK: SymbolTable {\n";
234   }
235
236   virtual void handleSymbolTablePlane(unsigned Ty, unsigned NumEntries, 
237     const Type* Typ) { 
238     dump << "      Plane: Ty=" << Ty << " Size=" << NumEntries
239          << " Type: " << Typ->getDescription() << "\n"; 
240   }
241
242   virtual void handleSymbolTableType(unsigned i, unsigned slot, 
243     const std::string& name ) { 
244     dump << "        Type " << i << " Slot=" << slot
245               << " Name: " << name << "\n"; 
246   }
247
248   virtual void handleSymbolTableValue(unsigned i, unsigned slot, 
249     const std::string& name ) { 
250     dump << "        Value " << i << " Slot=" << slot
251               << " Name: " << name << "\n";
252   }
253
254   virtual void handleSymbolTableEnd() { 
255     dump << "    } END BLOCK: SymbolTable\n";
256   }
257
258   virtual void handleFunctionBegin(Function* Func, unsigned Size) {
259     dump << "    BLOCK: Function {\n";
260     dump << "      Linkage: " << Func->getLinkage() << "\n";
261     dump << "      Type: " << Func->getType()->getDescription() << "\n";
262     const FunctionType* FType = 
263       cast<FunctionType>(Func->getType()->getElementType());
264     currFunc = &bca.FunctionInfo[Func];
265     currFunc->description = FType->getDescription();
266     currFunc->name = Func->getName();
267     currFunc->byteSize = Size;
268     currFunc->numInstructions = 0;
269     currFunc->numBasicBlocks = 0;
270     currFunc->numPhis = 0;
271     currFunc->numOperands = 0;
272     currFunc->density = 0.0;
273     currFunc->instructionSize = 0;
274     currFunc->longInstructions = 0;
275     currFunc->vbrCount32 = 0;
276     currFunc->vbrCount64 = 0;
277     currFunc->vbrCompBytes = 0;
278     currFunc->vbrExpdBytes = 0;
279
280   }
281
282   virtual void handleFunctionEnd( Function* Func) {
283     dump << "    } END BLOCK: Function\n";
284     currFunc->density = double(currFunc->byteSize) /
285       double(currFunc->numInstructions+currFunc->numBasicBlocks);
286
287     if ( bca.progressiveVerify ) {
288       try {
289         verifyModule(*M, ThrowExceptionAction);
290       } catch ( std::string& msg ) {
291         bca.VerifyInfo += "Verify@EndFunction: " + msg + "\n";
292       }
293     }
294   }
295
296   virtual void handleBasicBlockBegin( unsigned blocknum) {
297     dump << "      BLOCK: BasicBlock #" << blocknum << "{\n";
298     bca.numBasicBlocks++;
299     bca.numValues++;
300     if ( currFunc ) currFunc->numBasicBlocks++;
301   }
302
303   virtual bool handleInstruction( unsigned Opcode, const Type* iType, 
304                                 std::vector<unsigned>& Operands, unsigned Size){
305     dump << "        INST: OpCode=" 
306          << Instruction::getOpcodeName(Opcode) << " Type=\"" 
307          << iType->getDescription() << "\"";
308     for ( unsigned i = 0; i < Operands.size(); ++i ) 
309       dump << " Op(" << i << ")=Slot(" << Operands[i] << ")";
310     dump << "\n";
311
312     bca.numInstructions++;
313     bca.numValues++;
314     bca.instructionSize += Size;
315     if (Size > 4 ) bca.longInstructions++;
316     bca.numOperands += Operands.size();
317     if ( currFunc ) {
318       currFunc->numInstructions++;
319       currFunc->instructionSize += Size;
320       if (Size > 4 ) currFunc->longInstructions++;
321       if ( Opcode == Instruction::PHI ) currFunc->numPhis++;
322     }
323     return Instruction::isTerminator(Opcode); 
324   }
325
326   virtual void handleBasicBlockEnd(unsigned blocknum) { 
327     dump << "      } END BLOCK: BasicBlock #" << blocknum << "{\n";
328   }
329
330   virtual void handleGlobalConstantsBegin() { 
331     dump << "    BLOCK: GlobalConstants {\n";
332   }
333
334   virtual void handleConstantExpression( unsigned Opcode, 
335       std::vector<Constant*> ArgVec, Constant* C ) {
336     dump << "      EXPR: " << Instruction::getOpcodeName(Opcode) << "\n";
337     for ( unsigned i = 0; i < ArgVec.size(); ++i )  {
338       dump << "        Arg#" << i << " "; ArgVec[i]->print(dump); dump << "\n";
339     }
340     dump << "        Value=";
341     C->print(dump);
342     dump << "\n";
343     bca.numConstants++;
344     bca.numValues++;
345   }
346
347   virtual void handleConstantValue( Constant * c ) {
348     dump << "      VALUE: ";
349     c->print(dump);
350     dump << "\n";
351     bca.numConstants++;
352     bca.numValues++;
353   }
354
355   virtual void handleConstantArray( const ArrayType* AT, 
356           std::vector<Constant*>& Elements,
357           unsigned TypeSlot,
358           Constant* ArrayVal ) {
359     dump << "      ARRAY: " << AT->getDescription() 
360          << " TypeSlot=" << TypeSlot << "\n";
361     for ( unsigned i = 0; i < Elements.size(); ++i ) {
362       dump << "        #" << i;
363       Elements[i]->print(dump);
364       dump << "\n";
365     }
366     dump << "        Value=";
367     ArrayVal->print(dump);
368     dump << "\n";
369
370     bca.numConstants++;
371     bca.numValues++;
372   }
373
374   virtual void handleConstantStruct(
375         const StructType* ST,
376         std::vector<Constant*>& Elements,
377         Constant* StructVal)
378   {
379     dump << "      STRUC: " << ST->getDescription() << "\n";
380     for ( unsigned i = 0; i < Elements.size(); ++i ) {
381       dump << "        #" << i << " "; Elements[i]->print(dump); dump << "\n";
382     }
383     dump << "        Value=";
384     StructVal->print(dump);
385     dump << "\n";
386     bca.numConstants++;
387     bca.numValues++;
388   }
389
390   virtual void handleConstantPacked( 
391     const PackedType* PT,                
392     std::vector<Constant*>& Elements,
393     unsigned TypeSlot,                  
394     Constant* PackedVal) 
395   {
396     dump << "      PACKD: " << PT->getDescription() 
397          << " TypeSlot=" << TypeSlot << "\n";
398     for ( unsigned i = 0; i < Elements.size(); ++i ) {
399       dump << "        #" << i;
400       Elements[i]->print(dump);
401       dump << "\n";
402     }
403     dump << "        Value=";
404     PackedVal->print(dump);
405     dump << "\n";
406
407     bca.numConstants++;
408     bca.numValues++;
409   }
410
411   virtual void handleConstantPointer( const PointerType* PT, 
412       unsigned Slot, GlobalValue* GV ) {
413     dump << "       PNTR: " << PT->getDescription() 
414          << " Slot=" << Slot << " GlobalValue=";
415     GV->print(dump);
416     dump << "\n";
417     bca.numConstants++;
418     bca.numValues++;
419   }
420
421   virtual void handleConstantString( const ConstantArray* CA ) {
422     dump << "      STRNG: ";
423     CA->print(dump); 
424     dump << "\n";
425     bca.numConstants++;
426     bca.numValues++;
427   }
428
429   virtual void handleGlobalConstantsEnd() { 
430     dump << "    } END BLOCK: GlobalConstants\n";
431     if ( bca.progressiveVerify ) {
432       try {
433         verifyModule(*M, ThrowExceptionAction);
434       } catch ( std::string& msg ) {
435         bca.VerifyInfo += "Verify@EndGlobalConstants: " + msg + "\n";
436       }
437     }
438   }
439
440   virtual void handleAlignment(unsigned numBytes) {
441     bca.numAlignment += numBytes;
442   }
443
444   virtual void handleBlock(
445     unsigned BType, const unsigned char* StartPtr, unsigned Size) {
446     bca.numBlocks++;
447     bca.BlockSizes[llvm::BytecodeFormat::FileBlockIDs(BType)] += Size;
448   }
449
450   virtual void handleVBR32(unsigned Size ) {
451     bca.vbrCount32++;
452     bca.vbrCompBytes += Size;
453     bca.vbrExpdBytes += sizeof(uint32_t);
454     if (currFunc) {
455       currFunc->vbrCount32++;
456       currFunc->vbrCompBytes += Size;
457       currFunc->vbrExpdBytes += sizeof(uint32_t);
458     }
459   }
460
461   virtual void handleVBR64(unsigned Size ) {
462     bca.vbrCount64++;
463     bca.vbrCompBytes += Size;
464     bca.vbrExpdBytes += sizeof(uint64_t);
465     if ( currFunc ) {
466       currFunc->vbrCount64++;
467       currFunc->vbrCompBytes += Size;
468       currFunc->vbrExpdBytes += sizeof(uint64_t);
469     }
470   }
471 };
472
473
474 /// @brief Utility for printing a titled unsigned value with
475 /// an aligned colon.
476 inline static void print(std::ostream& Out, const char*title, 
477   unsigned val, bool nl = true ) {
478   Out << std::setw(30) << std::right << title 
479       << std::setw(0) << ": "
480       << std::setw(9) << val << "\n";
481 }
482
483 /// @brief Utility for printing a titled double value with an
484 /// aligned colon
485 inline static void print(std::ostream&Out, const char*title, 
486   double val ) {
487   Out << std::setw(30) << std::right << title 
488       << std::setw(0) << ": "
489       << std::setw(9) << std::setprecision(6) << val << "\n" ;
490 }
491
492 /// @brief Utility for printing a titled double value with a
493 /// percentage and aligned colon.
494 inline static void print(std::ostream&Out, const char*title, 
495   double top, double bot ) {
496   Out << std::setw(30) << std::right << title 
497       << std::setw(0) << ": "
498       << std::setw(9) << std::setprecision(6) << top 
499       << " (" << std::left << std::setw(0) << std::setprecision(4) 
500       << (top/bot)*100.0 << "%)\n";
501 }
502
503 /// @brief Utility for printing a titled string value with
504 /// an aligned colon.
505 inline static void print(std::ostream&Out, const char*title, 
506   std::string val, bool nl = true) {
507   Out << std::setw(30) << std::right << title 
508       << std::setw(0) << ": "
509       << std::left << val << (nl ? "\n" : "");
510 }
511
512 }
513
514 namespace llvm {
515
516 /// This function prints the contents of rhe BytecodeAnalysis structure in
517 /// a human legible form.
518 /// @brief Print BytecodeAnalysis structure to an ostream
519 void PrintBytecodeAnalysis(BytecodeAnalysis& bca, std::ostream& Out )
520 {
521   print(Out, "Bytecode Analysis Of Module",     bca.ModuleId);
522   print(Out, "File Size",                       bca.byteSize);
523   print(Out, "Number Of Bytecode Blocks",       bca.numBlocks);
524   print(Out, "Number Of Types",                 bca.numTypes);
525   print(Out, "Number Of Values",                bca.numValues);
526   print(Out, "Number Of Constants",             bca.numConstants);
527   print(Out, "Number Of Global Variables",      bca.numGlobalVars);
528   print(Out, "Number Of Functions",             bca.numFunctions);
529   print(Out, "Number Of Basic Blocks",          bca.numBasicBlocks);
530   print(Out, "Number Of Instructions",          bca.numInstructions);
531   print(Out, "Number Of Operands",              bca.numOperands);
532   print(Out, "Number Of Compaction Tables",     bca.numCmpctnTables);
533   print(Out, "Number Of Symbol Tables",         bca.numSymTab);
534   print(Out, "Long Instructions", bca.longInstructions);
535   print(Out, "Instruction Size", bca.instructionSize);
536   print(Out, "Average Instruction Size", 
537     double(bca.instructionSize)/double(bca.numInstructions));
538   print(Out, "Maximum Type Slot Number",        bca.maxTypeSlot);
539   print(Out, "Maximum Value Slot Number",       bca.maxValueSlot);
540   print(Out, "Bytes Thrown To Alignment",       double(bca.numAlignment), 
541     double(bca.byteSize));
542   print(Out, "File Density (bytes/def)",        bca.fileDensity);
543   print(Out, "Globals Density (bytes/def)",     bca.globalsDensity);
544   print(Out, "Function Density (bytes/func)",   bca.functionDensity);
545   print(Out, "Number of VBR 32-bit Integers",   bca.vbrCount32);
546   print(Out, "Number of VBR 64-bit Integers",   bca.vbrCount64);
547   print(Out, "Number of VBR Compressed Bytes",  bca.vbrCompBytes);
548   print(Out, "Number of VBR Expanded Bytes",    bca.vbrExpdBytes);
549   print(Out, "VBR Savings", 
550     double(bca.vbrExpdBytes)-double(bca.vbrCompBytes),
551     double(bca.vbrExpdBytes));
552
553   if ( bca.detailedResults ) {
554     print(Out, "Module Bytes",
555         double(bca.BlockSizes[BytecodeFormat::Module]),
556         double(bca.byteSize));
557     print(Out, "Function Bytes", 
558         double(bca.BlockSizes[BytecodeFormat::Function]),
559         double(bca.byteSize));
560     print(Out, "Constant Pool Bytes", 
561         double(bca.BlockSizes[BytecodeFormat::ConstantPool]),
562         double(bca.byteSize));
563     print(Out, "Symbol Table Bytes", 
564         double(bca.BlockSizes[BytecodeFormat::SymbolTable]),
565         double(bca.byteSize));
566     print(Out, "Module Global Info Bytes", 
567         double(bca.BlockSizes[BytecodeFormat::ModuleGlobalInfo]),
568         double(bca.byteSize));
569     print(Out, "Global Type Plane Bytes", 
570         double(bca.BlockSizes[BytecodeFormat::GlobalTypePlane]),
571         double(bca.byteSize));
572     print(Out, "Basic Block Bytes", 
573         double(bca.BlockSizes[BytecodeFormat::BasicBlock]),
574         double(bca.byteSize));
575     print(Out, "Instruction List Bytes", 
576         double(bca.BlockSizes[BytecodeFormat::InstructionList]),
577         double(bca.byteSize));
578     print(Out, "Compaction Table Bytes", 
579         double(bca.BlockSizes[BytecodeFormat::CompactionTable]),
580         double(bca.byteSize));
581
582     std::map<const Function*,BytecodeAnalysis::BytecodeFunctionInfo>::iterator I = 
583       bca.FunctionInfo.begin();
584     std::map<const Function*,BytecodeAnalysis::BytecodeFunctionInfo>::iterator E = 
585       bca.FunctionInfo.end();
586
587     while ( I != E ) {
588       Out << std::left << std::setw(0);
589       Out << "Function: " << I->second.name << "\n";
590       print(Out, "Type:", I->second.description);
591       print(Out, "Byte Size", I->second.byteSize);
592       print(Out, "Instructions", I->second.numInstructions);
593       print(Out, "Long Instructions", I->second.longInstructions);
594       print(Out, "Instruction Size", I->second.instructionSize);
595       print(Out, "Average Instruction Size", 
596         double(I->second.instructionSize)/double(I->second.numInstructions));
597       print(Out, "Basic Blocks", I->second.numBasicBlocks);
598       print(Out, "Operand", I->second.numOperands);
599       print(Out, "Function Density", I->second.density);
600       print(Out, "Number of VBR 32-bit Integers",   I->second.vbrCount32);
601       print(Out, "Number of VBR 64-bit Integers",   I->second.vbrCount64);
602       print(Out, "Number of VBR Compressed Bytes",  I->second.vbrCompBytes);
603       print(Out, "Number of VBR Expanded Bytes",    I->second.vbrExpdBytes);
604       print(Out, "VBR Savings", 
605         double(I->second.vbrExpdBytes)-double(I->second.vbrCompBytes),
606         double(I->second.vbrExpdBytes));
607       ++I;
608     }
609   }
610
611   if ( bca.dumpBytecode )
612     Out << bca.BytecodeDump;
613
614   if ( bca.progressiveVerify )
615     Out << bca.VerifyInfo;
616 }
617
618 BytecodeHandler* createBytecodeAnalyzerHandler(BytecodeAnalysis& bca)
619 {
620   return new AnalyzerHandler(bca);
621 }
622
623 }
624
625 // vim: sw=2