[compiler-rt] r255270 - [PGO] Header file cleanup (NFC)

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 15:23:45 PST 2015


Nice cleanup!

On Thu, Dec 10, 2015 at 10:17 AM, Xinliang David Li via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: davidxl
> Date: Thu Dec 10 12:17:01 2015
> New Revision: 255270
>
> URL: http://llvm.org/viewvc/llvm-project?rev=255270&view=rev
> Log:
> [PGO] Header file cleanup (NFC)
>
> InstrProfiling.h file declares profile runtime public APIs.
> It has become a dumping place for many different things, which
> needs cleanups. In this change, core type declarations and
> portability macros are moved to a new file InstrProfilingPort.h.
>
>
>
>
> Added:
>     compiler-rt/trunk/lib/profile/InstrProfilingPort.h
> Modified:
>     compiler-rt/trunk/lib/profile/InstrProfiling.h
>
> Modified: compiler-rt/trunk/lib/profile/InstrProfiling.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.h?rev=255270&r1=255269&r2=255270&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/profile/InstrProfiling.h (original)
> +++ compiler-rt/trunk/lib/profile/InstrProfiling.h Thu Dec 10 12:17:01 2015
> @@ -10,47 +10,7 @@
>  #ifndef PROFILE_INSTRPROFILING_H_
>  #define PROFILE_INSTRPROFILING_H_
>
> -#ifdef _MSC_VER
> -# define LLVM_ALIGNAS(x) __declspec(align(x))
> -#elif __GNUC__
> -#define LLVM_ALIGNAS(x) __attribute__((aligned(x)))
> -#endif
> -
> -#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden")))
> -#define LLVM_SECTION(Sect) __attribute__((section(Sect)))
> -
> -#define PROF_ERR(Format, ...)
>       \
> -  if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS"))
>      \
> -    fprintf(stderr, Format, __VA_ARGS__);
> -
> -extern char *(*GetEnvHook)(const char *);
> -
> -#if defined(__FreeBSD__) && defined(__i386__)
> -
> -/* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to
> - * FreeBSD 10, r232261) when compiled in 32-bit mode.
> - */
> -#define PRIu64 "llu"
> -typedef unsigned char uint8_t;
> -typedef unsigned short uint16_t;
> -typedef unsigned int uint32_t;
> -typedef unsigned long long uint64_t;
> -typedef uint32_t uintptr_t;
> -#elif defined(__FreeBSD__) && defined(__x86_64__)
> -#define PRIu64 "lu"
> -typedef unsigned char uint8_t;
> -typedef unsigned short uint16_t;
> -typedef unsigned int uint32_t;
> -typedef unsigned long long uint64_t;
> -typedef unsigned long int uintptr_t;
> -
> -#else /* defined(__FreeBSD__) && defined(__i386__) */
> -
> -#include <inttypes.h>
> -#include <stdint.h>
> -
> -#endif /* defined(__FreeBSD__) && defined(__i386__) */
> -
> +#include "InstrProfilingPort.h"
>  #include "InstrProfData.inc"
>
>  enum ValueKind {
>
> Added: compiler-rt/trunk/lib/profile/InstrProfilingPort.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPort.h?rev=255270&view=auto
>
> ==============================================================================
> --- compiler-rt/trunk/lib/profile/InstrProfilingPort.h (added)
> +++ compiler-rt/trunk/lib/profile/InstrProfilingPort.h Thu Dec 10 12:17:01
> 2015
> @@ -0,0 +1,54 @@
> +/*===- InstrProfilingPort.h- Support library for PGO instrumentation
> ------===*\
> +|*
> +|*                     The LLVM Compiler Infrastructure
> +|*
> +|* This file is distributed under the University of Illinois Open Source
> +|* License. See LICENSE.TXT for details.
> +|*
>
> +\*===----------------------------------------------------------------------===*/
> +
> +#ifndef PROFILE_INSTRPROFILING_PORT_H_
> +#define PROFILE_INSTRPROFILING_PORT_H_
> +
> +#ifdef _MSC_VER
> +# define LLVM_ALIGNAS(x) __declspec(align(x))
> +#elif __GNUC__
> +#define LLVM_ALIGNAS(x) __attribute__((aligned(x)))
> +#endif
> +
> +#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden")))
> +#define LLVM_SECTION(Sect) __attribute__((section(Sect)))
> +
> +#define PROF_ERR(Format, ...)
>       \
> +  if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS"))
>      \
> +    fprintf(stderr, Format, __VA_ARGS__);
> +
> +extern char *(*GetEnvHook)(const char *);
> +
> +#if defined(__FreeBSD__) && defined(__i386__)
> +
> +/* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to
> + * FreeBSD 10, r232261) when compiled in 32-bit mode.
> + */
> +#define PRIu64 "llu"
> +typedef unsigned char uint8_t;
> +typedef unsigned short uint16_t;
> +typedef unsigned int uint32_t;
> +typedef unsigned long long uint64_t;
> +typedef uint32_t uintptr_t;
> +#elif defined(__FreeBSD__) && defined(__x86_64__)
> +#define PRIu64 "lu"
> +typedef unsigned char uint8_t;
> +typedef unsigned short uint16_t;
> +typedef unsigned int uint32_t;
> +typedef unsigned long long uint64_t;
> +typedef unsigned long int uintptr_t;
> +
> +#else /* defined(__FreeBSD__) && defined(__i386__) */
> +
> +#include <inttypes.h>
> +#include <stdint.h>
> +
> +#endif /* defined(__FreeBSD__) && defined(__i386__) */
> +
> +#endif /* PROFILE_INSTRPROFILING_PORT_H_ */
>
>
> _______________________________________________
> 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/20151210/8ee12f5d/attachment.html>


More information about the llvm-commits mailing list