diff options
author | dim <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 |
commit | 2b066988909948dc3d53d01760bc2d71d32f3feb (patch) | |
tree | fc5f365fb9035b2d0c622bbf06c9bbe8627d7279 /runtime/libprofile/PathProfiling.c | |
parent | c80ac9d286b8fcc6d1ee5d76048134cf80aa9edc (diff) | |
download | FreeBSD-src-2b066988909948dc3d53d01760bc2d71d32f3feb.zip FreeBSD-src-2b066988909948dc3d53d01760bc2d71d32f3feb.tar.gz |
Vendor import of llvm trunk r130700:
http://llvm.org/svn/llvm-project/llvm/trunk@130700
Diffstat (limited to 'runtime/libprofile/PathProfiling.c')
-rw-r--r-- | runtime/libprofile/PathProfiling.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/runtime/libprofile/PathProfiling.c b/runtime/libprofile/PathProfiling.c index 651e63c..2836785 100644 --- a/runtime/libprofile/PathProfiling.c +++ b/runtime/libprofile/PathProfiling.c @@ -15,14 +15,22 @@ #include "Profiling.h" #include "llvm/Analysis/ProfileInfoTypes.h" +#include "llvm/Support/DataTypes.h" #include <sys/types.h> +#if !defined(_MSC_VER) && !defined(__MINGW32__) #include <unistd.h> +#else +#include <io.h> +#endif #include <string.h> #include <stdlib.h> -#include <unistd.h> -#include <stdint.h> #include <stdio.h> +/* Must use __inline in Microsoft C */ +#if defined(_MSC_VER) +#define inline __inline +#endif + /* note that this is used for functions with large path counts, but it is unlikely those paths will ALL be executed */ #define ARBITRARY_HASH_BIN_COUNT 100 @@ -104,8 +112,8 @@ void writeArrayTable(uint32_t fNumber, ftEntry_t* ft, uint32_t* funcCount) { } } -inline uint32_t hash (uint32_t key) { - /* this may benifit from a proper hash function */ +static inline uint32_t hash (uint32_t key) { + /* this may benefit from a proper hash function */ return key%ARBITRARY_HASH_BIN_COUNT; } @@ -147,7 +155,8 @@ void writeHashTable(uint32_t functionNumber, pathHashTable_t* hashTable) { } /* Return a pointer to this path's specific path counter */ -inline uint32_t* getPathCounter(uint32_t functionNumber, uint32_t pathNumber) { +static inline uint32_t* getPathCounter(uint32_t functionNumber, + uint32_t pathNumber) { pathHashTable_t* hashTable; pathHashEntry_t* hashEntry; uint32_t index = hash(pathNumber); @@ -214,7 +223,7 @@ void llvm_decrement_path_count (uint32_t functionNumber, uint32_t pathNumber) { * +-----------------+-----------------+ * */ -static void pathProfAtExitHandler() { +static void pathProfAtExitHandler(void) { int outFile = getOutFile(); uint32_t i; uint32_t header[2] = { PathInfo, 0 }; |