OLD | NEW |
(Empty) | |
| 1 //===-- NaClBitcodeSizeDist.cpp --------------------------------------------===/
/ |
| 2 // Implements distribution maps for value record sizes associated with |
| 3 // bitcode records. |
| 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/NaClBitcodeSizeDist.h" |
| 13 |
| 14 using namespace llvm; |
| 15 |
| 16 NaClBitcodeSizeDistElement::~NaClBitcodeSizeDistElement() {} |
| 17 |
| 18 NaClBitcodeDistElement *NaClBitcodeSizeDistElement::CreateElement( |
| 19 NaClBitcodeDistValue Value) const { |
| 20 return new NaClBitcodeSizeDistElement(); |
| 21 } |
| 22 |
| 23 void NaClBitcodeSizeDistElement:: |
| 24 GetValueList(const NaClBitcodeRecord &Record, |
| 25 ValueListType &ValueList) const { |
| 26 unsigned Size = Record.GetValues().size(); |
| 27 // Map all sizes greater than the max value index into the same bucket. |
| 28 if (Size > NaClValueIndexCutoff) Size = NaClValueIndexCutoff; |
| 29 ValueList.push_back(Size); |
| 30 } |
| 31 |
| 32 void NaClBitcodeSizeDistElement::AddRecord(const NaClBitcodeRecord &Record) { |
| 33 NaClBitcodeDistElement::AddRecord(Record); |
| 34 ValueIndexDist.AddRecord(Record); |
| 35 } |
| 36 |
| 37 const SmallVectorImpl<NaClBitcodeDist*> *NaClBitcodeSizeDistElement:: |
| 38 GetNestedDistributions() const { |
| 39 return &NestedDists; |
| 40 } |
| 41 |
| 42 const char *NaClBitcodeSizeDistElement::GetTitle() const { |
| 43 return "Record sizes"; |
| 44 } |
| 45 |
| 46 const char *NaClBitcodeSizeDistElement::GetValueHeader() const { |
| 47 return " Size"; |
| 48 } |
| 49 |
| 50 void NaClBitcodeSizeDistElement:: |
| 51 PrintRowValue(raw_ostream &Stream, |
| 52 NaClBitcodeDistValue Value, |
| 53 const NaClBitcodeDist *Distribution) const { |
| 54 Stream << format("%7u", Value); |
| 55 // Report if we merged in GetValueList. |
| 56 if (Value >= NaClValueIndexCutoff) Stream << "+"; |
| 57 } |
| 58 |
| 59 NaClBitcodeSizeDistElement NaClBitcodeSizeDistElement::Sentinel; |
OLD | NEW |