}];
}
+def CndT : TypeDecl<"cnd_t"> {
+ let Decl = [{
+ typedef struct {
+ void *__qfront;
+ void *__qback;
+ struct {
+ unsigned char __w[4];
+ int __t;
+ } __qmtx;
+ } cnd_t;
+ }];
+}
+
def ThreadStartT : TypeDecl<"thrd_start_t"> {
let Decl = "typedef int (*thrd_start_t)(void *);";
}
OnceFlag,
CallOnceFuncT,
MtxT,
+ CndT,
ThreadStartT,
];
# threads.h entrypoints
libc.src.threads.call_once
+ libc.src.threads.cnd_broadcast
+ libc.src.threads.cnd_destroy
+ libc.src.threads.cnd_init
+ libc.src.threads.cnd_signal
+ libc.src.threads.cnd_wait
libc.src.threads.mtx_destroy
libc.src.threads.mtx_init
libc.src.threads.mtx_lock
def CallOnceFuncType : NamedType<"__call_once_func_t">;
def MtxTType : NamedType<"mtx_t">;
def MtxTTypePtr : PtrType<MtxTType>;
+def CndTType : NamedType<"cnd_t">;
+def CndTTypePtr : PtrType<CndTType>;
def ThrdStartTType : NamedType<"thrd_start_t">;
def ThrdTType : NamedType<"thrd_t">;
def ThrdTTypePtr : PtrType<ThrdTType>;
[
OnceFlagType,
CallOnceFuncType,
+ CndTType,
MtxTType,
ThrdStartTType,
ThrdTType,
]
>,
FunctionSpec<
+ "cnd_broadcast",
+ RetValSpec<IntType>,
+ [
+ ArgSpec<CndTTypePtr>,
+ ]
+ >,
+ FunctionSpec<
+ "cnd_destroy",
+ RetValSpec<VoidType>,
+ [
+ ArgSpec<CndTTypePtr>,
+ ]
+ >,
+ FunctionSpec<
+ "cnd_init",
+ RetValSpec<IntType>,
+ [
+ ArgSpec<CndTTypePtr>,
+ ]
+ >,
+ FunctionSpec<
+ "cnd_signal",
+ RetValSpec<IntType>,
+ [
+ ArgSpec<CndTTypePtr>,
+ ]
+ >,
+ FunctionSpec<
+ "cnd_wait",
+ RetValSpec<IntType>,
+ [
+ ArgSpec<CndTTypePtr>,
+ ArgSpec<MtxTTypePtr>,
+ ]
+ >,
+ FunctionSpec<
"mtx_init",
RetValSpec<IntType>,
[
DEPENDS
.${LIBC_TARGET_OS}.mtx_unlock
)
+
+add_entrypoint_object(
+ cnd_init
+ ALIAS
+ DEPENDS
+ .${LIBC_TARGET_OS}.cnd_init
+)
+
+add_entrypoint_object(
+ cnd_destroy
+ ALIAS
+ DEPENDS
+ .${LIBC_TARGET_OS}.cnd_destroy
+)
+
+add_entrypoint_object(
+ cnd_wait
+ ALIAS
+ DEPENDS
+ .${LIBC_TARGET_OS}.cnd_wait
+)
+
+add_entrypoint_object(
+ cnd_signal
+ ALIAS
+ DEPENDS
+ .${LIBC_TARGET_OS}.cnd_signal
+)
+
+add_entrypoint_object(
+ cnd_broadcast
+ ALIAS
+ DEPENDS
+ .${LIBC_TARGET_OS}.cnd_broadcast
+)
--- /dev/null
+//===-- Implementation header for cnd_broadcast function --------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_THREADS_CND_BROADCAST_H
+#define LLVM_LIBC_SRC_THREADS_CND_BROADCAST_H
+
+#include "include/threads.h"
+
+namespace __llvm_libc {
+
+int cnd_broadcast(cnd_t *cond);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_THREADS_CND_BROADCAST_H
--- /dev/null
+//===-- Implementation header for cnd_destroy function ----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_THREADS_CND_DESTROY_H
+#define LLVM_LIBC_SRC_THREADS_CND_DESTROY_H
+
+#include "include/threads.h"
+
+namespace __llvm_libc {
+
+void cnd_destroy(cnd_t *cond);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_THREADS_CND_DESTROY_H
--- /dev/null
+//===-- Implementation header for cnd_init function -------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_THREADS_CND_INIT_H
+#define LLVM_LIBC_SRC_THREADS_CND_INIT_H
+
+#include "include/threads.h"
+
+namespace __llvm_libc {
+
+int cnd_init(cnd_t *cond);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_THREADS_CND_INIT_H
--- /dev/null
+//===-- Implementation header for cnd_signal function -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_THREADS_CND_SIGNAL_H
+#define LLVM_LIBC_SRC_THREADS_CND_SIGNAL_H
+
+#include "include/threads.h"
+
+namespace __llvm_libc {
+
+int cnd_signal(cnd_t *cond);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_THREADS_CND_SIGNAL_H
--- /dev/null
+//===-- Implementation header for cnd_wait function -------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_THREADS_CND_WAIT_H
+#define LLVM_LIBC_SRC_THREADS_CND_WAIT_H
+
+#include "include/threads.h"
+
+namespace __llvm_libc {
+
+int cnd_wait(cnd_t *cond, mtx_t *mutex);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_THREADS_CND_WAIT_H
.threads_utils
libc.include.threads
)
+
+add_entrypoint_object(
+ cnd_init
+ SRCS
+ cnd_init.cpp
+ HDRS
+ ../cnd_init.h
+ DEPENDS
+ .threads_utils
+ libc.include.threads
+)
+
+add_entrypoint_object(
+ cnd_destroy
+ SRCS
+ cnd_destroy.cpp
+ HDRS
+ ../cnd_destroy.h
+ DEPENDS
+ .threads_utils
+ libc.include.threads
+)
+
+add_entrypoint_object(
+ cnd_wait
+ SRCS
+ cnd_wait.cpp
+ HDRS
+ ../cnd_wait.h
+ DEPENDS
+ .threads_utils
+ libc.include.threads
+)
+
+add_entrypoint_object(
+ cnd_signal
+ SRCS
+ cnd_signal.cpp
+ HDRS
+ ../cnd_signal.h
+ DEPENDS
+ .threads_utils
+ libc.include.threads
+)
+
+add_entrypoint_object(
+ cnd_broadcast
+ SRCS
+ cnd_broadcast.cpp
+ HDRS
+ ../cnd_broadcast.h
+ DEPENDS
+ .threads_utils
+ libc.include.threads
+)
--- /dev/null
+//===-- Linux implementation of the cnd_broadcast function ----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/threads/cnd_broadcast.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(int, cnd_broadcast, (cnd_t * cond)) { return thrd_success; }
+
+} // namespace __llvm_libc
--- /dev/null
+//===-- Linux implementation of the cnd_destroy function ------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/threads/cnd_destroy.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(void, cnd_destroy, (cnd_t * cond)) { }
+
+} // namespace __llvm_libc
--- /dev/null
+//===-- Linux implementation of the cnd_init function ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/threads/cnd_init.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(int, cnd_init, (cnd_t * cond)) { return thrd_success; }
+
+} // namespace __llvm_libc
--- /dev/null
+//===-- Linux implementation of the cnd_signal function -------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/threads/cnd_signal.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(int, cnd_signal, (cnd_t * cond)) { return thrd_success; }
+
+} // namespace __llvm_libc
--- /dev/null
+//===-- Linux implementation of the cnd_wait function ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/threads/cnd_wait.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mutex)) {
+ return thrd_success;
+}
+
+} // namespace __llvm_libc