<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 21, 2015 at 6:05 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: Sat Nov 21 20:05:50 2015<br>
New Revision: 253809<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253809&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253809&view=rev</a><br>
Log:<br>
[PGO] move raw magic and version def to InstrProfData.inc<br>
<br>
These are shared definitions too. (NFC)<br>
<br>
<br>
<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/ProfileData/InstrProf.h<br>
    llvm/trunk/include/llvm/ProfileData/InstrProfData.inc<br>
<br>
Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=253809&r1=253808&r2=253809&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=253809&r1=253808&r2=253809&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)<br>
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Sat Nov 21 20:05:50 2015<br>
@@ -19,6 +19,7 @@<br>
 #include "llvm/ADT/StringRef.h"<br>
 #include "llvm/ADT/StringSet.h"<br>
 #include "llvm/IR/GlobalValue.h"<br>
+#include "llvm/ProfileData/InstrProfData.inc"<br>
 #include "llvm/Support/Endian.h"<br>
 #include "llvm/Support/ErrorHandling.h"<br>
 #include "llvm/Support/ErrorOr.h"<br>
@@ -570,31 +571,15 @@ struct Header {<br>
<br>
 namespace RawInstrProf {<br>
<br>
-const uint64_t Version = 2;<br>
+const uint64_t Version = INSTR_PROF_RAW_VERSION;<br>
+<br>
+template <class IntPtrT> inline uint64_t getMagic();<br>
+template <> inline uint64_t getMagic<uint64_t>() {<br>
+  return INSTR_PROF_RAW_MAGIC_64;<br>
+}<br>
<br>
-// Magic number to detect file format and endianness.<br>
-// Use 255 at one end, since no UTF-8 file can use that character.  Avoid 0,<br>
-// so that utilities, like strings, don't grab it as a string.  129 is also<br>
-// invalid UTF-8, and high enough to be interesting.<br>
-// Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR"<br>
-// for 32-bit platforms.<br>
-// The magic and version need to be kept in sync with<br>
-// projects/compiler-rt/lib/profile/InstrProfiling.c<br>
-<br>
-template <class IntPtrT><br>
-inline uint64_t getMagic();<br>
-template <><br>
-inline uint64_t getMagic<uint64_t>() {<br>
-  return uint64_t(255) << 56 | uint64_t('l') << 48 | uint64_t('p') << 40 |<br>
-         uint64_t('r') << 32 | uint64_t('o') << 24 | uint64_t('f') << 16 |<br>
-         uint64_t('r') << 8 | uint64_t(129);<br>
-}<br>
-<br>
-template <><br>
-inline uint64_t getMagic<uint32_t>() {<br>
-  return uint64_t(255) << 56 | uint64_t('l') << 48 | uint64_t('p') << 40 |<br>
-         uint64_t('r') << 32 | uint64_t('o') << 24 | uint64_t('f') << 16 |<br>
-         uint64_t('R') << 8 | uint64_t(129);<br>
+template <> inline uint64_t getMagic<uint32_t>() {<br>
+  return INSTR_PROF_RAW_MAGIC_32;<br>
 }<br>
<br>
 // Per-function profile data header/control structure.<br>
<br>
Modified: 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=253809&r1=253808&r2=253809&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=253809&r1=253808&r2=253809&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)<br>
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Sat Nov 21 20:05:50 2015<br>
@@ -176,6 +176,24 @@ COVMAP_FUNC_RECORD(const uint64_t, llvm:<br>
 #ifndef INSTR_PROF_DATA_INC_<br>
 #define INSTR_PROF_DATA_INC_<br>
<br>
+/* Magic number to detect file format and endianness.<br>
+ * Use 255 at one end, since no UTF-8 file can use that character.  Avoid 0,<br>
+ * so that utilities, like strings, don't grab it as a string.  129 is also<br>
+ * invalid UTF-8, and high enough to be interesting.<br>
+ * Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR"<br>
+ * for 32-bit platforms.<br>
+ * The magic and version need to be kept in sync with<br>
+ * projects/compiler-rt/lib/profile/InstrProfiling.c<br></blockquote><div><br></div><div>Could you please remove the trailing whitespace here?</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ */<br>
+#define INSTR_PROF_RAW_MAGIC_64 uint64_t(255) << 56 | uint64_t('l') << 48 | \<br>
+       uint64_t('p') << 40 | uint64_t('r') << 32 | uint64_t('o') << 24 |  \<br>
+        uint64_t('f') << 16 | uint64_t('r') << 8 | uint64_t(129)<br>
+#define INSTR_PROF_RAW_MAGIC_32 uint64_t(255) << 56 | uint64_t('l') << 48 | \<br>
+       uint64_t('p') << 40 | uint64_t('r') << 32 | uint64_t('o') << 24 |  \<br>
+        uint64_t('f') << 16 | uint64_t('R') << 8 | uint64_t(129)<br>
+<br>
+/* Raw profile format version. */<br>
+#define INSTR_PROF_RAW_VERSION 2<br>
<br>
 #endif /* INSTR_PROF_DATA_INC_ */<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">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></div>