[PATCH] D114881: [TLI] Add memset_pattern4, memset_pattern8 lib functions.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 1 08:30:17 PST 2021
fhahn created this revision.
fhahn added reviewers: efriedma, ab, t.p.northover.
Herald added a subscriber: hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.
Similar to memset_pattern16, memset_pattern4, memset_pattern8 are
available on Darwin platforms.
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/memset_pattern4.3.html
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114881
Files:
llvm/include/llvm/Analysis/TargetLibraryInfo.def
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
Index: llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
===================================================================
--- llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -240,6 +240,8 @@
"declare i8* @memmove(i8*, i8*, i64)\n"
"declare i8* @memset(i8*, i32, i64)\n"
"declare void @memset_pattern16(i8*, i8*, i64)\n"
+ "declare void @memset_pattern4(i8*, i8*, i64)\n"
+ "declare void @memset_pattern8(i8*, i8*, i64)\n"
"declare i32 @mkdir(i8*, i16)\n"
"declare double @modf(double, double*)\n"
"declare float @modff(float, float*)\n"
Index: llvm/lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -166,7 +166,7 @@
return;
}
- // memset_pattern16 is only available on iOS 3.0 and Mac OS X 10.5 and later.
+ // memset_pattern{4,8,16} is only available on iOS 3.0 and Mac OS X 10.5 and later.
// All versions of watchOS support it.
if (T.isMacOSX()) {
// available IO unlocked variants on Mac OS X
@@ -175,13 +175,21 @@
TLI.setAvailable(LibFunc_putc_unlocked);
TLI.setAvailable(LibFunc_putchar_unlocked);
- if (T.isMacOSXVersionLT(10, 5))
+ if (T.isMacOSXVersionLT(10, 5)) {
+ TLI.setUnavailable(LibFunc_memset_pattern4);
+ TLI.setUnavailable(LibFunc_memset_pattern8);
TLI.setUnavailable(LibFunc_memset_pattern16);
+ }
} else if (T.isiOS()) {
- if (T.isOSVersionLT(3, 0))
+ if (T.isOSVersionLT(3, 0)) {
+ TLI.setUnavailable(LibFunc_memset_pattern4);
+ TLI.setUnavailable(LibFunc_memset_pattern8);
TLI.setUnavailable(LibFunc_memset_pattern16);
+ }
} else if (!T.isWatchOS()) {
- TLI.setUnavailable(LibFunc_memset_pattern16);
+ TLI.setUnavailable(LibFunc_memset_pattern4);
+ TLI.setUnavailable(LibFunc_memset_pattern8);
+ TLI.setUnavailable(LibFunc_memset_pattern16);
}
if (!hasSinCosPiStret(T)) {
@@ -1522,6 +1530,8 @@
FTy.getParamType(2)->isPointerTy() &&
FTy.getParamType(3)->isIntegerTy());
+ case LibFunc_memset_pattern4:
+ case LibFunc_memset_pattern8:
case LibFunc_memset_pattern16:
return (!FTy.isVarArg() && NumParams == 3 &&
FTy.getParamType(0)->isPointerTy() &&
Index: llvm/include/llvm/Analysis/TargetLibraryInfo.def
===================================================================
--- llvm/include/llvm/Analysis/TargetLibraryInfo.def
+++ llvm/include/llvm/Analysis/TargetLibraryInfo.def
@@ -1048,6 +1048,12 @@
/// void memset_pattern16(void *b, const void *pattern16, size_t len);
TLI_DEFINE_ENUM_INTERNAL(memset_pattern16)
TLI_DEFINE_STRING_INTERNAL("memset_pattern16")
+/// void memset_pattern4(void *b, const void *pattern4, size_t len);
+TLI_DEFINE_ENUM_INTERNAL(memset_pattern4)
+TLI_DEFINE_STRING_INTERNAL("memset_pattern4")
+/// void memset_pattern8(void *b, const void *pattern8, size_t len);
+TLI_DEFINE_ENUM_INTERNAL(memset_pattern8)
+TLI_DEFINE_STRING_INTERNAL("memset_pattern8")
/// int mkdir(const char *path, mode_t mode);
TLI_DEFINE_ENUM_INTERNAL(mkdir)
TLI_DEFINE_STRING_INTERNAL("mkdir")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114881.391039.patch
Type: text/x-patch
Size: 3252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211201/daefd9c1/attachment.bin>
More information about the llvm-commits
mailing list