<div dir="ltr">thanks for the hint.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 16, 2015 at 4:33 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Oct 16, 2015 at 4:27 PM, Xinliang David Li <span dir="ltr"><<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">First use will come shortly (as in today).</div></blockquote><div><br></div></span><div>No big deal, but it would be nice to mention that in the commit message (usually we phrase it as "an upcoming commit will ...").</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Sean Silva</div></font></span><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span><font color="#888888"><div><br></div><div>David</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 16, 2015 at 4:26 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>In LLVM we typically add code with its first use, so for consistency this should probably be reverted and introduced with its first use.</div><div><br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 16, 2015 at 4:17 PM, Xinliang David Li via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davidxl<br>
Date: Fri Oct 16 18:17:34 2015<br>
New Revision: 250574<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=250574&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=250574&view=rev</a><br>
Log:<br>
Instroduce a template file to define InstrPGO core data structures.<br>
<br>
Changing PGO data format layout can be a pain. Many different places need<br>
to be touched and kept in sync. Failing to do so usually results in errors<br>
very time consuming to debug.<br>
<br>
This file is intended to be the master file that defines the layout of the<br>
core runtime data structures. Currently only two structure is covered: Per<br>
function ProfData structure and the function record structure used in<br>
coverage mapping.<br>
<br>
No client code has been made yet, so this commit is NFC.<br>
<br>
<br>
<br>
Added:<br>
    llvm/trunk/include/llvm/ProfileData/InstrProfData.inc<br>
<br>
Added: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=250574&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=250574&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (added)<br>
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Fri Oct 16 18:17:34 2015<br>
@@ -0,0 +1,88 @@<br>
+//===-- InstrProfData.inc - instr profiling runtime structures-----===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// This file defines templates for core runtime data structures used by<br>
+// instrumentation based profiling and coverage mapping. The instrumentation<br>
+// runtime library, the compiler IR lowering, and profile reader/writer need<br>
+// to use the same template to make sure the same data structure is defined<br>
+// consistently.<br>
+//<br>
+// Examples of how the template is used:<br>
+// 1. To declare a structure:<br>
+//<br>
+// struct ProfData {<br>
+// #define INSTR_PROF_DATA(Type, LLVMTypeVar, LLVMType, Name, Initializer) \<br>
+//    Type Name;<br>
+// #include "ProfileData/InstrProfData.inc"<br>
+// };<br>
+//<br>
+// 2. To define local variables for struct member's LLVM types"<br>
+//<br>
+// #define INSTR_PROF_DATA(Type, LLVMTypeVar, LLVMType, Name, Initializer) \<br>
+//   LLVMTypeVar = LLVMType;<br>
+// #include "ProfileData/InstrProfData.inc"<br>
+//<br>
+// 3. To construct LLVM type arrays for the struct type:<br>
+//<br>
+// Type *DataTypes[] = {<br>
+// #define INSTR_PROF_DATA(Type, LLVMTypeVar, LLVMType, Name, Initializer) \<br>
+//   LLVMTypeVar,<br>
+// #include "ProfileData/InstrProfData.inc"<br>
+// };<br>
+//<br>
+// 4. To construct constant array for the initializers:<br>
+// #define INSTR_PROF_DATA(Type, LLVMTypeVar, LLVMType, Name, Initializer) \<br>
+//   Initializer,<br>
+// Constant *ConstantVals[] = {<br>
+// #include "ProfileData/InstrProfData.inc"<br>
+// };<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef INSTR_PROF_DATA<br>
+#define INSTR_PROF_DATA(Type, LLVMTypeVar, LLVMType, Name, Initializer)<br>
+#endif<br>
+<br>
+// INSTR_PROF_DATA_START<br>
+INSTR_PROF_DATA(const uint32_t, Int32Ty, llvm::Type::getInt32Ty(Ctx), NameSize, \<br>
+                ConstantInt::get(Int32Ty, NameSize))<br>
+INSTR_PROF_DATA(const uint32_t, Int32Ty, llvm::Type::getInt32Ty(Ctx), NumCounters, \<br>
+                ConstantInt::get(Int32Ty, NumCounters))<br>
+INSTR_PROF_DATA(const uint64_t, Int64Ty, llvm::Type::getInt64Ty(Ctx), FuncHash, \<br>
+                ConstantInt::get(Int64Ty, FuncHash))<br>
+INSTR_PROF_DATA(const IntPtrT, Int8PtrTy,llvm::Type::getInt8PtrTy(Ctx), NamePtr, \<br>
+                ConstantExpr::getBitCast(Name, Int8PtrTy))<br>
+INSTR_PROF_DATA(const IntPtrT, Int64PtrTy, llvm::Type::getInt64PtrTy(Ctx), CounterPtr, \<br>
+                ConstantExpr::getBitCast(CounterPtr, Int8PtrTy))<br>
+// INSTR_PROF_DATA_END<br>
+<br>
+#ifdef INSTR_PROF_DATA<br>
+#undef INSTR_PROF_DATA<br>
+#endif<br>
+<br>
+<br>
+#ifndef COVMAP_FUNC_RECORD<br>
+#define COVMAP_FUNC_RECORD(Type, LLVMTypeVar, LLVMType, Name, Initializer)<br>
+#endif<br>
+<br>
+// COVMAP_FUNC_RECORD_START<br>
+COVMAP_FUNC_RECORD(const IntPtrT, Int8PtrTy, llvm::Type::getInt8PtrTy(Ctx), \<br>
+                   NamePtr, llvm::ConstantExpr::getBitCast(NamePtr, Int8PtrTy))<br>
+COVMAP_FUNC_RECORD(const uint32_t, Int32Ty, llvm::Type::getInt32Ty(Ctx), \<br>
+                   NameSize, llvm::ConstantInt::get(Int32Ty, NameSize))<br>
+COVMAP_FUNC_RECORD(const uint32_t, Int32Ty, llvm::Type::getInt32Ty(Ctx), \<br>
+                   DataSize, llvm::ConstantInt::get(Int32Ty, DataSize))<br>
+COVMAP_FUNC_RECORD(const uint64_t, Int64Ty, llvm::Type::getInt64Ty(Ctx), \<br>
+                   FuncHash, llvm::ConstantInt::get(Int64Ty, FuncSize))<br>
+// COVMAP_FUNC_RECORD_END<br>
+<br>
+#ifdef COVMAP_FUNC_RECORD<br>
+#undef COVMAP_FUNC_RECORD<br>
+#endif<br>
+<br>
+<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>