[compiler-rt] r253896 - [PGO] Unify raw profile header definition

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 10:36:40 PST 2015


Author: davidxl
Date: Mon Nov 23 12:36:40 2015
New Revision: 253896

URL: http://llvm.org/viewvc/llvm-project?rev=253896&view=rev
Log:
[PGO] Unify raw profile header definition

 Replace duplicate definition raw header with
 common definition in InstrProfData.inc.




Modified:
    compiler-rt/trunk/lib/profile/InstrProfiling.h
    compiler-rt/trunk/lib/profile/InstrProfilingWriter.c

Modified: compiler-rt/trunk/lib/profile/InstrProfiling.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.h?rev=253896&r1=253895&r2=253896&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfiling.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfiling.h Mon Nov 23 12:36:40 2015
@@ -59,16 +59,8 @@ typedef struct LLVM_ALIGNAS(INSTR_PROF_D
 } __llvm_profile_data;
 
 typedef struct __llvm_profile_header {
-  uint64_t Magic;
-  uint64_t Version;
-  uint64_t DataSize;
-  uint64_t CountersSize;
-  uint64_t NamesSize;
-  uint64_t CountersDelta;
-  uint64_t NamesDelta;
-  uint64_t ValueKindLast;
-  uint64_t ValueDataSize;
-  uint64_t ValueDataDelta;
+#define INSTR_PROF_RAW_HEADER(Type, Name, Initializer) Type Name;
+#include "InstrProfData.inc"
 } __llvm_profile_header;
 
 /*!

Modified: compiler-rt/trunk/lib/profile/InstrProfilingWriter.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingWriter.c?rev=253896&r1=253895&r2=253896&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingWriter.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingWriter.c Mon Nov 23 12:36:40 2015
@@ -48,16 +48,9 @@ LLVM_LIBRARY_VISIBILITY int llvmWritePro
   if (!DataSize)
     return 0;
 
-  Header.Magic = __llvm_profile_get_magic();
-  Header.Version = __llvm_profile_get_version();
-  Header.DataSize = DataSize;
-  Header.CountersSize = CountersSize;
-  Header.NamesSize = NamesSize;
-  Header.CountersDelta = (uintptr_t)CountersBegin;
-  Header.NamesDelta = (uintptr_t)NamesBegin;
-  Header.ValueKindLast = IPVK_Last;
-  Header.ValueDataSize = ValueDataSize;
-  Header.ValueDataDelta = (uintptr_t)ValueDataBegin;
+  /* Initialize header struture.  */
+#define INSTR_PROF_RAW_HEADER(Type, Name, Init) Header.Name = Init;
+#include "InstrProfData.inc"
 
   /* Write the data. */
   ProfDataIOVec IOVec[] = {




More information about the llvm-commits mailing list