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

Side by Side Diff: include/llvm/Bitcode/NaCl/NaClBitcodeCodeDist.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 //===-- NaClBitcodeCodeDist.h ---------------------------------------------===//
2 // Defines distribution maps for various values in bitcode records.
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 simple (non-nested) distribution maps for record codes
12 // appearing in bitcode records (instances of class NaClBitcodeRecord
13 // in NaClBitcodeParser.h).
14
15 #ifndef LLVM_BITCODE_NACL_NACLBITCODECODEDIST_H
16 #define LLVM_BITCODE_NACL_NACLBITCODECODEDIST_H
17
18 #include "llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h"
19
20 namespace llvm {
21
22 // Collects the distribution of record codes/number of bits used for a
23 // particular blockID and Code ID.
24 class NaClBitcodeCodeDistElement
25 : public NaClBitcodeBitsAndAbbrevsDistElement {
26 NaClBitcodeCodeDistElement(const NaClBitcodeCodeDistElement&)
27 LLVM_DELETED_FUNCTION;
28 void operator=(const NaClBitcodeCodeDistElement&)
29 LLVM_DELETED_FUNCTION;
30
31 public:
32 static bool classof(const NaClBitcodeDistElement *Element) {
33 return Element->getKind() >= RDE_CodeDist
34 && Element->getKind() < RDE_CodeDistLast;
35 }
36
37 explicit NaClBitcodeCodeDistElement(
38 NaClBitcodeDistElementKind Kind=RDE_CodeDist)
39 : NaClBitcodeBitsAndAbbrevsDistElement(Kind)
40 {}
41
42 virtual ~NaClBitcodeCodeDistElement();
43
44 virtual NaClBitcodeDistElement *CreateElement(
45 NaClBitcodeDistValue Value) const;
46
47 virtual void GetValueList(const NaClBitcodeRecord &Record,
48 ValueListType &ValueList) const;
49
50 virtual const char *GetTitle() const;
51
52 virtual const char *GetValueHeader() const;
53
54 virtual void PrintRowValue(raw_ostream &Stream,
55 NaClBitcodeDistValue Value,
56 const NaClBitcodeDist *Distribution) const;
57 };
58
59 // Collects the distribution of record codes/number of bits used for a
60 // particular blockID. Assumes distribution elements are instances of
61 // NaClBitcodeCodeDistElement.
62 class NaClBitcodeCodeDist : public NaClBitcodeDist {
63 NaClBitcodeCodeDist(const NaClBitcodeCodeDist&)
64 LLVM_DELETED_FUNCTION;
65 void operator=(const NaClBitcodeCodeDist&)
66 LLVM_DELETED_FUNCTION;
67
68 public:
69 static bool classof(const NaClBitcodeDist *Dist) {
70 return Dist->getKind() >= RD_CodeDist
71 && Dist->getKind() < RD_CodeDistLast;
72 }
73
74 protected:
75 NaClBitcodeCodeDist(NaClBitcodeDistElement *Sentinal,
76 unsigned BlockID,
77 NaClBitcodeDistKind Kind=RD_CodeDist)
78 : NaClBitcodeDist(RecordStorage, Sentinal, Kind), BlockID(BlockID)
79 {}
80
81 static NaClBitcodeCodeDistElement DefaultSentinel;
82
83 public:
84 explicit NaClBitcodeCodeDist(
85 unsigned BlockID,
86 NaClBitcodeCodeDistElement *Sentinel = &DefaultSentinel,
87 NaClBitcodeDistKind Kind=RD_CodeDist)
88 : NaClBitcodeDist(RecordStorage, Sentinel, Kind),
89 BlockID(BlockID)
90 {}
91
92 virtual ~NaClBitcodeCodeDist();
93
94 unsigned GetBlockID() const {
95 return BlockID;
96 }
97
98 // Returns the printable name for record code CodeID in blocks
99 // associated with BlockID.
100 //
101 // Note: If the name is not known, an "UnknownCode" name is
102 // generated and return.
103 static std::string GetCodeName(unsigned CodeID, unsigned BlockID);
104
105 private:
106 // The blockID associated with the record code distribution.
107 // Used so that we can look up the print name for each record code.
108 unsigned BlockID;
109 };
110
111 }
112
113 #endif
OLDNEW
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeBlockDist.h ('k') | include/llvm/Bitcode/NaCl/NaClBitcodeDecoders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698