Commit Graph

35 Commits

Author SHA1 Message Date
cgyurgyik 128bf458ab [libc] Add tolower, toupper implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85326
2020-08-06 15:21:38 -04:00
cgyurgyik 1fdab96130 [libc] Add isspace, isprint, isxdigit implementations.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85270
2020-08-05 10:51:43 -04:00
cgyurgyik 6cd50e7b75 [libc] Add implementations for isblank, iscntrl, isgraph, ispunct.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85059
2020-08-04 15:16:58 -04:00
cgyurgyik e2d4bf6cec [libc] Add islower and isupper implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84960
2020-07-31 14:05:27 -04:00
cgyurgyik e263dcc3ef [libc] Implements isdigit and isalnum. Adds a utility header to inline
functions to avoid overhead of function calls.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84893
2020-07-30 12:37:30 -04:00
cgyurgyik 686c82b974 [libc] Add scaffolding for ctype and implementation of isalpha
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84575
2020-07-28 19:17:31 -04:00
cgyurgyik 5a9630b777 [libc] Adds implementation for memrchr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D84469
2020-07-24 14:40:12 -04:00
Tue Ly 4096088e19 [libc] Add implementations of fmax, fmaxf, and fmaxl.
Summary: Add implementations of fmax, fmaxf, and fmaxl.

Reviewers: sivachandra

Subscribers: mgorny, tschuett, libc-commits, ecnelises

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D84385
2020-07-23 15:23:08 -04:00
cgyurgyik f773d37ee1 [libc] Implements strnlen.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84247
2020-07-22 18:28:35 -04:00
Tue Ly 7ce32f87f9 Add implementations for fmin, fminf, and fminl. Testing infrastructure update is splitted to https://reviews.llvm.org/D83931. 2020-07-21 17:24:15 -04:00
Siva Chandra Reddy d4adac4832 [libc] Add the remaining long double flavors of nearest integer functions.
Specifically: ceill, floorl and roundl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82591
2020-06-25 22:45:05 -07:00
Siva Chandra Reddy a00fb593b4 [libc] Add long double flavors of the floating point manipulation functions.
Specifically: copysignl, frexpl, logbl and modfl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82357
2020-06-23 23:46:58 -07:00
Siva Chandra Reddy 139018265b [libc] Add implementations long double fabsl and truncl functions.
Current implementations of single precision and double precision
floating point operations operate on bits of the integer type of
same size. The code made use of magic masks which were listed as
literal integer values. This is not possible in the case of long
double type as the mantissa of quad-precision long double type used
on non-x86 architectures is wider that the widest integer type for
which we can list literal values. So, in this patch, to avoid
using magic masks specified with literal values, we use packed
bit-field struct types and let the compiler generate the masks.
This new scheme allows us to implement long double flavors of the
various floating point operations. To keep the size of the patch
small, only the implementations of fabs and trunc have been
switched to the new scheme. In following patches, all exisiting
implementations will be switched to the new scheme.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82036
2020-06-18 11:08:26 -07:00
Siva Chandra Reddy 118c13c691 [libc] Add implementation of few floating point manipulation functions.
Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D81134
2020-06-11 12:23:11 -07:00
Siva Chandra Reddy 4be1c116ad [libc] Add implementations of round and roundf.
Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D80779
2020-06-09 23:01:20 -07:00
Siva Chandra Reddy 63bbddf4cd [libc][NFC] Add bzero to list of entrypoints.
A new LLVM libc specific extension standard spec has been added.
2020-06-08 21:44:39 -07:00
Siva Chandra Reddy b28167928d [libc][NFC] Add ceil[f], floor[f] and trunc[f] to the spec and config files. 2020-06-03 22:39:34 -07:00
Siva Chandra Reddy 0baf0e8cfc [libc] Add implementation of call_once from threads.h.
Reviewers: abrachet, maskray

Differential Revision: https://reviews.llvm.org/D79828
2020-05-28 23:45:09 -07:00
Siva Chandra Reddy 96d85726b0 [libc] Move implementations of expf and exp2f from the AOR to src/math.
Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79149
2020-05-15 12:43:03 -07:00
Siva Chandra Reddy 4a39a33d44 [libc] Add implementation of fabs and fabsf.
Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79725
2020-05-15 11:10:43 -07:00
Paula Toth 29213878e7 [libc] Add spec for sigdelset and sigfillset.
Summary: Caught by libc-tidy from patch D77281.

Reviewers: abrachet, sivachandra

