OLD | NEW |
(Empty) | |
| 1 //===- NaClBitcodeBitsDist.cpp ----------------------------------*- C++ -*-===// |
| 2 // Implements distributions of values with the corresponding number |
| 3 // of bits in PNaCl bitcode. |
| 4 // |
| 5 // The LLVM Compiler Infrastructure |
| 6 // |
| 7 // This file is distributed under the University of Illinois Open Source |
| 8 // License. See LICENSE.TXT for details. |
| 9 // |
| 10 //===----------------------------------------------------------------------===// |
| 11 |
| 12 #include "llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h" |
| 13 |
| 14 using namespace llvm; |
| 15 |
| 16 NaClBitcodeBitsDistElement::~NaClBitcodeBitsDistElement() {} |
| 17 |
| 18 void NaClBitcodeBitsDistElement::AddRecord(const NaClBitcodeRecord &Record) { |
| 19 NaClBitcodeDistElement::AddRecord(Record); |
| 20 TotalBits += Record.GetNumBits(); |
| 21 } |
| 22 |
| 23 void NaClBitcodeBitsDistElement::AddBlock(const NaClBitcodeBlock &Block) { |
| 24 NaClBitcodeDistElement::AddBlock(Block); |
| 25 TotalBits += Block.GetLocalNumBits(); |
| 26 } |
| 27 |
| 28 void NaClBitcodeBitsDistElement::PrintStatsHeader(raw_ostream &Stream) const { |
| 29 NaClBitcodeDistElement::PrintStatsHeader(Stream); |
| 30 Stream << " # Bits Bits/Elmt"; |
| 31 } |
| 32 |
| 33 void NaClBitcodeBitsDistElement:: |
| 34 PrintRowStats(raw_ostream &Stream, |
| 35 const NaClBitcodeDist *Distribution) const { |
| 36 NaClBitcodeDistElement::PrintRowStats(Stream, Distribution); |
| 37 Stream << format(" %9lu %12.2f", |
| 38 (unsigned long) GetTotalBits(), |
| 39 (double) GetTotalBits()/GetNumInstances()); |
| 40 } |
OLD | NEW |