X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FProfileData%2FInstrProf.h;h=872cc764bc0e9451d1c935ac26a9037a8c111bd8;hp=b28689bfce1d5898c5df65655bcb7e01a8468c54;hb=019c78a994327bb1d41b2a1f6f8305993058d7a7;hpb=2195ce5049f3691a1d6d3fa5c1dd9a8a3f51a62f diff --git a/include/llvm/ProfileData/InstrProf.h b/include/llvm/ProfileData/InstrProf.h index b28689bfce1..872cc764bc0 100644 --- a/include/llvm/ProfileData/InstrProf.h +++ b/include/llvm/ProfileData/InstrProf.h @@ -259,8 +259,11 @@ struct InstrProfRecord { /// site: Site. inline uint32_t getNumValueDataForSite(uint32_t ValueKind, uint32_t Site) const; + /// Return the array of profiled values at \p Site. inline std::unique_ptr getValueForSite(uint32_t ValueKind, uint32_t Site) const; + inline void getValueForSite(InstrProfValueData Dest[], uint32_t ValueKind, + uint32_t Site) const; /// Reserve space for NumValueSites sites. inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites); /// Add ValueData for ValueKind at value Site. @@ -369,14 +372,17 @@ InstrProfRecord::getValueForSite(uint32_t ValueKind, uint32_t Site) const { return std::unique_ptr(nullptr); auto VD = llvm::make_unique(N); + getValueForSite(VD.get(), ValueKind, Site); + + return VD; +} +void InstrProfRecord::getValueForSite(InstrProfValueData Dest[], + uint32_t ValueKind, uint32_t Site) const { uint32_t I = 0; for (auto V : getValueSitesForKind(ValueKind)[Site].ValueData) { - VD[I] = V; + Dest[I] = V; I++; } - assert(I == N); - - return VD; } void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,