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

Unified Diff: lib/Bitcode/NaCl/Analysis/NaClAnalyzerBlockDist.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
« no previous file with comments | « lib/Bitcode/NaCl/Analysis/Makefile ('k') | lib/Bitcode/NaCl/Analysis/NaClBitcodeAbbrevDist.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Bitcode/NaCl/Analysis/NaClAnalyzerBlockDist.cpp
diff --git a/lib/Bitcode/NaCl/Analysis/NaClAnalyzerBlockDist.cpp b/lib/Bitcode/NaCl/Analysis/NaClAnalyzerBlockDist.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9841a0fe764a8665809e4bd0ccc7dcf1eb4235a3
--- /dev/null
+++ b/lib/Bitcode/NaCl/Analysis/NaClAnalyzerBlockDist.cpp
@@ -0,0 +1,48 @@
+//===-- NaClAnalyzerBlockDist.cpp -----------------------------------------===//
+// implements distribution maps used to collect block and record
+// distributions for tools pnacl-bcanalyzer and pnacl-benchmark.
+//
+// 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/NaClAnalyzerBlockDist.h"
+
+using namespace llvm;
+
+NaClAnalyzerBlockDistElement::~NaClAnalyzerBlockDistElement() {}
+
+NaClBitcodeDistElement* NaClAnalyzerBlockDistElement::
+CreateElement(NaClBitcodeDistValue Value) const {
+ return new NaClAnalyzerBlockDistElement(Value, OrderBlocksByID);
+}
+
+double NaClAnalyzerBlockDistElement::
+GetImportance(NaClBitcodeDistValue Value) const {
+ if (OrderBlocksByID)
+ // Negate importance to "undo" reverse ordering of sort.
+ return -static_cast<double>(BlockID);
+ else
+ return NaClBitcodeBlockDistElement::GetImportance(Value);
+}
+
+const SmallVectorImpl<NaClBitcodeDist*> *NaClAnalyzerBlockDistElement::
+GetNestedDistributions() const {
+ return &NestedDists;
+}
+
+void NaClAnalyzerBlockDist::AddRecord(const NaClBitcodeRecord &Record) {
+ cast<NaClAnalyzerBlockDistElement>(GetElement(Record.GetBlockID()))
+ ->GetRecordDist().AddRecord(Record);
+}
+
+void NaClAnalyzerBlockDist::AddBlock(const NaClBitcodeBlock &Block) {
+ NaClBitcodeBlockDist::AddBlock(Block);
+ if (const NaClBitcodeBlock *EncBlock = Block.GetEnclosingBlock()) {
+ cast<NaClAnalyzerBlockDistElement>(GetElement(EncBlock->GetBlockID()))
+ ->GetSubblockDist().AddBlock(Block);
+ }
+}
« no previous file with comments | « lib/Bitcode/NaCl/Analysis/Makefile ('k') | lib/Bitcode/NaCl/Analysis/NaClBitcodeAbbrevDist.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698