[llvm] r253809 - [PGO] move raw magic and version def to InstrProfData.inc

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 16:26:05 PST 2015


On Sat, Nov 21, 2015 at 6:05 PM, Xinliang David Li via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

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

Could you please remove the trailing whitespace here?

-- Sean Silva


> + */
> +#define INSTR_PROF_RAW_MAGIC_64 uint64_t(255) << 56 | uint64_t('l') << 48
> | \
> +       uint64_t('p') << 40 | uint64_t('r') << 32 | uint64_t('o') << 24 |
> \
> +        uint64_t('f') << 16 | uint64_t('r') << 8 | uint64_t(129)
> +#define INSTR_PROF_RAW_MAGIC_32 uint64_t(255) << 56 | uint64_t('l') << 48
> | \
> +       uint64_t('p') << 40 | uint64_t('r') << 32 | uint64_t('o') << 24 |
> \
> +        uint64_t('f') << 16 | uint64_t('R') << 8 | uint64_t(129)
> +
> +/* Raw profile format version. */
> +#define INSTR_PROF_RAW_VERSION 2
>
>  #endif /* INSTR_PROF_DATA_INC_ */
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151123/07dc2864/attachment.html>


More information about the llvm-commits mailing list