OLD | NEW |
(Empty) | |
| 1 //===-- NaClBitcodeSizeDist.h ---------------------------------------------===// |
| 2 // Defines distribution maps for bitcode record sizes (arity). |
| 3 // |
| 4 // The LLVM Compiler Infrastructure |
| 5 // |
| 6 // This file is distributed under the University of Illinois Open Source |
| 7 // License. See LICENSE.TXT for details. |
| 8 // |
| 9 //===----------------------------------------------------------------------===// |
| 10 // |
| 11 // Defines distribution maps for tracking bitcode record sizes |
| 12 // (arity). |
| 13 |
| 14 #ifndef LLVM_BITCODE_NACL_NACLBITCODESIZEDIST_H |
| 15 #define LLVM_BITCODE_NACL_NACLBITCODESIZEDIST_H |
| 16 |
| 17 #include "llvm/Bitcode/NaCl/NaClBitcodeDist.h" |
| 18 #include "llvm/Bitcode/NaCl/NaClBitcodeValueDist.h" |
| 19 |
| 20 namespace llvm { |
| 21 |
| 22 /// Collects the number of bitcode record instances with the same number |
| 23 /// of elements in the vector of values, with nested value distribution maps. |
| 24 class NaClBitcodeSizeDistElement : public NaClBitcodeDistElement { |
| 25 NaClBitcodeSizeDistElement(const NaClBitcodeSizeDistElement&) |
| 26 LLVM_DELETED_FUNCTION; |
| 27 void operator=(const NaClBitcodeSizeDistElement&) LLVM_DELETED_FUNCTION; |
| 28 |
| 29 public: |
| 30 static bool classof(const NaClBitcodeDistElement *Element) { |
| 31 return Element->getKind() >= RDE_SizeDist && |
| 32 Element->getKind() < RDE_SizeDistLast; |
| 33 } |
| 34 |
| 35 NaClBitcodeSizeDistElement() |
| 36 : NaClBitcodeDistElement(RDE_SizeDist), |
| 37 ValueIndexDist(NaClBitcodeDist::RecordStorage, |
| 38 &NaClBitcodeValueIndexDistElement::Sentinel) { |
| 39 NestedDists.push_back(&ValueIndexDist); |
| 40 } |
| 41 |
| 42 static NaClBitcodeSizeDistElement Sentinel; |
| 43 |
| 44 virtual ~NaClBitcodeSizeDistElement(); |
| 45 |
| 46 virtual NaClBitcodeDistElement *CreateElement( |
| 47 NaClBitcodeDistValue Value) const; |
| 48 |
| 49 virtual void GetValueList(const NaClBitcodeRecord &Record, |
| 50 ValueListType &ValueList) const; |
| 51 |
| 52 virtual void AddRecord(const NaClBitcodeRecord &Record); |
| 53 |
| 54 virtual const SmallVectorImpl<NaClBitcodeDist*> * |
| 55 GetNestedDistributions() const; |
| 56 |
| 57 virtual const char *GetTitle() const; |
| 58 |
| 59 virtual const char *GetValueHeader() const; |
| 60 |
| 61 virtual void PrintRowValue(raw_ostream &Stream, |
| 62 NaClBitcodeDistValue Value, |
| 63 const NaClBitcodeDist *Distribution) const; |
| 64 |
| 65 NaClBitcodeDist &GetValueIndexDist() { |
| 66 return ValueIndexDist; |
| 67 } |
| 68 |
| 69 private: |
| 70 // Nested blocks used by GetNestedDistributions. |
| 71 SmallVector<NaClBitcodeDist*, 1> NestedDists; |
| 72 |
| 73 // The value distributions associated with records of the given size. |
| 74 NaClBitcodeDist ValueIndexDist; |
| 75 }; |
| 76 |
| 77 } |
| 78 |
| 79 #endif |
OLD | NEW |