Commit Graph

1983 Commits

Author SHA1 Message Date
Jordan Rupprecht
9760872b53 [bazel][libc] Add missing fenv dep for rint test template
For 49561181bd.
2024-04-10 00:22:10 +00:00
Jordan Rupprecht
fe5dba3c08 [bazel][libc] Add missing fenv dep for aarch64
For 49561181bd.
2024-04-09 20:20:41 +00:00
Job Henandez Lara
49561181bd [libc] Add proxy header for fenv.h macro constants. #87863 (#87896)
Hello, this addresses #87863.
2024-04-09 12:55:10 -04:00
Jordan Rupprecht
93f0880869 [bazel][clang] Remove gen-clang-*-left-list attributes from tablegen
For both 9391ff8c86 and a30662fc2a.
2024-04-09 15:22:05 +00:00
Jordan Rupprecht
bee3377018 [bazel] Add nobuildkite tags for incompatible targets 2024-04-08 22:21:45 +00:00
lntue
1e6ce5e284 [libc] Clean up unused math_utils.(h|cpp). (#88036) 2024-04-08 16:55:50 -04:00
Christian Sigg
b80e51ce4d [mlir][bazel] Fix BUILD after a2c4b7c8e2. 2024-04-08 07:57:54 +02:00
NAKAMURA Takumi
ba5dad35fb [Bazel] Enable LLVM_VERSION_PRINTER_SHOW_BUILD_CONFIG (for #87585) 2024-04-07 11:02:08 +09:00
Guillaume Chatelet
fc7087b7b7 [libc][NFC] Rename uint_test into big_int_test for consistency (#87875) 2024-04-06 19:10:25 +02:00
Benjamin Kramer
f5d7e755b8 [bazel] Fix the build after 27b2d7d4bb 2024-04-06 11:45:16 +02:00
Guillaume Chatelet
09efe848cf [libc][NFC] Rename UInt.h to big_int.h and UInt128.h to uint128.h for consistency (#87808) 2024-04-06 10:39:55 +02:00
lntue
5748ad84e5 [libc] Add proxy header math_macros.h. (#87598)
Context: https://github.com/llvm/llvm-project/pull/87017

- Add proxy header `libc/hdr/math_macros.h` that will:
  - include `<math.h>` in overlay mode,
- include `"include/llvm-libc-macros/math-macros.h"` in full build mode.
- Its corresponding CMake target `libc.hdr.math_macros` will only depend
on `libc.include.math` and `libc.include.llvm-libc-macros.math_macros`
in full build mode.
- Replace all `#include "include/llvm-libc-macros/math-macros.h"` with
`#include "hdr/math_macros.h"`.
- Add dependency to `libc.hdr.math_macros` CMake target when using
`add_fp_unittest`.
- Update the remaining dependency.
- Update bazel overlay: add `libc:hdr_math_macros` target, and replacing
all dependency on `libc:llvm_libc_macros_math_macros` with
`libc:hdr_math_macros`.
2024-04-05 18:21:16 -04:00
aniplcc
8ee6ab7f69 [libc][c23][fenv] implement fesetexcept (#87603)
Closes #87564
2024-04-05 13:52:57 -07:00
Keith Smiley
51a4ab287f [bazel] Improve libc build on macOS (#86174)
With these changes you can now `bazel build @llvm-project//...` on
macOS, and the targets in libc that don't yet support macOS (or
non-linux) are ignored
2024-04-05 08:37:47 -07:00
Jordan Rupprecht
25afb7768f [bazel] Add the remaining llvm-driver tools (#87302) 2024-04-05 10:20:47 -05:00
Keith Smiley
134176058f [bazel] Add support for building orc_rt (#87730) 2024-04-04 18:06:55 -07:00
Keith Smiley
4b077ed58e [bazel] Add support for building lldb (#87589)
This adds build configuration for building LLDB on macOS and Linux. It
uses a default subset of features that should work out of the box with
macOS + Ubuntu. It is notably missing python support right now, although
some of the scaffolding is there, because of the complexity of linking a
python dylib, especially if you plan to distribute the resulting
liblldb.so.

Most of this build file is pretty simple, one of the unfortunate
patterns I had to use was to split the header and sources cc_library
targets to break circular dependencies.
2024-04-04 15:10:52 -07:00
Chenguang Wang
2cbbbf71a4 [bazel] Add missing dependency for mlir:SCFUtils (#87711)
5aeb604c7c
https://buildkite.com/llvm-project/upstream-bazel/builds/93859
2024-04-04 14:29:29 -07:00
Michael Jones
5264c22ef1 [libc] Temporary math macros fix (#87681)
Downstream's having some issues due to math-macros.h issues. These will
be fixed properly soon.

See https://github.com/llvm/llvm-project/issues/87683 for tracking this
tech debt.
2024-04-04 14:28:56 -07:00
lntue
62740d87bc [libc][bazel][math] Add float128 math functions and their smoke tests to bazel layout. (#87645) 2024-04-04 12:15:32 -04:00
Guillaume Chatelet
71c3f5d617 [reland][libc] Refactor BigInt (#87613)
This is a reland of #86137 with a fix for platforms / compiler that do
not support trivially constructible int128 types.
2024-04-04 11:41:27 +02:00
Guillaume Chatelet
12735916bd Revert "[libc] Refactor BigInt" (#87612)
Reverts llvm/llvm-project#86137

Some aarch64 compilers seem to consider that `uint128_t` is not
`is_trivially_constructible` which prevents `bit_cast`-ing.
2024-04-04 11:10:30 +02:00
Guillaume Chatelet
a2306b65d2 [libc] Refactor BigInt (#86137)
This patch moves most of the multiprecision logic to the `multiword`
namespace and simplifies some logic in `BigInt`. It also fully
implements the mask and count functions and increases test coverage.

`math_extras.h` is also reworked to make it more concise.
2024-04-04 10:27:08 +02:00
Haojian Wu
d0dcf06ab8 [bazel] Port for e05c1b46d0. 2024-04-03 12:33:30 +02:00
Haojian Wu
0b13e2c823 [bazel] Another format fix for libc_build_rules.bzl, NFC 2024-04-02 13:45:11 +02:00
Haojian Wu
198c3eecee [bazel] Fix the format of libc_build_rules.bzl 2024-04-02 13:21:02 +02:00
Abhinav Gunjal
dd5797505e lit_test : check if there is already a deps key in kwargs (#87290)
This change checks if there is already a `deps` key in `kwargs` and
concatenate it to avoid multiple values for `deps` key argument.

background:
https://github.com/llvm/llvm-project/pull/87022 recently added explicit
`deps` to the lit_test. This is causing StableHLO bazel build failures
at
https://github.com/openxla/stablehlo/actions/runs/8511888283/job/23312383380?pr=2147

Tested: local build run is successful
2024-04-01 19:36:09 -05:00
Caslyn Tonelli
d83271b093 [libc] Include algorithm.h to parser.h (#87125)
This includes algorithm.h directly to provide the definition for
`cpp:max` in parser.h. This will define `max(...)` in the libc namespace
for build systems that pull in parser.h explicitly.
2024-04-01 09:51:38 -07:00
Schrodinger ZHU Yifan
a8b0ecd260 [libc] enable stack protectors and frame pointers on default (#86288) 2024-03-29 20:17:11 -04:00
Jordan Rupprecht
c09b6fac12 [bazel] Add support for LLVM_TOOL_LLVM_DRIVER_BUILD (#86879)
This adds the bazel equivalent of the `llvm` binary produced by
`LLVM_TOOL_LLVM_DRIVER_BUILD` in cmake. For the initial commit, this
only includes `llvm-ar`, `llvm-nm`, and `llvm-size`. The rest are
trivial to add in a followup commit, following the same pattern as here.

By default it will include everything that supports the llvm-driver
model, but it can be reduced to only build a subset, e.g. this will
build only nm and size:

```
$ bazel build \
    --@llvm-project//llvm:driver-tools=llvm-nm,llvm-size \
    @llvm-project//llvm:llvm
```
2024-03-29 11:20:09 -05:00
Jordan Rupprecht
85a5f64c70 [bazel] Add missing deps after a4de589d11 2024-03-29 16:14:09 +00:00
Christian Sigg
e1873d9972 [mlir][bazel] Remove unsed BUILD dependencies. (#87038)
This is the second attempt of 32fcfcdc4c,
which had to be reverted.

This should be good to go now, after a number of cleanups to not expose
headers from multiple targets:

- 6e58efac16
- f1dff83659
- 89ef3130cf
- eb70b485a9
- 83e5a12392
- fce046ca5b
2024-03-29 08:20:19 +01:00
Keith Smiley
89bae852dd [bazel] Fix lit tests with python 3.11+ (#87022)
In python3.11 there is a new environment variable PYTHONSAFEPATH which
stops python from setting the current directory as the first entry in
sys.path. Bazel started setting this to ensure that python targets
don't accidentally access things that aren't in their dependency tree.
This resulted in lit tests breaking because sys.path didn't include the
directory to the lit source files. This is fixed by adding the lit
binary to the dependency tree and propagating the import path from it.

Fixes https://github.com/llvm/llvm-project/issues/75963
2024-03-28 19:07:22 -07:00
Christian Sigg
6e58efac16 [mlir][bazel] Export headers either from :Transforms or :TransformUtils (#86819)
Split them according to their implementation.

Ideally, header files should be used by only one target, but this is
hard because CMake is less strict with headers (no layering check). But
even with bazel, headers should only be exported once in the `hdrs`
attribute. Other targets may use them in the `srcs` attribute to avoid
circular dependencies.
2024-03-28 20:12:27 +01:00
Yijia Gu
da5d576026 [mlir] fix empty spaces in bazel file 2024-03-28 10:56:15 -07:00
Yijia Gu
2af3b43642 [mlir] fix bazel error for MatchInterfaces dialect 2024-03-28 10:49:27 -07:00
Nick Desaulniers
ad97ee2531 [libc][support][FixedVector] add reverse iterator (#86732)
Critically, we don't want to return an iterator to the end of the underlying
cpp::array "store." Add a test to catch this issue.

This will be used by __cxa_finalize to iterate backwards through a FixedVector.

Link: #85651
2024-03-28 09:53:44 -07:00
Michael Jones
d5f06342a3 [libc] add flag for FP_*LOGB0/NAN values (#86723)
These values vary by system, this flag allows you to toggle their value.
2024-03-27 15:09:57 -07:00
Keith Smiley
0099c584ba [bazel] Remove -lm on macOS (#86706)
Bazel links this library by default which leads to this linker warning
on macOS:

```
ld: warning: ignoring duplicate libraries: '-lm'
```
2024-03-27 09:35:45 -07:00
Marc Auberer
77118536b5 [libc] Remove obsolete LIBC_HAS_BUILTIN macro (#86554)
Fixes #86546 and removes the macro `LIBC_HAS_BUILTIN`. This was
necessary to support older compilers that did not support
`__has_builtin`. All of the compilers we support already have this
builtin.
See: https://libc.llvm.org/compiler_support.html
All uses now use `__has_builtin` directly

cc @nickdesaulniers
2024-03-27 17:22:41 +01:00
Christian Sigg
f1dff83659 [mlir][bazel] Expose GPUCommonPass.h only by a single target. (#86730)
Move `GPUOpsLowering.cpp` from `//mlir:GPUCommonTransforms` to
`//mlir:GPUToGPURuntimeTransforms` to match the CMake setup.

Ideally, header files should be used by only one target, but this is
hard because CMake is less strict with headers (no layering check). But
even with bazel, headers should only be exported once in the `hdrs`
attribute. Other targets may use them in the `srcs` attribute to avoid
circular dependencies.
2024-03-27 06:07:58 +01:00
Alina Sbirlea
a22bd00ce0 [libc] [bazel] [NFC] Format deps. 2024-03-26 14:18:41 -07:00
Nick Desaulniers
ecfffbfd39 [libc][OSUtil] refactor quick_exit to be an object library everywhere (#85955)
The usage of __builtin_unreachable after calls to quick_exit were distressing.
If a function is properly marked [[noreturn]] then __builtin_unreachable is not
necessary.

Looking into this further, we seem to have header only implementations for CPU
targets. The inline nature of these functions is curious; we're going to exit,
it doesn't matter if we need to pay the call of a function or not. If we just
make these functions have distinct TUs rather than be header only, we can clean
up the cmake rules for quick_exit which were different between CPU and GPU.

Remove darwin support for quick_exit. This isn't being tested, and we can bring
it back when necessary.
2024-03-26 08:27:43 -07:00
Christian Sigg
89ef3130cf [mlir][bazel] Create a separate target for BytecodeOpInterface. (#86655)
This matches the CMake targets and reduces the number of headers that
need to be included in multiple targets.
2024-03-26 15:01:11 +01:00
Shourya Goel
19ca79e867 [libc][math][c23] Implement canonicalize functions (#85940)
Fixes: #85286
2024-03-26 08:28:22 -04:00
Christian Sigg
eb70b485a9 [mlir][bazel] Export more headers by a single target only. (#86637)
Ideally, header files should be used by only one target, but this is
hard because CMake is less strict with headers (no layering check). But
even with bazel, headers should only be exported once in the `hdrs`
attribute. Other targets may use them in the `srcs` attribute to avoid
circular dependencies.
2024-03-26 10:23:47 +01:00
Christian Sigg
cce18e40c0 [bazel] Fix BUILD after 2eb010ddce. 2024-03-25 20:57:22 +01:00
Keith Smiley
2eb010ddce [bazel] Restrict libpfm to linux (#86565)
This target doesn't build on macOS (even with the upstream make based
build system) so this encodes that in the build without requiring
non-linux users to disable it manually with the starlark flag. The flag
is still respected for linux users.
2024-03-25 12:47:16 -07:00
Keith Smiley
540bbe15e6 [bazel] Add td_library target for OptParser.td (#86363)
This allows downstream consumers to depend on this file. Without this
target the include paths to this are mangled by bazel.
2024-03-25 12:47:01 -07:00
Keith Smiley
f530eee448 [bazel] Fix minor buildifier warnings (NFC) (#86566) 2024-03-25 12:44:58 -07:00