-
Notifications
You must be signed in to change notification settings - Fork 15.5k
RuntimeLibcalls: Add macos unlocked IO functions to systems #167084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeLibcalls: Add macos unlocked IO functions to systems #167084
Conversation
|
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-selectiondag Author: Matt Arsenault (arsenm) ChangesThis is another of the easier to understand conditions from Full diff: https://github.com/llvm/llvm-project/pull/167084.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index d67aeb3757ea9..dd06a3442cebb 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -24,6 +24,7 @@ def isNotOSWindows : RuntimeLibcallPredicate<"!TT.isOSWindows()">;
def isNotOSLinux : RuntimeLibcallPredicate<[{!TT.isOSLinux()}]>;
def isNotOSMSVCRT : RuntimeLibcallPredicate<"!TT.isOSMSVCRT()">;
def isPS : RuntimeLibcallPredicate<"TT.isPS()">;
+def isMacOSX : RuntimeLibcallPredicate<[{TT.isMacOSX()}]>;
def isNotOSWindowsOrIsCygwinMinGW
: RuntimeLibcallPredicate<"!TT.isOSWindows() || TT.isOSCygMing()">;
def isWindowsMSVCEnvironment : RuntimeLibcallPredicate<
@@ -1982,6 +1983,10 @@ defvar DarwinMemsetPattern = LibcallImpls<(add memset_pattern4,
memset_pattern16),
darwinHasMemsetPattern>;
+defvar MacOSUnlockedIO = LibcallImpls<(add
+ getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked),
+ isMacOSX>;
+
defvar SecurityCheckCookieIfWinMSVC =
LibcallImpls<(add __security_check_cookie, __security_cookie),
isWindowsMSVCOrItaniumEnvironment>;
@@ -2140,6 +2145,7 @@ def AArch64SystemLibrary : SystemRuntimeLibrary<
LibcallImpls<(add Int128RTLibcalls), isAArch64_ILP64>,
LibcallImpls<(add bzero), isOSDarwin>,
DarwinExp10, DarwinSinCosStret, DarwinMemsetPattern,
+ MacOSUnlockedIO,
LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128,
DefaultLibmExp10,
DefaultStackProtector,
@@ -3294,7 +3300,7 @@ defvar MemChkLibcalls = [__memcpy_chk, __memset_chk, __memmove_chk];
defvar X86CommonLibcalls =
(add (sub WinDefaultLibcallImpls, WindowsDivRemMulLibcallOverrides, MemChkLibcalls),
- DarwinSinCosStret, DarwinExp10, DarwinMemsetPattern,
+ DarwinSinCosStret, DarwinExp10, DarwinMemsetPattern, MacOSUnlockedIO,
X86_F128_Libcalls,
LibmHasSinCosF80, // FIXME: Depends on long double
SinCosF32F64Libcalls,
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/darwin.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/darwin.ll
index 6c63f5902f638..f2226e8149b2c 100644
--- a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/darwin.ll
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/darwin.ll
@@ -1,11 +1,12 @@
; REQUIRES: aarch64-registered-target, arm-registered-target, x86-registered-target
-; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=i386-apple-macosx10.5 < %s | FileCheck -check-prefix=HAS-MEMSET-PATTERN %s
-; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=i386-apple-macosx10.4 < %s | FileCheck -check-prefix=NO-MEMSET-PATTERN %s
+; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=i386-apple-macosx10.5 < %s | FileCheck -check-prefixes=HAS-MEMSET-PATTERN,MACOS %s
+; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=i386-apple-macosx10.4 < %s | FileCheck -check-prefixes=NO-MEMSET-PATTERN,MACOS %s
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=x86_64-apple-macosx10.5 < %s | FileCheck -check-prefix=HAS-MEMSET-PATTERN %s
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=x86_64-apple-macosx10.4 < %s | FileCheck -check-prefix=NO-MEMSET-PATTERN %s
+; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=arm64-apple-macos10.5 < %s | FileCheck -check-prefixes=HAS-MEMSET-PATTERN,MACOS %s
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=arm64-apple-ios3 < %s | FileCheck -check-prefix=HAS-MEMSET-PATTERN %s
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=arm64-apple-ios2 < %s | FileCheck -check-prefix=NO-MEMSET-PATTERN %s
@@ -15,8 +16,14 @@
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=arm64_32-apple-watchos < %s | FileCheck -check-prefix=HAS-MEMSET-PATTERN %s
; RUN: opt -S -passes=declare-runtime-libcalls -mtriple=armv7k-apple-watchos < %s | FileCheck -check-prefix=HAS-MEMSET-PATTERN %s
+; MACOS: declare void @getc_unlocked(...)
+; MACOS: declare void @getchar_unlocked(...)
+
; HAS-MEMSET-PATTERN: declare void @memset_pattern16(...)
; HAS-MEMSET-PATTERN: declare void @memset_pattern4(...)
; HAS-MEMSET-PATTERN: declare void @memset_pattern8(...)
+; MACOS: declare void @putc_unlocked(...)
+; MACOS: declare void @putchar_unlocked(...)
+
; NO-MEMSET-PATTERN-NOT: memset_pattern
|
640cf80 to
6ee0ec3
Compare
6656c92 to
b01305a
Compare
28d3aa9 to
abfd3b2
Compare
b01305a to
2a92356
Compare
abfd3b2 to
9150bc5
Compare
2a92356 to
dfee74d
Compare
9150bc5 to
4ab6bb5
Compare
dfee74d to
87e1210
Compare
4ab6bb5 to
9682a52
Compare
9dc2f82 to
ef3799c
Compare
9682a52 to
d668db8
Compare
This is another of the easier to understand conditions from TargetLibraryInfo
ef3799c to
cc5c05b
Compare
RKSimon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM

This is another of the easier to understand conditions from
TargetLibraryInfo