Commit Graph

15119 Commits

Author SHA1 Message Date
R3v0LT
3c619b615d Tblgen capstone backends - add Alpha architecture (#17) 2024-06-04 12:57:14 +00:00
Jacek Caban
76e1800f35 [llvm-lib][llvm-dlltool][Object] Add support for EXPORTAS name types. (#78772)
EXPORTAS is a new name type in import libraries. It's used by default on ARM64EC,
but it's allowed on other platforms as well.
2024-03-16 15:55:54 -07:00
Jacek Caban
77e1992e89 [llvm-readobj][Object][COFF] Print COFF import library symbol export name. (#78769)
getExportName implementation is based on lld-link. In its current form,
it's mostly about convenience, but it will be more useful for EXPORTAS
support, for which export name is not possible to deduce from other
printed properties.
2024-03-16 15:55:54 -07:00
Tom Stellard
4cc7a75aa6 [llvm-shlib] Change libLLVM-$MAJOR.so symlink to point to versioned SO (#82660)
This symlink was added in 91a384621e5b762d9c173ffd247cfeadd5f436a2 to
maintain backwards compatibility, but it needs to point to
libLLVM.so.$MAJOR.$MINOR rather than libLLVM.so. This works better for
distros that ship libLLVM.so and libLLVM.so.$MAJOR.$MINOR in separate
packages and also prevents mistakes like
libLLVM-19.so -> libLLVM.so -> libLLVM.so.18.1

Fixes #82647

(cherry picked from commit 10c48a772742b7afe665a815b7eba2047f17dc4b)
2024-02-26 16:57:21 -08:00
Wentao Zhang
95b6a7f2b3
Backport 0bf4f82 to release/18.x (#82571)
Manually cherry-pick 0bf4f82f661817c79bd538c82c99515837cf1cf8 (#80952)
and resolve conflicts

Closes #82570
2024-02-23 16:07:23 -08:00
Fangrui Song
4ba68ab9b4 [llvm-readobj,ELF] Support --decompress/-z (#82594)
When a section has the SHF_COMPRESSED flag, -p/-x dump the compressed
content by default. In GNU readelf, if --decompress/-z is specified,
-p/-x will dump the decompressed content. This patch implements the
option.

Close #82507

(cherry picked from commit 26d71d9ed56c4c23e6284dac7a9bdf603a5801f3)
2024-02-23 12:51:05 -08:00
Tom Stellard
235306ba1f [cmake] Add minor version to library SONAME (#79376)
We need to do this now that we are bumping the minor release number when
we create the release branch.

This also results in a slight change to the library names for LLVM. The
main library now has a more convential library name:
'libLLVM.so.$major.$minor'. The old library name: libLLVM-$major.so is
now a symlink that points to the new library. However, the symlink is
not present in the build directory. It is only present in the install
directory.

The library name was changed because it helped to keep the CMake changes
more simple.

Fixes #76273

(cherry picked from commit 91a384621e5b762d9c173ffd247cfeadd5f436a2)
2024-02-20 21:14:50 -08:00
Ulrich Weigand
5ef297ab61 [llvm-objcopy] Add SystemZ support (#81841)
This is also necessary for enabling ClangBuiltLinux:
https://github.com/ClangBuiltLinux/linux/issues/1530

(cherry picked from commit 3c02cb7492fc78fb678264cebf57ff88e478e14f)
2024-02-20 16:36:39 -08:00
Frederic Cambus
12114d2d5a [llvm-objdump] Add support for the PT_OPENBSD_SYSCALLS segment type. (#82121)
Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h
(cherry picked from commit 1b894864862d8049e4a2567a472efdc2eda1e035)
2024-02-20 11:59:21 -08:00
Frederic Cambus
3af6881cab [llvm-readobj] Add support for the PT_OPENBSD_SYSCALLS segment type. (#82122)
Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h
(cherry picked from commit a8d7511811c7d7c689c3e8f858e8e00a56aba152)
2024-02-20 11:57:09 -08:00
Stefan Gränitz
284570a985 [llvm-jitlink] Fix detectStubKind() for big endian systems (#79970)
This function is used in `jitlink-check` lines in LIT tests. In #78371 I
missed to swap initial instruction bytes for systems that store the
constants as big-endian.

(cherry picked from commit 8a5bdd899f3cb57024d92b96c16e805ca9924ac7)
2024-02-01 13:42:56 -08:00
paperchalice
7bda0ce15a
[llc] Remove C backend support (#79237)
C backend is removed in 3.1.
2024-01-24 10:40:11 +08:00
paperchalice
7e50f006f7
[NewPM][CodeGen][llc] Add NPM support (#70922)
Add new pass manager support to `llc`. Users can use
`--passes=pass1,pass2...` to run mir passes, and use `--enable-new-pm`
to run default codegen pipeline.
This patch is taken from [D83612](https://reviews.llvm.org/D83612), the
original author is @yuanfang-chen.

---------

Co-authored-by: Yuanfang Chen <455423+yuanfang-chen@users.noreply.github.com>
2024-01-24 09:27:25 +08:00
William Junda Huang
2b8649fbec
Added feature in llvm-profdata merge to filter functions from the profile (#78378)
`--function=<regex>` Include functions matching regex in the output
`--no-function=<regex>` Exclude functions matching regex from the output

If both are specified, `--no-function` has a higher precedence if a
function name matches both filters
2024-01-23 16:19:45 -05:00
Jeremy Morse
40bdfd39e3
[llvm-reduce][DebugInfo] Support reducing non-instruction debug-info (#78995)
LLVM will shortly be able to represent variable locations without
encoding information into intrinsics -- they'll be stored as DPValue
objects instead. We'll still need to be able to llvm-reduce these
variable location assignments just like we can with intrinsics today,
thus, here's an llvm-reduce pass that enumerates and reduces the DPValue
objects.

The test for this is paradoxically written with dbg.value intrinsics:
this is because we're changing all the core parts of LLVM to support
this first, with the textual IR format coming last. Until that arrives,
testing the llvm-reduce'ing of DPValues needs the added test using
intrinsics. We should be able to drop the variable assignment using
%alsoloaded using this method. As with the other llvm-reduce tests, I've
got one set of check lines for making the reduction happen as desired,
and the other set to check the final output.
2024-01-23 14:30:56 +00:00
Stefan Gränitz
626d0fa30a [llvm-jitlink-executor] Fix unused function warning with LLVM_ENABLE_THREADS=0 (NFC) 2024-01-23 11:49:41 +01:00
Alexey Lapshin
0ed8194256
[dsymutil] Add --linker parallel to more tests. (#78581)
This patch adds check for parallel linker to tests located in the root
of test/tools/dsymutil.
2024-01-23 13:00:49 +03:00
Aiden Grossman
7da7695839
[llvm-exegesis] Add additional validation counters (#76788)
This patch adds support for additional types of validation counters and
also adds mappings between these new validation counter types and
physical counters on the hardware for microarchitectures that I have the
ability to test on.
2024-01-23 00:06:46 -08:00
Kazu Hirata
8c3304453c [llvm-diff] Use llvm::predecessors (NFC) 2024-01-22 21:19:16 -08:00
Stefan Gränitz
e5ca202ef8
[JITLink][AArch32] Multi-stub support for armv7/thumbv7 (#78371)
We want to emit stubs that match the instruction set state of the
relocation site. This is important for branches that have no built-in
switch for the instruction set state. It's the case for Jump24
relocations. Relocations on instructions that support switching on
the fly will be rewritten in a relaxation step in the future. This
affects Call relocations on `BL`/`BLX` instructions.

In this patch, the StubManager gains a second stub symbol slot for each
target and selects which one to use based on the relocation type. For
testing, we select the appropriate slot with a stub-kind filter, i.e.
`arm` or `thumb`. With that we can implement Armv7 stubs and test
that we can have both kinds of stubs for a single external symbol.
2024-01-23 02:59:30 +01:00
Jeremy Morse
ff9627348e [NFC][DebugInfo] Set a testing flag to be hidden
This flag (--try-experimental-debuginfo-iterators) only exists for testing
purposes, to get some RUNlines running in new-debug-info mode before it's
properly supported. The flag isn't something that's going to be useful to
people using llvm 18, so hide it from the options list.
2024-01-22 23:30:49 +00:00
Stefan Gränitz
cd6ed95e48 Reland "[lli] Revisit Orc debug output tests (#79055)"
Integrate in-memory debug-info dumps into the `--orc-lazy-debug`
command-line option instead of exposing built-in functions to be called
from JITed code. This reduces overall amount of code (removing
`ExecutionUtils.cpp`) and seems cleaner anyway.

All existing items of `OrcDumpKind` work on IR level and run in the
IR-transform step of the JIT. The newly added `DumpDebugDescriptor` and
`DumpDebugObjects` must run after debug-registration and thus are
deferred to the Object-transform step of the JIT. This separation is the
major side-effect of the patch.

The original commit 263efb044a was reverted in #79055, because
the gcc 7.5 bot had found a missing std::move().
2024-01-22 22:46:27 +01:00
Mehdi Amini
3f3a3e873a
Revert "[lli] Revisit Orc debug output tests" (#79055)
Reverts llvm/llvm-project#76822

This fails to build with gcc 7.5:
```
llvm/tools/lli/lli.cpp:1087:16: error: could not convert ‘Obj’ from ‘std::unique_ptr<llvm::MemoryBuffer>’ to ‘llvm::Expected<std::unique_ptr<llvm::MemoryBuffer> >’
         return Obj;
                ^~~
```
2024-01-22 12:54:30 -08:00
Stefan Gränitz
263efb044a
[lli] Revisit Orc debug output tests (#76822)
Integrate in-memory debug-info dumps into the `--orc-lazy-debug`
command-line option instead of exposing built-in functions to be called
from JITed code. This reduces overall amount of code (removing
`ExecutionUtils.cpp`) and seems cleaner anyway.

All existing items of `OrcDumpKind` work on IR level and run in the
IR-transform step of the JIT. The newly added `DumpDebugDescriptor` and
`DumpDebugObjects` must run after debug-registration and thus are
deferred to the Object-transform step of the JIT. This separation is the
major side-effect of the patch.
2024-01-22 21:24:57 +01:00
Hana Dusíková
865e4a1f33
[coverage] skipping code coverage for 'if constexpr' and 'if consteval' (#78033)
`if constexpr` and `if consteval` conditional statements code coverage
should behave more like a preprocesor `#if`-s than normal
ConditionalStmt. This PR should fix that.

---------

Co-authored-by: cor3ntin <corentinjabot@gmail.com>
2024-01-22 12:50:20 +01:00
Nikita Popov
a43c192567 [llvm-jitlink] Use SmallVectorImpl when referencing StubInfos (NFC)
The element type is declared as SmallVector<T, 1>, but we assign to
SmallVector<T> &. These types are not the same on 32-bit systems,
resulting in a compilation error.

Fix this by using SmallVectorImpl<T> & instead, which is independent
of the small size.
2024-01-22 10:37:18 +01:00
Stefan Gränitz
6a433d77b1
[llvm-jitlink] Allow optional stub-kind filter in stub_addr() expressions (#78369)
We use `jitlink-check` lines in LIT tests as the primary tool for
testing JITLink backends. Parsing and evaluation of the expressions is
implemented in `RuntimeDyldChecker`. The `stub_addr(obj, name)`
expression allows to obtain the linker-generated stub for the external
symbol `name` in object file `obj`.

This patch adds support for a filter parameter to select one out of many
stubs. This is necessary for the AArch32 JITLink backend, which must be
able to emit two different kinds of stubs depending on the instruction
set state (Arm/Thumb) of the relocation site. Since the new parameter is
optional, we don't have to update existing tests.

Filters are regular expressions without brackets that match exactly one
existing stub. Given object file `armv7.o` with two stubs for external
function `ext` of kinds `armv7_abs_le` and `thumbv7_abs_le`, we get the
following filter results e.g.:
```
stub_addr(armv7.o, ext, thumb)        thumbv7_abs_le
stub_addr(armv7.o, ext, thumbv7)      thumbv7_abs_le
stub_addr(armv7.o, ext, armv7_abs_le) armv7_abs_le
stub_addr(armv7.o, ext, v7_.*_le)     Error: "ext" has 2 candidate stubs in file "armv7.o". Please refine stub-kind filter "v7_.*_le" for disambiguation (encountered kinds are "thumbv7_abs_le", "armv7_abs_le").
stub_addr(armv7.o, ext, v8)           Error: "ext" has 2 stubs in file "armv7.o", but none of them matches the stub-kind filter "v8" (all encountered kinds are "thumbv7_abs_le", "armv7_abs_le").
```
2024-01-20 09:57:03 +01:00
Jonas Devlieghere
593395f0da
[dsymutil] Fix spurious warnings in MachODebugMapParser (#78794)
When the MachODebugMapParser encounters an object file that cannot be
found on disk, it currently leaves the parser in an incoherent state,
resulting in spurious warnings that can in turn slow down dsymutil.

This fixes #78411.

rdar://117515153
2024-01-19 15:10:57 -08:00
Aiden Grossman
f9bc1ee3fc
[llvm-objdump] Add support for symbolizing PGOBBAddrMap Info (#76386)
This patch adds in support for symbolizing PGO information contained
within the SHT_LLVM_BB_ADDR_MAP section in llvm-objdump. The outputs are
simply the raw values contained within the section.
2024-01-19 14:28:31 -08:00
Aiden Grossman
2b31a673de
[llvm-exegesis] Make duplicate snippet repetitor produce whole snippets (#77224)
Currently, the duplicate snippet repetitor will truncate snippets that
do not exactly divide the minimum number of instructions. This patch
corrects that behavior by making the duplicate snippet repetitor
duplicate the snippet in its entirety until the minimum number of
instructions has been reached.

This makes the behavior consistent with the loop snippet repetitor,
which will execute at least `--num-repetitions` (soon to be renamed
`--min-instructions`) instructions.
2024-01-19 11:34:16 -08:00
Simon Pilgrim
836dcdb84a [llvm-jitlink] Fix MSVC "not all control paths return a value" warning. NFC. 2024-01-19 14:04:10 +00:00
Simon Pilgrim
aac1a41c11 [llvm-exegesis] Fix MSVC "not all control paths return a value" warning. NFC. 2024-01-19 14:04:09 +00:00
Alexey Lapshin
9ff4be640f
[DWARFLinker][NFC] Decrease DWARFLinker dependence on DwarfStreamer. (#77932)
This patch is extracted from #74725.

The DwarfStreamer interface looks overcomplicated and has unnecessary
dependencies. This patch avoids creation of DwarfStreamer by DWARFLinker and
simplifies interface.
2024-01-19 16:57:09 +03:00
Stefan Gränitz
01ba627f43
[llvm-jitlink] Refactor GOT and stubs registration (NFC) (#78365)
Add methods `registerGOTEntry()` and `registerStubEntry()` in
`Session::FileInfo` to factor out generic code from the individual
object type implementations.
2024-01-19 12:38:22 +01:00
Aiden Grossman
f670112a59
[llvm-exegesis] Add support for validation counters (#76653)
This patch adds support for validation counters. Validation counters can
be used to measure events that occur during snippet execution like cache
misses to ensure that certain assumed invariants about the benchmark
actually hold. Validation counters are setup within a perf event group,
so are turned on and off at exactly the same time as the "group leader"
counter that measures the desired value.
2024-01-19 02:00:33 -08:00
Kazu Hirata
c03c4e2b14 [tools] Use SmallString::operator std::string (NFC) 2024-01-19 00:19:31 -08:00
stephenpeckham
a7f9e92d07
Fix typo (#78587) 2024-01-18 08:57:10 -06:00
Alexey Lapshin
f1fdfe6888
[dsymutil][llvm-dwarfutil] Rename command line options to avoid using vendor names. (#78135)
This patch renames values of dsymutil/llvm-dwarfutil options:

--linker apple -> --linker classic
--linker llvm -> --linker parallel

The purpose to rename options is to avoid using vendor names and to
match with library names. It should be safe to rename options at current
stage as they are not seemed widely used(we may not preserve backward
compatibility).
2024-01-18 12:55:04 +03:00
Jacek Caban
b26bfcc1ec
[llvm-readobj][Object][COFF] Include COFF import file machine type in format string. (#78366) 2024-01-17 22:47:18 +01:00
Derek Schuff
103fa3250c
[WebAssembly] Use ValType instead of integer types to model wasm tables (#78012)
LLVM models some features found in the binary format with raw integers
and others with nested or enumerated types. This PR switches modeling of
tables and segments to use wasm::ValType rather than uint32_t. This NFC
change is in preparation for modeling more reference types, but IMO is
also cleaner and closer to the spec.
2024-01-17 11:29:19 -08:00
Alexandros Lamprineas
92289db82f
[VFABI] Move the Vector ABI demangling utility to LLVMCore. (#77513)
This fixes #71892 allowing us to check magled names in the IR verifier.
2024-01-17 09:55:30 +00:00
Aiden Grossman
16b2387982
[llvm-exegesis] Fix snippet value scaling (#77226)
Currently, BenchmarkRunner scales the per snippet counters by
multiplying the raw counter values by the number of instructions (casted
to a double) divided by the minimum number of instructions. This is
incorrect for the loop repetition mode for snippets that don't fit a
whole number of times into the minimum instruction count. For example,
with 3 instructions in the snippet and the minimum number of
instructions set to 4, the loop repetitor will execute a total of six
instructions, but BenchmarkRunner will scale the raw count by 3/4
instead of 3/6=1/2. This will also be incorrect for the duplicate
snippet repetitor after #77224.

This patch fixes this behavior by dividing the raw count by the ceiling
of the number of repetitions divided by the instruction count.
2024-01-16 11:49:17 -08:00
Aiden Grossman
a974303e0c
[llvm-exegesis] Refactor individual counter data to ConfiguredEvent (#77900)
This further sets things up for validation events. Having a separate
abstraction for a configured event that is setup as a counter allows for
much easier creation of more events in the future within a single
counter group (like validation counters) without duplicating any code.
2024-01-16 01:58:12 -08:00
Aiden Grossman
e366e04d5a
[llvm-exegesis] Refactor Counter to CounterGroup (#77887)
This refactoring gets things ready for validation counters where the
plan is to reuse the existing Counter infrastructure to contain event
groups that consist of a single event that is being measured along with
validation counters.
2024-01-16 01:24:22 -08:00
Kazu Hirata
44aa4d7d82 [dsymutil] Use StringRef::consume_front (NFC) 2024-01-15 21:59:09 -08:00
Brad Smith
2e0a105761
[CMake] Fix building on Haiku and Solaris after c0d5d36dda (#78084)
Haiku and Solaris need some additional libraries after the commit
c0d5d36dda

Otherwise fails to link a whole bunch of the tools and other binaries
with undefined symbols with accept() and connect().

I did a static and dynamic build on illumos and a dynamic build on
Haiku.

```
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;mlir'
```
and on illumos
```
-DLLVM_ENABLE_RUNTIMES='openmp'
```
2024-01-14 20:23:22 -05:00
Greg Clayton
4618ef8cf5
Allow the dumping of .dwo files contents to show up when dumping an executable with split DWARF. (#66726)
Allow the dumping of .dwo files contents to show up when dumping an
executable with split DWARF.

Currently if you run llvm-dwarfdump on a binary that has skeleton
compile units, you only see the skeleton compile units. Since the main
binary has the linked addresses it would be nice to be able to dump
DWARF from the .dwo files and how the resolved addresses instead of
showing the address index and "<unresolved>" in the output. This patch
adds an option that can be specified to dump the non skeleton DIEs named
--dwo.

Added the ability to use the following options with split dwarf as well:
  --name <name>
  --lookup <addr>
  --debug-info <die-offset>
2024-01-12 13:31:55 -08:00
Alexey Lapshin
35708b0754
[DWARFLinker][NFC] Rename libraries to match with directories name. (#77592)
It was noted that new DWARFLinker libraries do not follow naming
agreement -
https://github.com/llvm/llvm-project/pull/75925#issuecomment-1883301659
This patch rename libraries to match with the agreement.

Rename LLVMDWARFLinkerBase library into the LLVMDWARFLinker. Rename
LLVMDWARFLinker library into the LLVMDWARFLinkerClassic. Correct include
path according to the new directory structure.
2024-01-12 15:36:44 +03:00
Alexandre Ganea
3c6f47d6b8
[llvm-driver] Fix usage of InitLLVM on Windows (#76306)
Previously, some tools such as `clang` or `lld` which require strict
order for certain command-line options, such as `clang -cc1` or `lld
-flavor`, would not longer work on Windows, when these tools were linked
as part of `llvm-driver`. This was caused by `InitLLVM` which was part
of the `*_main()` function of these tools, which in turn calls
`windows::GetCommandLineArguments`. That function completly replaces
argc/argv by new UTF-8 contents, so any ajustements to argc/argv made by
`llvm-driver` prior to calling these tools was reset.

`InitLLVM` is now called by the `llvm-driver`. Any tool that
participates in (or is part of) the `llvm-driver` doesn't call
`InitLLVM` anymore.
2024-01-11 19:08:28 -05:00
Aiden Grossman
8ae8ae9674 [llvm-exegesis] Update validation counters enum
To be consistent with f65265ab77.
2024-01-10 15:32:08 -08:00