Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Add certain jemalloc functions to MemoryBuiltins #37

Merged
merged 1 commit into from
Feb 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/llvm/Target/TargetLibraryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ namespace llvm {
isascii,
/// int isdigit(int c);
isdigit,
/// void *je_mallocx(size_t size, int flags);
je_mallocx,
/// void *je_sdallocx(void *ptr, size_t size, int flags)
je_sdallocx,
/// long int labs(long int j);
labs,
/// int lchown(const char *path, uid_t owner, gid_t group);
Expand Down Expand Up @@ -688,6 +692,7 @@ namespace llvm {
/// ssize_t write(int fildes, const void *buf, size_t nbyte);
write,


NumLibFuncs
};
}
Expand Down
5 changes: 4 additions & 1 deletion lib/Analysis/MemoryBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static const AllocFnsTy AllocationFnData[] = {
{LibFunc::realloc, ReallocLike, 2, 1, -1},
{LibFunc::reallocf, ReallocLike, 2, 1, -1},
{LibFunc::strdup, StrDupLike, 1, -1, -1},
{LibFunc::strndup, StrDupLike, 2, 1, -1}
{LibFunc::strndup, StrDupLike, 2, 1, -1},
{LibFunc::je_mallocx, MallocLike, 2, 0, -1}
// TODO: Handle "int posix_memalign(void **, size_t, size_t)"
};

Expand Down Expand Up @@ -339,6 +340,8 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
TLIFn == LibFunc::ZdaPvm || // delete[](void*, ulong)
TLIFn == LibFunc::ZdaPvRKSt9nothrow_t) // delete[](void*, nothrow)
ExpectedNumParams = 2;
else if (TLIFn == LibFunc::je_sdallocx)
ExpectedNumParams = 3;
else
return nullptr;

Expand Down
2 changes: 2 additions & 0 deletions lib/Target/TargetLibraryInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
"iprintf",
"isascii",
"isdigit",
"je_mallocx",
"je_sdallocx",
"labs",
"lchown",
"ldexp",
Expand Down