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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeParser.h ('k') | include/llvm/Bitcode/NaCl/NaClBitcodeSubblockDist.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h b/include/llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h
new file mode 100644
index 0000000000000000000000000000000000000000..8491ba43c85a8da2bf39b7294b1c5505178870d2
--- /dev/null
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h
@@ -0,0 +1,79 @@
+//===-- NaClBitcodeSizeDist.h ---------------------------------------------===//
+// Defines distribution maps for bitcode record sizes (arity).
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines distribution maps for tracking bitcode record sizes
+// (arity).
+
+#ifndef LLVM_BITCODE_NACL_NACLBITCODESIZEDIST_H
+#define LLVM_BITCODE_NACL_NACLBITCODESIZEDIST_H
+
+#include "llvm/Bitcode/NaCl/NaClBitcodeDist.h"
+#include "llvm/Bitcode/NaCl/NaClBitcodeValueDist.h"
+
+namespace llvm {
+
+/// Collects the number of bitcode record instances with the same number
+/// of elements in the vector of values, with nested value distribution maps.
+class NaClBitcodeSizeDistElement : public NaClBitcodeDistElement {
+ NaClBitcodeSizeDistElement(const NaClBitcodeSizeDistElement&)
+ LLVM_DELETED_FUNCTION;
+ void operator=(const NaClBitcodeSizeDistElement&) LLVM_DELETED_FUNCTION;
+
+public:
+ static bool classof(const NaClBitcodeDistElement *Element) {
+ return Element->getKind() >= RDE_SizeDist &&
+ Element->getKind() < RDE_SizeDistLast;
+ }
+
+ NaClBitcodeSizeDistElement()
+ : NaClBitcodeDistElement(RDE_SizeDist),
+ ValueIndexDist(NaClBitcodeDist::RecordStorage,
+ &NaClBitcodeValueIndexDistElement::Sentinel) {
+ NestedDists.push_back(&ValueIndexDist);
+ }
+
+ static NaClBitcodeSizeDistElement Sentinel;
+
+ virtual ~NaClBitcodeSizeDistElement();
+
+ virtual NaClBitcodeDistElement *CreateElement(
+ NaClBitcodeDistValue Value) const;
+
+ virtual void GetValueList(const NaClBitcodeRecord &Record,
+ ValueListType &ValueList) const;
+
+ virtual void AddRecord(const NaClBitcodeRecord &Record);
+
+ virtual const SmallVectorImpl<NaClBitcodeDist*> *
+ GetNestedDistributions() const;
+
+ virtual const char *GetTitle() const;
+
+ virtual const char *GetValueHeader() const;
+
+ virtual void PrintRowValue(raw_ostream &Stream,
+ NaClBitcodeDistValue Value,
+ const NaClBitcodeDist *Distribution) const;
+
+ NaClBitcodeDist &GetValueIndexDist() {
+ return ValueIndexDist;
+ }
+
+private:
+ // Nested blocks used by GetNestedDistributions.
+ SmallVector<NaClBitcodeDist*, 1> NestedDists;
+
+ // The value distributions associated with records of the given size.
+ NaClBitcodeDist ValueIndexDist;
+};
+
+}
+
+#endif
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeParser.h ('k') | include/llvm/Bitcode/NaCl/NaClBitcodeSubblockDist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698