Commit Graph

11923 Commits

Author SHA1 Message Date
Ivan Kosarev fce7a7aa9f [AMDGPU][AsmParser] Refine parsing instruction operands.
Eliminates the need for working around optional and token operands being
mistakenly parsed as expressions.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D138492
2022-11-24 10:50:26 +00:00
Nico Weber 4ffc6f3b83 [bolt] Stop setting config.llvm_plugin_ext in lit.site.cfg.py.in
config.llvm_plugin_ext is used by lit to set the %pluginext
substitution. bolt's tests don't use %pluginext, so they don't
need to set config.llvm_plugin_ext.

Differential Revision: https://reviews.llvm.org/D138325
2022-11-22 20:29:14 -05:00
Sami Tolvanen cacd3e73d7 Add generic KCFI operand bundle lowering
The KCFI sanitizer emits "kcfi" operand bundles to indirect
call instructions, which the LLVM back-end lowers into an
architecture-specific type check with a known machine instruction
sequence. Currently, KCFI operand bundle lowering is supported only
on 64-bit X86 and AArch64 architectures.

As a lightweight forward-edge CFI implementation that doesn't
require LTO is also useful for non-Linux low-level targets on
other machine architectures, add a generic KCFI operand bundle
lowering pass that's only used when back-end lowering support is not
available and allows -fsanitize=kcfi to be enabled in Clang on all
architectures.

This relands commit eb2a57ebc7 with
fixes.

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D135411
2022-11-22 23:01:18 +00:00
David Tenty 2edc54eded [lit][AIX] Add LIBPATH to pass through env vars
AIX uses LIBPATH to specify the library search path in addition to
LD_LIBRARY_PATH, and a lot of users / tooling will use it
preferentially. In lit we currently pass through LD_LIBRARY_PATH but not
LIBPATH in the env on AIX, this patch corrects this inconsistency.

Differential Revision: https://reviews.llvm.org/D138510
2022-11-22 17:22:52 -05:00
dbakunevich 073aebc431 [Utils] Improved chunk-print-before-all.py script
As part of this patch, the ability to work with dump files
containing ir after passes received using the -print-after-all
option was added to script chunk-print-before-all.py.
The names of the output files have also been changed.
	Before: chunk-NUM.ll
	Now: NUM-STAGE-PASS_NAME.ll
NUM - sequence number of the pass operation.
STAGE - stage of the pass operation (for example: before, after, dump).
PASS_NAME - the name of the pass.
2022-11-23 01:11:54 +07:00
Dmitry Bushev 95ef005230 [RISCV][NFC] Mark rs1 in most memory instructions as memory operand.
Marking rs1 (memory offset base) as memory operand provides additional
semantic value to this operand that can be used by different tools
(e.g. llvm-exegesis).

This change does not affect neigther Isel nor assembler. However it
required some tweaks in tablegen compressed inst emmiter.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D136847
2022-11-22 16:42:44 +03:00
Nico Weber edbfb829ba [gn build] Add missing dep from check-bolt on llvm-bat-dump 2022-11-21 20:48:46 -05:00
Nico Weber 6bb781fa9a [gn build] Add build files for //bolt
Adds build files for libraries, tools, and tests -- everything except
the runtime.

Doesn't hook up bolt in the main BUILD.gn file yet -- I want to verify
that it builds on Linux, macOS, Windows before doing that. (I've only
checked on macOS so far.)

`ninja check-bolt` passes on macOS with this.
(I locally bumped the deployment target to macOS 10.12 for that. bolt/ uses
std::mutex quite a bit, which requires 10.12.)

Differential Revision: https://reviews.llvm.org/D138355
2022-11-21 19:45:54 -05:00
Nico Weber 281a5c7ef1 [llvm,polly,clang] Stop setting config.enable_shared in most places
Clang's lit.cfg.py reads this to add an "enable-shared" feature that
three of clang's lit tests use. Nothing else reads enable_shared, so
remove it from most lit.site.cfg.py.in files.

