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

Unified Diff: lib/Bitcode/NaCl/Analysis/NaClBitcodeSizeDist.cpp

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: lib/Bitcode/NaCl/Analysis/NaClBitcodeSizeDist.cpp
diff --git a/lib/Bitcode/NaCl/Analysis/NaClBitcodeSizeDist.cpp b/lib/Bitcode/NaCl/Analysis/NaClBitcodeSizeDist.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9bdea988f981afadec3007d660b62047a9e8b44a
--- /dev/null
+++ b/lib/Bitcode/NaCl/Analysis/NaClBitcodeSizeDist.cpp
@@ -0,0 +1,59 @@
+//===-- NaClBitcodeSizeDist.cpp --------------------------------------------===//
+// Implements distribution maps for value record sizes associated with
+// bitcode records.
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Bitcode/NaCl/NaClBitcodeSizeDist.h"
+
+using namespace llvm;
+
+NaClBitcodeSizeDistElement::~NaClBitcodeSizeDistElement() {}
+
+NaClBitcodeDistElement *NaClBitcodeSizeDistElement::CreateElement(
+ NaClBitcodeDistValue Value) const {
+ return new NaClBitcodeSizeDistElement();
+}
+
+void NaClBitcodeSizeDistElement::
+GetValueList(const NaClBitcodeRecord &Record,
+ ValueListType &ValueList) const {
+ unsigned Size = Record.GetValues().size();
+ // Map all sizes greater than the max value index into the same bucket.
+ if (Size > NaClValueIndexCutoff) Size = NaClValueIndexCutoff;
+ ValueList.push_back(Size);
+}
+
+void NaClBitcodeSizeDistElement::AddRecord(const NaClBitcodeRecord &Record) {
+ NaClBitcodeDistElement::AddRecord(Record);
+ ValueIndexDist.AddRecord(Record);
+}
+
+const SmallVectorImpl<NaClBitcodeDist*> *NaClBitcodeSizeDistElement::
+GetNestedDistributions() const {
+ return &NestedDists;
+}
+
+const char *NaClBitcodeSizeDistElement::GetTitle() const {
+ return "Record sizes";
+}
+
+const char *NaClBitcodeSizeDistElement::GetValueHeader() const {
+ return " Size";
+}
+
+void NaClBitcodeSizeDistElement::
+PrintRowValue(raw_ostream &Stream,
+ NaClBitcodeDistValue Value,
+ const NaClBitcodeDist *Distribution) const {
+ Stream << format("%7u", Value);
+ // Report if we merged in GetValueList.
+ if (Value >= NaClValueIndexCutoff) Stream << "+";
+}
+
+NaClBitcodeSizeDistElement NaClBitcodeSizeDistElement::Sentinel;
« no previous file with comments | « lib/Bitcode/NaCl/Analysis/NaClBitcodeDist.cpp ('k') | lib/Bitcode/NaCl/Analysis/NaClBitcodeSubblockDist.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698