Reviewed By: abrachet

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D78703
2020-04-23 16:38:47 -07:00
Alex Brachet 5793c84925 [libc] Add write(2) implementation for Linux and FDReader test utility
Summary: Adds `write` for Linux and FDReader utility which should be useful for some stdio tests as well.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D78184
2020-04-17 13:21:05 -04:00
Alex Brachet 99aea57928 [libc] Add very basic stdio FILE and fwrite
Summary:
This patch adds a very basic `FILE` type and basic `fwrite`.

It also removes `snprintf` from `StdIO`'s function spec because `VarArgType` was causing the generation to fail.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D77626
2020-04-14 04:02:27 -04:00
Siva Chandra Reddy 911f2e7dc4 [libc] Add a GNU extensions spec containing sincosf from math.h.
Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D76783
2020-03-25 15:13:22 -07:00
Siva Chandra Reddy 2c080a3f23 [libc] Generate math.h instead of the static file it is currently.
Just enough to help a follow up patch adding cosf and sinf has been
added.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D76723
2020-03-24 21:17:55 -07:00
Alex Brachet ca04d0c8fd [libc] Add signal
Summary:
This patch adds a Linux implementation for `signal`
It also fixes `ASSERT|EXPECT_THAT` macros

Reviewers: sivachandra, PaulkaToast, MaskRay

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D76536
2020-03-22 14:15:47 -04:00
Alex Brachet 4d35055635 [libc] Add sigaction
Summary: This patch adds `sigaction` and the `sa_restorer` signal trampoline function `__restore_rt`

Reviewers: sivachandra, MaskRay, PaulkaToast

Reviewed By: sivachandra

Subscribers: gchatelet, mgorny, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D75802
2020-03-18 01:08:59 -04:00
Alex Brachet b47c9f535c [libc] Add initial assert definition
Summary: This patch adds a temporary `__assert_fail` and `assert` definition to make it available to internal llvm libc code. `__assert_fail` writes to fd 2 directly instead of `stderr`, using SYS_write. I have not put it in its own linux directory because this is temporary and it should be using stdio's api in the future. It does not currently print out the line number (although we could do that by stringifying `__LINE__` if reviewers wish).

Reviewers: sivachandra, gchatelet, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D75420
2020-03-11 23:45:58 -04:00
Alex Brachet a499d68056 [libc] Create abort and _Exit
This revision creates abort and _Exit implementations

Differential Revision: https://reviews.llvm.org/D74949
2020-03-05 14:21:18 -05:00
Alex Brachet cd76a02639 [libc] Add sigprocmask
Summary: This patch adds `sigprocmask`, `sigemptyset` and `sigaddset`

Reviewers: sivachandra, MaskRay, gchatelet

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D75026
2020-03-02 03:47:21 -05:00
Siva Chandra Reddy d1536673c6 [libc] Add ability to generate enum types/values to HdrGen.
A target to generate the std C threads.h file has been added. This
utilizes the new feature added in this change.

Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D75379
2020-02-28 23:27:32 -08:00
Alex Brachet 5d2baa956a [libc] Add Initial Support for Signals
Summary:
This patch adds signal support on Linux. The current implementation gets the SIG* macros and types like `sigset_t` from <linux/signals.h>

This patch also adds raise(3), and internal routines  `block_all_signals` and `restore_signals`

Reviewers: sivachandra, MaskRay, gchatelet

Reviewed By: sivachandra

Subscribers: libc-commits, mgorny, tschuett

Differential Revision: https://reviews.llvm.org/D74528
2020-02-20 14:05:34 -05:00
Siva Chandra Reddy e5a743c4f6 Add implementations of POSIX mmap and munmap functions.
Summary:
A set of of linux x86_64 internal syscall helpers have also been added.

This change does not try to be perfect with respect to OS and machine
abstractions. A TODO note has been added at places where such abstractions
would help and make the arrangement scalable and cleaner. Addressing the
TODOs and building such abstractions is not in the scope of this change.
It is hoped that follow up changes cleaning up the problem areas and
addressing the TODOs will better illustrate the need for the changes.

This change also does not try to imitate mmap and munmap implementations
of other libcs. The idea here is to put in the bare minimum required to
obtain a working mmap and munmap, and then add the rest of the
functionality on an as needed basis.

Reviewers: abrachet, phosek, stanshebs, theraven

Subscribers: mgorny, MaskRay, jfb, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D71634
2019-12-23 14:04:02 -08:00
Siva Chandra Reddy 453c85ff0f [libc] Add implementation of errno and define the other macros of errno.h.
Reviewers: stanshebs, alexbrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D71094
2019-12-09 13:34:08 -08:00
Siva Chandra Reddy b47f9eb55d [libc] Add a TableGen based header generator.
Summary:
* The Python header generator has been removed.
* Docs giving a highlevel overview of the header gen scheme have been
  added.

Reviewers: phosek, abrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D70197
2019-11-22 13:02:24 -08:00