mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Minor refactor to make VP writing more efficient
llvm-svn: 253994
This commit is contained in:
parent
59fb3a9087
commit
57937fbcb6
@ -259,8 +259,11 @@ struct InstrProfRecord {
|
|||||||
/// site: Site.
|
/// site: Site.
|
||||||
inline uint32_t getNumValueDataForSite(uint32_t ValueKind,
|
inline uint32_t getNumValueDataForSite(uint32_t ValueKind,
|
||||||
uint32_t Site) const;
|
uint32_t Site) const;
|
||||||
|
/// Return the array of profiled values at \p Site.
|
||||||
inline std::unique_ptr<InstrProfValueData[]>
|
inline std::unique_ptr<InstrProfValueData[]>
|
||||||
getValueForSite(uint32_t ValueKind, uint32_t Site) const;
|
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.
|
/// Reserve space for NumValueSites sites.
|
||||||
inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites);
|
inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites);
|
||||||
/// Add ValueData for ValueKind at value Site.
|
/// Add ValueData for ValueKind at value Site.
|
||||||
@ -369,15 +372,18 @@ InstrProfRecord::getValueForSite(uint32_t ValueKind, uint32_t Site) const {
|
|||||||
return std::unique_ptr<InstrProfValueData[]>(nullptr);
|
return std::unique_ptr<InstrProfValueData[]>(nullptr);
|
||||||
|
|
||||||
auto VD = llvm::make_unique<InstrProfValueData[]>(N);
|
auto VD = llvm::make_unique<InstrProfValueData[]>(N);
|
||||||
uint32_t I = 0;
|
getValueForSite(VD.get(), ValueKind, Site);
|
||||||
for (auto V : getValueSitesForKind(ValueKind)[Site].ValueData) {
|
|
||||||
VD[I] = V;
|
|
||||||
I++;
|
|
||||||
}
|
|
||||||
assert(I == N);
|
|
||||||
|
|
||||||
return VD;
|
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) {
|
||||||
|
Dest[I] = V;
|
||||||
|
I++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,
|
void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,
|
||||||
InstrProfValueData *VData, uint32_t N,
|
InstrProfValueData *VData, uint32_t N,
|
||||||
|
@ -166,10 +166,8 @@ void ValueProfRecord::serializeFrom(const InstrProfRecord &Record,
|
|||||||
for (uint32_t S = 0; S < NumValueSites; S++) {
|
for (uint32_t S = 0; S < NumValueSites; S++) {
|
||||||
uint32_t ND = Record.getNumValueDataForSite(ValueKind, S);
|
uint32_t ND = Record.getNumValueDataForSite(ValueKind, S);
|
||||||
SiteCountArray[S] = ND;
|
SiteCountArray[S] = ND;
|
||||||
std::unique_ptr<InstrProfValueData[]> SrcVD =
|
Record.getValueForSite(DstVD, ValueKind, S);
|
||||||
Record.getValueForSite(ValueKind, S);
|
|
||||||
for (uint32_t I = 0; I < ND; I++) {
|
for (uint32_t I = 0; I < ND; I++) {
|
||||||
DstVD[I] = SrcVD[I];
|
|
||||||
switch (ValueKind) {
|
switch (ValueKind) {
|
||||||
case IPVK_IndirectCallTarget:
|
case IPVK_IndirectCallTarget:
|
||||||
DstVD[I].Value = IndexedInstrProf::ComputeHash(
|
DstVD[I].Value = IndexedInstrProf::ComputeHash(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user