Use __builtin_alloca with __GNUC__

llvm-svn: 269592
This commit is contained in:
Xinliang David Li 2016-05-15 16:41:58 +00:00
parent a65b610bd2
commit 6c7bddb28b
2 changed files with 3 additions and 7 deletions

View File

@ -14,10 +14,12 @@
#define COMPILER_RT_ALIGNAS(x) __declspec(align(x))
#define COMPILER_RT_VISIBILITY
#define COMPILER_RT_WEAK __declspec(selectany)
#define COMPILER_RT_ALLOCA _alloca
#elif __GNUC__
#define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x)))
#define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden")))
#define COMPILER_RT_WEAK __attribute__((weak))
#define COMPILER_RT_ALLOCA __builtin_alloca
#endif
#define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect)))
@ -25,14 +27,11 @@
#define COMPILER_RT_MAX_HOSTLEN 128
#ifdef _MSC_VER
#define COMPILER_RT_GETHOSTNAME(Name, Len) gethostname(Name, Len)
#define COMPILER_RT_ALLOCA _alloca
#elif defined(__PS4__)
#define COMPILER_RT_GETHOSTNAME(Name, Len) (-1)
#define COMPILER_RT_ALLOCA alloca
#else
#define COMPILER_RT_GETHOSTNAME(Name, Len) lprofGetHostName(Name, Len)
#define COMPILER_RT_HAS_UNAME 1
#define COMPILER_RT_ALLOCA alloca
#endif
#if COMPILER_RT_HAS_ATOMICS == 1

View File

@ -10,11 +10,8 @@
#include "InstrProfiling.h"
#include "InstrProfilingInternal.h"
#ifdef _MSC_VER
/* For _alloca */
#include <malloc.h>
#elif defined(__FreeBSD__)
#include <stdlib.h>
#else
#include <alloca.h>
#endif
#include <string.h>