Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 //===- NaClBitcodeBitsAndAbbrevsDist.h --------------------*- C++ -*-===//
2 // Maps distributions of values with corresponding number of bits,
3 // and percentage of abbreviations used in PNaCl 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 // Creates a distribution map of values and the
13 // correspdonding bits and abbreviations in PNaCl bitcode records.
14
15 #ifndef LLVM_BITCODE_NACL_NACLBITCODEBITSANDABBREVSDIST_H
16 #define LLVM_BITCODE_NACL_NACLBITCODEBITSANDABBREVSDIST_H
17
18 #include "llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h"
19
20 namespace llvm {
21
22 /// Defines the element type of a PNaCl bitcode distribution map when
23 /// we want to count both the number of instances, and the number of
24 /// bits used by each record. Also tracks the number to times an
25 /// abbreviation was used to parse the corresponding record.
26 class NaClBitcodeBitsAndAbbrevsDistElement : public NaClBitcodeBitsDistElement {
27 NaClBitcodeBitsAndAbbrevsDistElement(
28 const NaClBitcodeBitsAndAbbrevsDistElement&) LLVM_DELETED_FUNCTION;
29 void operator=(const NaClBitcodeBitsAndAbbrevsDistElement&)
30 LLVM_DELETED_FUNCTION;
31
32 public:
33 static bool classof(const NaClBitcodeDistElement *Dist) {
34 return Dist->getKind() >= RDE_BitsAndAbbrevsDist
35 && Dist->getKind() < RDE_BitsAndAbbrevsDistLast;
36 }
37
38 // Create an element with no instances.
39 explicit NaClBitcodeBitsAndAbbrevsDistElement(
40 NaClBitcodeDistElementKind Kind=RDE_BitsAndAbbrevsDist)
41 : NaClBitcodeBitsDistElement(Kind),
42 NumAbbrevs(0)
43 {}
44
45 virtual ~NaClBitcodeBitsAndAbbrevsDistElement();
46
47 virtual void AddRecord(const NaClBitcodeRecord &Record);
48
49 // Note: No AddBlock method override because abbrevations only
50 // apply to records.
51
52 // Returns the number of times an abbreviation was used to represent
53 // the value.
54 unsigned GetNumAbbrevs() const {
55 return NumAbbrevs;
56 }
57
58 virtual void PrintStatsHeader(raw_ostream &Stream) const;
59
60 virtual void PrintRowStats(raw_ostream &Stream,
61 const NaClBitcodeDist *Distribution) const;
62
63 private:
64 // Number of times an abbreviation is used for the value.
65 unsigned NumAbbrevs;
66 };
67
68 }
69
70 #endif
OLDNEW
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeAnalyzer.h ('k') | include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698