Created
February 13, 2015 22:31
-
-
Save XMPPwocky/4bdb29e142d235899867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/llvm/Target/TargetLibraryInfo.h b/include/llvm/Target/TargetLibraryInfo.h | |
index 46f87b9..1863a84 100644 | |
--- a/include/llvm/Target/TargetLibraryInfo.h | |
+++ b/include/llvm/Target/TargetLibraryInfo.h | |
@@ -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); | |
@@ -688,6 +692,7 @@ namespace llvm { | |
/// ssize_t write(int fildes, const void *buf, size_t nbyte); | |
write, | |
+ | |
NumLibFuncs | |
}; | |
} | |
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp | |
index 08b41fe..72f127f 100644 | |
--- a/lib/Analysis/MemoryBuiltins.cpp | |
+++ b/lib/Analysis/MemoryBuiltins.cpp | |
@@ -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)" | |
}; | |
@@ -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; | |
diff --git a/lib/Target/TargetLibraryInfo.cpp b/lib/Target/TargetLibraryInfo.cpp | |
index c0abdbd..4df8092 100644 | |
--- a/lib/Target/TargetLibraryInfo.cpp | |
+++ b/lib/Target/TargetLibraryInfo.cpp | |
@@ -198,6 +198,8 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] = | |
"iprintf", | |
"isascii", | |
"isdigit", | |
+ "je_mallocx", | |
+ "je_sdallocx", | |
"labs", | |
"lchown", | |
"ldexp", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment