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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 //===-- NaClBitcodeSizeDist.cpp --------------------------------------------===/ /
2 // Implements distribution maps for value record sizes associated with
3 // bitcode records.
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/NaClBitcodeSizeDist.h"
13
14 using namespace llvm;
15
16 NaClBitcodeSizeDistElement::~NaClBitcodeSizeDistElement() {}
17
18 NaClBitcodeDistElement *NaClBitcodeSizeDistElement::CreateElement(
19 NaClBitcodeDistValue Value) const {
20 return new NaClBitcodeSizeDistElement();
21 }
22
23 void NaClBitcodeSizeDistElement::
24 GetValueList(const NaClBitcodeRecord &Record,
25 ValueListType &ValueList) const {
26 unsigned Size = Record.GetValues().size();
27 // Map all sizes greater than the max value index into the same bucket.
28 if (Size > NaClValueIndexCutoff) Size = NaClValueIndexCutoff;
29 ValueList.push_back(Size);
30 }
31
32 void NaClBitcodeSizeDistElement::AddRecord(const NaClBitcodeRecord &Record) {
33 NaClBitcodeDistElement::AddRecord(Record);
34 ValueIndexDist.AddRecord(Record);
35 }
36
37 const SmallVectorImpl<NaClBitcodeDist*> *NaClBitcodeSizeDistElement::
38 GetNestedDistributions() const {
39 return &NestedDists;
40 }
41
42 const char *NaClBitcodeSizeDistElement::GetTitle() const {
43 return "Record sizes";
44 }
45
46 const char *NaClBitcodeSizeDistElement::GetValueHeader() const {
47 return " Size";
48 }
49
50 void NaClBitcodeSizeDistElement::
51 PrintRowValue(raw_ostream &Stream,
52 NaClBitcodeDistValue Value,
53 const NaClBitcodeDist *Distribution) const {
54 Stream << format("%7u", Value);
55 // Report if we merged in GetValueList.
56 if (Value >= NaClValueIndexCutoff) Stream << "+";
57 }
58
59 NaClBitcodeSizeDistElement NaClBitcodeSizeDistElement::Sentinel;
OLDNEW
« 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