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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.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/NaClBitcodeAnalyzer.h ('k') | include/llvm/Bitcode/NaCl/NaClBitcodeBitsDist.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h b/include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e7a47be06af30f267ac34e3d7e1e1a5a6f039d8
--- /dev/null
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeBitsAndAbbrevsDist.h
@@ -0,0 +1,70 @@
+//===- NaClBitcodeBitsAndAbbrevsDist.h --------------------*- C++ -*-===//
+// Maps distributions of values with corresponding number of bits,
+// and percentage of abbreviations used 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 distribution map of values and the
+// correspdonding bits and abbreviations in PNaCl bitcode records.
+
+#ifndef LLVM_BITCODE_NACL_NACLBITCODEBITSANDABBREVSDIST_H
+#define LLVM_BITCODE_NACL_NACLBITCODEBITSANDABBREVSDIST_H
+
+#include "llvm/Bitcode/NaCl/NaClBitcodeBitsDist.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 NaClBitcodeBitsAndAbbrevsDistElement : public NaClBitcodeBitsDistElement {
+ NaClBitcodeBitsAndAbbrevsDistElement(
+ const NaClBitcodeBitsAndAbbrevsDistElement&) LLVM_DELETED_FUNCTION;
+ void operator=(const NaClBitcodeBitsAndAbbrevsDistElement&)
+ LLVM_DELETED_FUNCTION;
+
+public:
+ static bool classof(const NaClBitcodeDistElement *Dist) {
+ return Dist->getKind() >= RDE_BitsAndAbbrevsDist
+ && Dist->getKind() < RDE_BitsAndAbbrevsDistLast;
+ }
+
+ // Create an element with no instances.
+ explicit NaClBitcodeBitsAndAbbrevsDistElement(
+ NaClBitcodeDistElementKind Kind=RDE_BitsAndAbbrevsDist)
+ : NaClBitcodeBitsDistElement(Kind),
+ NumAbbrevs(0)
+ {}
+
+ virtual ~NaClBitcodeBitsAndAbbrevsDistElement();
+
+ virtual void AddRecord(const NaClBitcodeRecord &Record);
+
+ // Note: No AddBlock method override because abbrevations only
+ // apply to records.
+
+ // Returns the number of times an abbreviation was used to represent
+ // the value.
+ unsigned GetNumAbbrevs() const {
+ return NumAbbrevs;
+ }
+
+ virtual void PrintStatsHeader(raw_ostream &Stream) const;
+
+ virtual void PrintRowStats(raw_ostream &Stream,
+ const NaClBitcodeDist *Distribution) const;
+
+private:
+ // Number of times an abbreviation is used for the value.
+ unsigned NumAbbrevs;
+};
+
+}
+
+#endif
« 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