OLD | NEW |
(Empty) | |
| 1 //===-- NaClCompressCodeDist.h -------------------------------------------===// |
| 2 // Defines distribution maps for record codes for pnacl-bccompress. |
| 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 #ifndef LLVM_BITCODE_NACL_NACLCOMPRESSCODEDIST_H |
| 12 #define LLVM_BITCODE_NACL_NACLCOMPRESSCODEDIST_H |
| 13 |
| 14 #include "llvm/Bitcode/NaCl/NaClBitcodeCodeDist.h" |
| 15 #include "llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h" |
| 16 |
| 17 namespace llvm { |
| 18 |
| 19 /// Defines a record code distribution, with nested distributions separating |
| 20 /// the code distributions based on size and values. |
| 21 class NaClCompressCodeDistElement : public NaClBitcodeCodeDistElement { |
| 22 public: |
| 23 static bool classof(const NaClBitcodeDistElement *Element) { |
| 24 return Element->getKind() >= RDE_CompressCodeDist && |
| 25 Element->getKind() < RDE_CompressCodeDistLast; |
| 26 } |
| 27 |
| 28 NaClCompressCodeDistElement() |
| 29 : NaClBitcodeCodeDistElement(RDE_CompressCodeDist), |
| 30 SizeDist(NaClBitcodeDist::RecordStorage, |
| 31 &NaClBitcodeSizeDistElement::Sentinel) { |
| 32 NestedDists.push_back(&SizeDist); |
| 33 } |
| 34 |
| 35 virtual ~NaClCompressCodeDistElement(); |
| 36 |
| 37 virtual NaClBitcodeDistElement *CreateElement( |
| 38 NaClBitcodeDistValue Value) const; |
| 39 |
| 40 virtual void AddRecord(const NaClBitcodeRecord &Record); |
| 41 |
| 42 virtual const SmallVectorImpl<NaClBitcodeDist*> * |
| 43 GetNestedDistributions() const; |
| 44 |
| 45 NaClBitcodeDist &GetSizeDist() { |
| 46 return SizeDist; |
| 47 } |
| 48 |
| 49 /// The sentinel used to generate instances of this in |
| 50 /// a record code distribution map. |
| 51 static NaClCompressCodeDistElement Sentinel; |
| 52 |
| 53 private: |
| 54 // Nested blocks used by GetNestedDistributions. |
| 55 SmallVector<NaClBitcodeDist*, 1> NestedDists; |
| 56 |
| 57 /// The distribution of values, based on size. |
| 58 NaClBitcodeDist SizeDist; |
| 59 }; |
| 60 |
| 61 } |
| 62 |
| 63 #endif |
OLD | NEW |