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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.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
Index: include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h b/include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c96aa9693c80f8966eceeba19bff117f5a08a55
--- /dev/null
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h
@@ -0,0 +1,70 @@
+//===- NaClBitcodeBitsDist.h ------------------------------------*- C++ -*-===//
+// Maps distributions of values and corresponding number of
+// bits in PNaCl bitcode records.
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Creates a (nestable) distribution map of values, and the correspdonding
+// bits, in PNaCl bitcode records. These distributions are built directly
+// on top of the NaClBitcodeDistElement class.
+
+#ifndef LLVM_BITCODE_NACL_NACLBITCODEBITSDIST_H
+#define LLVM_BITCODE_NACL_NACLBITCODEBITSDIST_H
+
+#include "llvm/Bitcode/NaCl/NaClBitcodeDist.h"
+
+namespace llvm {
+
+/// Defines the element type of a PNaCl bitcode distribution map when
+/// we want to count both the number of instances, and the number of
+/// bits used by each record. Also tracks the number to times an
+/// abbreviation was used to parse the corresponding record.
+class NaClBitcodeBitsDistElement : public NaClBitcodeDistElement {
+ NaClBitcodeBitsDistElement(const NaClBitcodeBitsDistElement&)
+ LLVM_DELETED_FUNCTION;
+ void operator=(const NaClBitcodeBitsDistElement&)
+ LLVM_DELETED_FUNCTION;
+
+public:
+ static bool classof(const NaClBitcodeDistElement *Dist) {
+ return Dist->getKind() >= RDE_BitsDist
+ && Dist->getKind() < RDE_BitsDistLast;
+ }
+
+ // Create an element with no instances.
+ explicit NaClBitcodeBitsDistElement(
+ NaClBitcodeDistElementKind Kind=RDE_BitsDist)
+ : NaClBitcodeDistElement(Kind),
+ TotalBits(0)
+ {}
+
+ virtual ~NaClBitcodeBitsDistElement();
+
+ virtual void AddRecord(const NaClBitcodeRecord &Record);
+
+ virtual void AddBlock(const NaClBitcodeBlock &Block);
+
+ // Returns the total number of bits used to represent all instances
+ // of this value.
+ uint64_t GetTotalBits() const {
+ return TotalBits;
+ }
+
+ virtual void PrintStatsHeader(raw_ostream &Stream) const;
+
+ virtual void PrintRowStats(raw_ostream &Stream,
+ const NaClBitcodeDist *Distribution) const;
+
+private:
+ // Number of bits used to represent all instances of the value.
+ uint64_t TotalBits;
+};
+
+}
+
+#endif
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h ('k') | include/llvm/Bitcode/NaCl/NaClBitcodeBlockDist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698