[llvm] r258889 - [PGO] Make header portable for C /NFC
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 26 16:13:40 PST 2016
Author: davidxl
Date: Tue Jan 26 18:13:39 2016
New Revision: 258889
URL: http://llvm.org/viewvc/llvm-project?rev=258889&view=rev
Log:
[PGO] Make header portable for C /NFC
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
Modified: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=258889&r1=258888&r2=258889&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Tue Jan 26 18:13:39 2016
@@ -392,8 +392,10 @@ uint32_t getNumValueKindsRT(const void *
#define INSTR_PROF_DATA_DEFINED
#ifdef __cplusplus
#define INSTR_PROF_INLINE inline
+#define INSTR_PROF_NULLPTR nullptr
#else
#define INSTR_PROF_INLINE
+#define INSTR_PROF_NULLPTR NULL
#endif
#ifndef offsetof
@@ -554,18 +556,19 @@ int initializeValueProfRuntimeRecord(Val
for (I = 0; I <= IPVK_Last; I++) {
uint16_t N = NumValueSites[I];
if (!N) {
- RuntimeRecord->SiteCountArray[I] = nullptr;
+ RuntimeRecord->SiteCountArray[I] = INSTR_PROF_NULLPTR;
continue;
}
NumValueKinds++;
RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
if (!RuntimeRecord->SiteCountArray[I])
return 1;
- RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : nullptr;
+ RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : INSTR_PROF_NULLPTR;
for (J = 0; J < N; J++) {
/* Compute value count for each site. */
uint32_t C = 0;
- ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : nullptr;
+ ValueProfNode *Site =
+ Nodes ? RuntimeRecord->NodesKind[I][J] : INSTR_PROF_NULLPTR;
while (Site) {
C++;
Site = Site->Next;
@@ -606,7 +609,7 @@ uint32_t getNumValueDataForSiteRT(const
uint32_t getNumValueDataRT(const void *R, uint32_t VK) {
unsigned I, S = 0;
const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
- if (Record->SiteCountArray[VK] == nullptr)
+ if (Record->SiteCountArray[VK] == INSTR_PROF_NULLPTR)
return 0;
for (I = 0; I < Record->NumValueSites[VK]; I++)
S += Record->SiteCountArray[VK][I];
@@ -631,14 +634,10 @@ ValueProfData *allocValueProfDataRT(size
return (ValueProfData *)calloc(TotalSizeInBytes, 1);
}
-static ValueProfRecordClosure RTRecordClosure = {nullptr,
- getNumValueKindsRT,
- getNumValueSitesRT,
- getNumValueDataRT,
- getNumValueDataForSiteRT,
- nullptr,
- getValueForSiteRT,
- allocValueProfDataRT};
+static ValueProfRecordClosure RTRecordClosure = {
+ INSTR_PROF_NULLPTR, getNumValueKindsRT, getNumValueSitesRT,
+ getNumValueDataRT, getNumValueDataForSiteRT, INSTR_PROF_NULLPTR,
+ getValueForSiteRT, allocValueProfDataRT};
/*
* Return the size of ValueProfData structure to store data
More information about the llvm-commits
mailing list