Differential Revision: https://reviews.llvm.org/D138301
2022-11-21 08:54:14 -05:00
Bjorn Pettersson 294fdd9903 [TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown size
When calculating the size of concatenated subregisters, and at least
one of the subregisters involved has an unknown size (-1), then the
concatenated size should be set to -1 as well.

This bug was found for an out-of-tree target.

Looking at lib/Target the only in-tree target that has a subregister
with unknown size is X86:
  X86RegisterInfo.td:  def sub_mask_0   : SubRegIndex<-1>;

But it looks like sub_mask_0 don't result in any concatenated subreg
index with faulty size if looking at X86SubRegIdxRanges[].

Differential Revision: https://reviews.llvm.org/D138341
2022-11-20 20:52:13 +01:00
Bjorn Pettersson a6cb924abc [TableGen] Let -register-info-debug dump Offset/Size for each SubRegIndex
This patch adds dumping of the Offset and Size info for each
SubRegIndex printed when using
  llvm-tblgen -gen-register-info -register-info-debug

It also updates the ConcatenatedSubregs.td to check those printouts,
including some new subreg definitions that show short-comings in
how the size is calculated when concatenating subregisters and at
least one has an incomplete size (-1). Today TableGen will just add
sizes together, resulting in MCRegisterInfo::getSubRegIdxSize()
returning a value that isn't -1 even if the combined subregister size
is unknown.

Differential Revision: https://reviews.llvm.org/D138340
2022-11-20 20:52:13 +01:00
Nico Weber 3b48a97b19 [gn build] port af8c49dc1e 2022-11-20 12:02:33 -05:00
Nico Weber 7c188afde1 [gn build] Reformat all build files
Ran:

    git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
2022-11-19 11:54:55 -05:00
Simon Pilgrim 5acc03cdf3 [TableGen] SubtargetEmitter.cpp - clang-format includes sorting. NFC. 2022-11-19 16:49:10 +00:00
Nico Weber 63f79fe2eb [gn build] port 7059a6c32c 2022-11-18 06:48:51 -05:00
Fangrui Song fc91c70593 Revert D135411 "Add generic KCFI operand bundle lowering"
This reverts commit eb2a57ebc7.

llvm/include/llvm/Transforms/Instrumentation/KCFI.h including
llvm/CodeGen is a layering violation. We should use an approach where
Instrumementation/ doesn't need to include CodeGen/.
Sorry for not spotting this in the review.
2022-11-17 22:45:30 +00:00
Sami Tolvanen eb2a57ebc7 Add generic KCFI operand bundle lowering
The KCFI sanitizer emits "kcfi" operand bundles to indirect
call instructions, which the LLVM back-end lowers into an
architecture-specific type check with a known machine instruction
sequence. Currently, KCFI operand bundle lowering is supported only
on 64-bit X86 and AArch64 architectures.

As a lightweight forward-edge CFI implementation that doesn't
require LTO is also useful for non-Linux low-level targets on
other machine architectures, add a generic KCFI operand bundle
lowering pass that's only used when back-end lowering support is not
available and allows -fsanitize=kcfi to be enabled in Clang on all
architectures.

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D135411
2022-11-17 21:55:00 +00:00
LLVM GN Syncbot ed4943d560 [gn build] Port 332c4af35d 2022-11-16 15:19:13 +00:00
Muhammad Omair Javaid 332c4af35d Revert "[NFC] Make format() more amenable to format attributes"
This reverts commit cf239c2f17.
It has broken tools/llvm-dwarfdump/X86/simplified-template-names.s on
following buildbot:
https://lab.llvm.org/buildbot/#/builders/178/builds/3148
2022-11-16 19:09:49 +04:00
Paul Robinson 56470b72f1 [lit] Add `target=<triple>` as a feature keyword
As proposed first in D107162 and later in discourse at
https://discourse.llvm.org/t/rfc-lits-requires-and-triples/66041

Modified a couple of lit's own tests to use this; left others as-is,
because for now triple substrings still work in UNSUPPORTED/XFAIL.

Differential Revision: https://reviews.llvm.org/D137434
2022-11-16 05:50:45 -08:00
LLVM GN Syncbot e611d41143 [gn build] Port 617277e7cb 2022-11-16 06:08:50 +00:00
Woody Lin 409eaff5dd [AArch64InstPrinter] Print TargetAddress as an uint64_t
Outputs readable addresses by printed 'TargetAddress' as an uint64_t
value.

`bl     -0x37efd56628` => `bl     0xffffffc8102a99d8`

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D137260
2022-11-16 13:34:22 +08:00
LLVM GN Syncbot 8d0b2f09a2 [gn build] Port a16bd4f9f2 2022-11-15 22:46:53 +00:00
LLVM GN Syncbot b7d9310128 [gn build] Port 4be39288f5 2022-11-15 22:46:52 +00:00
Nico Weber 20b0e0a71a [gn build] Stop defining GTEST_LANG_CXX11, pass /Zc:__cplusplus with msvc
Ports:
* https://reviews.llvm.org/D84023
* https://reviews.llvm.org/rG4f5ccc72f6a6e
  (but see https://reviews.llvm.org/rG4901199f5b84b223)

No intended behavior change.
2022-11-15 10:56:53 -05:00
Nico Weber 1b829c3d3a [gn build] Make libcxx_enable_debug_mode work better, maybe
Refer to _LIBCPP_ENABLE_DEBUG_MODE instead of the old _LIBCPP_DEBUG
in a comment, and write that to __config_site correctly too.

See 13ea134323 and the comments in https://crbug.com/1358646.

Also change the default of libcxx_enable_debug_mode to false for now.
Since we used to not write _LIBCPP_ENABLE_DEBUG_MODE, the previous
default of true had no effect (except for compiling debug.cpp and
legacy_debug_handler.cpp, which we now no longer build by default).
So this (mostly) preserves previous behavior.
2022-11-15 10:45:41 -05:00
Martin Storsjö b95f54350c [lit] [Windows] Print exit codes > 255 as hex too
891bb4872c made negative exit codes
be printed as hex, which makes it easier to recognize e.g.
0xC0000005 instead of -1073741819. However, current Python versions
(at least the ones I'm using) seem to end up with positive unsigned
return codes, so that again ends up printed as 3221225477.

Print any return code over 255 as a hexadecimal number instead.

Differential Revision: https://reviews.llvm.org/D137771
2022-11-15 12:09:32 +02:00
LLVM GN Syncbot a4ae029b08 [gn build] Port 1ebfe9b264 2022-11-15 09:07:55 +00:00
Matt Arsenault a583654a8b GlobalISel: Add debug print for applied rule in generated combiner 2022-11-14 15:59:05 -08:00
LLVM GN Syncbot c83c69dd0d [gn build] Port d52e2839f3 2022-11-14 14:05:19 +00:00
LLVM GN Syncbot 7e4cfcdb6f [gn build] Port dd46a08008 2022-11-14 10:12:18 +00:00
Nikita Popov feda983ff8 [TableGen] Use MemoryEffects to represent intrinsic memory effects (NFCI)
The TableGen implementation was using a homegrown implementation of
FunctionModRefInfo. This switches it to use MemoryEffects instead.
This makes the code simpler, and will allow exposing the full
representational power of MemoryEffects in the future. Among other
things, this will allow us to map IntrHasSideEffects to an
inaccessiblemem readwrite, rather than just ignoring it entirely
in most cases.

To avoid layering issues, this moves the ModRef.h header from IR
to Support, so that it can be included in the TableGen layer.

Differential Revision: https://reviews.llvm.org/D137641
2022-11-14 10:52:04 +01:00
Nico Weber 6e8f8b1964 [gn build] Extract gen_arch_intrinsics() template to remove some duplication
No behavior change.

Differential Revision: https://reviews.llvm.org/D137784
2022-11-13 09:38:53 -05:00
Fangrui Song ff1ebcc5fe DecoderEmitter: Simplify addOneOperandFields. NFC
Follow-up to d1fbdf5bf7
2022-11-13 01:15:54 -08:00
Fangrui Song dc4a7293a8 [TableGen] Remove unneeded flush and add missing newline 2022-11-13 00:48:47 -08:00
Tom Stellard a7ba84a39d cmake: Inline the add_llvm_symbol_exports.py script
This fixes stand-alone builds.

Reviewed By: andrewng

Differential Revision: https://reviews.llvm.org/D137611
2022-11-10 13:18:47 -08:00
Konrad Kleine fd8ba4f537 [release] Add third-party tarball to release for standalone builds
With the advent of https://reviews.llvm.org/D131919 and
a11cd0d94e
 the third-party directory is required to build LLVM and other packages and in standalone
builds the third-party directory is not available from the llvm tarball anymore.

Differential Revision: https://reviews.llvm.org/D137777
2022-11-10 20:55:19 +01:00
Nico Weber 369237abc4 [gn build] port e1b88c8a09 (clang resource dir uses only major version) 2022-11-10 10:13:59 -05:00
LLVM GN Syncbot baf4930fb0 [gn build] Port 85f08c4197 2022-11-10 13:53:38 +00:00
LLVM GN Syncbot f9256fca66 [gn build] Port 135a9272a4 2022-11-10 13:53:37 +00:00
Nico Weber c3c94a885c [gn build] port b60f801607 2022-11-10 08:53:12 -05:00
Ivan Kosarev ef848f27d7 [AsmParser] Match mandatory operands following optional operands.
Currently, the asm parser stops matching instruction operands as soon as
the first optional operand is encountered. This leads to the need for
custom checks on missing mandatory operands that come after optional
operands.

The patch changes the parser to always match all optional and mandatory
instruction operands, thus making the custom checks unnecessary. This is
particularly useful for the AMDGPU backend where we have numerous
optional instruction modifiers.

Differential Revision: https://reviews.llvm.org/D137549
2022-11-10 12:49:27 +00:00
Ivan Kosarev af6b1f797f [AsmParser] Match mandatory operands following optional operands.
Currently, the asm parser stops matching instruction operands as soon as the first optional operand is encountered. This leads to the need for custom checks on missing mandatory operands that come after optional operands.

The patch changes the parser to always match all optional and mandatory instruction operands, thus making the custom checks unnecessary. This is particularly useful for the AMDGPU backend where we have numerous optional instruction modifiers.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D137549
2022-11-10 12:48:11 +00:00
Nico Weber ce2474ff60 [gn build] port a11cd0d94e (gtest llvm/utils/unittest -> third-party/unittest) 2022-11-09 19:58:28 -05:00
Tom Stellard a11cd0d94e Move googletest to the third-party directory
Rre-commit of 59052468c3 with a typo
fix in compiler-rt/CMakeLists.txt
2022-11-09 15:28:08 -08:00
Tom Stellard 8a084f68c8 Revert "Move googletest to the third-party directory"
This reverts commit 59052468c3.

It looks like this patch breaks the build when compiler-rt is passed to
LLVM_ENABLE_PROJECTS instead of LLVM_ENABLE_RUNTIMES.
2022-11-09 11:34:59 -08:00
Tom Stellard 59052468c3 Move googletest to the third-party directory
This will help improve the project's layering, so that sub-projects
that don't actually need any llvm code can still use googletest
without having to reference code in the llvm directory.

This will also make it easier to consolidate and simplify the standalone
build configurations.

Reviewed By: stellaraccident, lattner, probinson, phosek

Differential Revision: https://reviews.llvm.org/D131919
2022-11-09 11:10:26 -08:00
Trass3r 2e30d326de [Visualizers] Add natvis visualizers for various internal llvm classes
Also improve DisplayStrings for array and string types.

Differential Revision: https://reviews.llvm.org/D135685
2022-11-08 20:44:46 +00:00
LLVM GN Syncbot ec9aae9784 [gn build] Port 428ac8f3a0 2022-11-07 23:22:09 +00:00
Michał Górny 6106816459 Revert "[llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport"
This reverts commit b6be37b0be.  Still
breaks flang.
2022-11-06 09:06:16 +01:00