OLD | NEW |
(Empty) | |
| 1 //===-- NaClCompressBlockDist.h -------------------------------------------===// |
| 2 // Defines distribution maps used to collect block and record |
| 3 // distributions for tool pnacl-bccompress. |
| 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 #ifndef LLVM_BITCODE_NACL_NACLCOMPRESSBLOCKDIST_H |
| 13 #define LLVM_BITCODE_NACL_NACLCOMPRESSBLOCKDIST_H |
| 14 |
| 15 |
| 16 #include "llvm/Bitcode/NaCl/NaClBitcodeAbbrevDist.h" |
| 17 #include "llvm/Bitcode/NaCl/NaClBitcodeBlockDist.h" |
| 18 |
| 19 namespace llvm { |
| 20 |
| 21 /// Nests record distributions within the block they appear in, |
| 22 /// in a block distribution. The record distributions are refined |
| 23 /// by separating record codes that use the same abbreviation. |
| 24 class NaClCompressBlockDistElement : public NaClBitcodeBlockDistElement { |
| 25 public: |
| 26 static bool classof(const NaClBitcodeDistElement *Element) { |
| 27 return Element->getKind() >= RDE_PNaClCompressBlockDist |
| 28 && Element->getKind() < RDE_PNaClCompressBlockDistLast; |
| 29 } |
| 30 |
| 31 explicit NaClCompressBlockDistElement(unsigned BlockID=0) |
| 32 : NaClBitcodeBlockDistElement(RDE_PNaClCompressBlockDist), |
| 33 AbbrevDist(BlockID) { |
| 34 NestedDists.push_back(&AbbrevDist); |
| 35 } |
| 36 |
| 37 virtual ~NaClCompressBlockDistElement(); |
| 38 |
| 39 virtual NaClBitcodeDistElement* |
| 40 CreateElement(NaClBitcodeDistValue Value) const; |
| 41 |
| 42 virtual const SmallVectorImpl<NaClBitcodeDist*> * |
| 43 GetNestedDistributions() const; |
| 44 |
| 45 NaClBitcodeDist &GetAbbrevDist() { |
| 46 return AbbrevDist; |
| 47 } |
| 48 |
| 49 // Sentinel for generating elements of this type. |
| 50 static NaClCompressBlockDistElement Sentinel; |
| 51 |
| 52 private: |
| 53 // Nested blocks used by GetNestedDistributions. |
| 54 SmallVector<NaClBitcodeDist*, 1> NestedDists; |
| 55 |
| 56 // The abbreviations/records associated with the corresponding block. |
| 57 NaClBitcodeAbbrevDist AbbrevDist; |
| 58 }; |
| 59 |
| 60 } |
| 61 |
| 62 #endif |
OLD | NEW |