Skip to content

Commit 763545c

Browse files
committed
Sync up with master file
llvm-svn: 258890
1 parent ae89869 commit 763545c

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

compiler-rt/lib/profile/InstrProfData.inc

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,10 @@ uint32_t getNumValueKindsRT(const void *R);
392392
#define INSTR_PROF_DATA_DEFINED
393393
#ifdef __cplusplus
394394
#define INSTR_PROF_INLINE inline
395+
#define INSTR_PROF_NULLPTR nullptr
395396
#else
396397
#define INSTR_PROF_INLINE
398+
#define INSTR_PROF_NULLPTR NULL
397399
#endif
398400

399401
#ifndef offsetof
@@ -554,18 +556,19 @@ int initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
554556
for (I = 0; I <= IPVK_Last; I++) {
555557
uint16_t N = NumValueSites[I];
556558
if (!N) {
557-
RuntimeRecord->SiteCountArray[I] = 0;
559+
RuntimeRecord->SiteCountArray[I] = INSTR_PROF_NULLPTR;
558560
continue;
559561
}
560562
NumValueKinds++;
561563
RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
562564
if (!RuntimeRecord->SiteCountArray[I])
563565
return 1;
564-
RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : NULL;
566+
RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : INSTR_PROF_NULLPTR;
565567
for (J = 0; J < N; J++) {
566568
/* Compute value count for each site. */
567569
uint32_t C = 0;
568-
ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : NULL;
570+
ValueProfNode *Site =
571+
Nodes ? RuntimeRecord->NodesKind[I][J] : INSTR_PROF_NULLPTR;
569572
while (Site) {
570573
C++;
571574
Site = Site->Next;
@@ -606,7 +609,7 @@ uint32_t getNumValueDataForSiteRT(const void *R, uint32_t VK, uint32_t S) {
606609
uint32_t getNumValueDataRT(const void *R, uint32_t VK) {
607610
unsigned I, S = 0;
608611
const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
609-
if (Record->SiteCountArray[VK] == 0)
612+
if (Record->SiteCountArray[VK] == INSTR_PROF_NULLPTR)
610613
return 0;
611614
for (I = 0; I < Record->NumValueSites[VK]; I++)
612615
S += Record->SiteCountArray[VK][I];
@@ -631,14 +634,10 @@ ValueProfData *allocValueProfDataRT(size_t TotalSizeInBytes) {
631634
return (ValueProfData *)calloc(TotalSizeInBytes, 1);
632635
}
633636

634-
static ValueProfRecordClosure RTRecordClosure = {0,
635-
getNumValueKindsRT,
636-
getNumValueSitesRT,
637-
getNumValueDataRT,
638-
getNumValueDataForSiteRT,
639-
0,
640-
getValueForSiteRT,
641-
allocValueProfDataRT};
637+
static ValueProfRecordClosure RTRecordClosure = {
638+
INSTR_PROF_NULLPTR, getNumValueKindsRT, getNumValueSitesRT,
639+
getNumValueDataRT, getNumValueDataForSiteRT, INSTR_PROF_NULLPTR,
640+
getValueForSiteRT, allocValueProfDataRT};
642641

643642
/*
644643
* Return the size of ValueProfData structure to store data
@@ -663,17 +662,15 @@ serializeValueProfDataFromRT(const ValueProfRuntimeRecord *Record,
663662
return serializeValueProfDataFrom(&RTRecordClosure, DstData);
664663
}
665664

666-
667665
#undef INSTR_PROF_COMMON_API_IMPL
668666
#endif /* INSTR_PROF_COMMON_API_IMPL */
669667

670668
/*============================================================================*/
671669

672-
673670
#ifndef INSTR_PROF_DATA_DEFINED
674671

675-
#ifndef INSTR_PROF_DATA_INC_
676-
#define INSTR_PROF_DATA_INC_
672+
#ifndef INSTR_PROF_DATA_INC
673+
#define INSTR_PROF_DATA_INC
677674

678675
/* Helper macros. */
679676
#define INSTR_PROF_SIMPLE_QUOTE(x) #x
@@ -760,7 +757,7 @@ typedef struct ValueProfNode {
760757
struct ValueProfNode *Next;
761758
} ValueProfNode;
762759

763-
#endif /* INSTR_PROF_DATA_INC_ */
760+
#endif /* INSTR_PROF_DATA_INC */
764761

765762
#else
766763
#undef INSTR_PROF_DATA_DEFINED

0 commit comments

Comments
 (0)