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

Side by Side Diff: lib/Bitcode/NaCl/Analysis/NaClAnalyzerBlockDist.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===-- NaClAnalyzerBlockDist.cpp -----------------------------------------===//
2 // implements distribution maps used to collect block and record
3 // distributions for tools pnacl-bcanalyzer and pnacl-benchmark.
4 //
5 // The LLVM Compiler Infrastructure
6 //
7 // This file is distributed under the University of Illinois Open Source
8 // License. See LICENSE.TXT for details.
9 //
10 //===----------------------------------------------------------------------===//
11
12 #include "llvm/Bitcode/NaCl/NaClAnalyzerBlockDist.h"
13
14 using namespace llvm;
15
16 NaClAnalyzerBlockDistElement::~NaClAnalyzerBlockDistElement() {}
17
18 NaClBitcodeDistElement* NaClAnalyzerBlockDistElement::
19 CreateElement(NaClBitcodeDistValue Value) const {
20 return new NaClAnalyzerBlockDistElement(Value, OrderBlocksByID);
21 }
22
23 double NaClAnalyzerBlockDistElement::
24 GetImportance(NaClBitcodeDistValue Value) const {
25 if (OrderBlocksByID)
26 // Negate importance to "undo" reverse ordering of sort.
27 return -static_cast<double>(BlockID);
28 else
29 return NaClBitcodeBlockDistElement::GetImportance(Value);
30 }
31
32 const SmallVectorImpl<NaClBitcodeDist*> *NaClAnalyzerBlockDistElement::
33 GetNestedDistributions() const {
34 return &NestedDists;
35 }
36
37 void NaClAnalyzerBlockDist::AddRecord(const NaClBitcodeRecord &Record) {
38 cast<NaClAnalyzerBlockDistElement>(GetElement(Record.GetBlockID()))
39 ->GetRecordDist().AddRecord(Record);
40 }
41
42 void NaClAnalyzerBlockDist::AddBlock(const NaClBitcodeBlock &Block) {
43 NaClBitcodeBlockDist::AddBlock(Block);
44 if (const NaClBitcodeBlock *EncBlock = Block.GetEnclosingBlock()) {
45 cast<NaClAnalyzerBlockDistElement>(GetElement(EncBlock->GetBlockID()))
46 ->GetSubblockDist().AddBlock(Block);
47 }
48 }
OLDNEW
« 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