aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeGenTarget.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-03-25[RFC][TableGen] Restructure TableGen Source (#80847)Pierre van Houtryve1-655/+0
Refactor of the llvm-tblgen source into: - a "Basic" library, which contains the bare minimum utilities to build `llvm-min-tablegen` - a "Common" library which contains all of the helpers for TableGen backends. Such helpers can be shared by more than one backend, and even unit tested (e.g. CodeExpander is, maybe we can add more over time) Fixes #80647
2024-03-11[TableGen] More efficiency improvements for encode/decode emission. (#84647)Jason Eckhardt1-2/+5
DecoderEmitter and CodeEmitterGen perform repeated linear walks over the entire instruction list. This patch eliminates two more such walks. The eliminated traversals visit every instruction merely to determine whether the target has variable length encodings. For a target with variable length encodings, the original any_of will terminate quickly. But all targets other than M68k use fixed length encodings and thus any_of must visit the entire instruction list.
2024-02-29[TableGen][CodeGenTarget] Add support for v3i8 and v3i1 MVTs. [NFCI] (#83140)Francesco Petrogalli1-0/+2
2024-02-14[TableGen] Stop using make_pair and make_tuple. NFC. (#81730)Jay Foad1-2/+2
These are unnecessary since C++17.
2024-02-09[NFC] clang-format utils/TableGen (#80973)Pierre van Houtryve1-32/+30
``` find llvm/utils/TableGen -iname "*.h" -o -iname "*.cpp" | xargs clang-format-16 -i ``` Split from #80847
2024-02-07[TableGen] Remove map CodeGenTarget::InstrToIntMap. (#81079)Jason Eckhardt1-4/+2
This patch removes CodeGenTarget::InstrToIntMap, using instead a new member CodeGenInstruction::EnumVal to store each enum value. This value is computed and set by CodeGenTarget::computeInstrsByEnum and queried by CodeGenTarget::getInstrIntValue.
2024-02-07[TableGen] Extend direct lookup to instruction values in generic tables. ↵Jason Eckhardt1-0/+7
(#80486) Currently, for some tables involving a single primary key field which is integral and densely numbered, a direct lookup is generated rather than a binary search. This patch extends the direct lookup function generation to instructions, where the integral value corresponds to the instruction's enum value. While this isn't as common as for other tables, it does occur in at least one downstream backend and one in-tree backend. Added a unit test and minimally updated the documentation.
2024-01-19[TableGen] Integrate TableGen-based macro fusion (#73115)Wang Pengcheng1-0/+1
`Fusion` is inherited from `SubtargetFeature` now. Each definition of `Fusion` will define a `SubtargetFeature` accordingly. Method `getMacroFusions` is added to `TargetSubtargetInfo`, which returns a list of `MacroFusionPredTy` that will be evaluated by MacroFusionMution. `getMacroFusions` will be auto-generated if the target has `Fusion` definitions.
2023-08-11[RFC][GlobalISel] Overhauled MIR Patterns Support for Combinerspvanhout1-1/+1
See https://discourse.llvm.org/t/rfc-overhauled-mir-patterns-for-globalisel-combiners/72264 This is a complete overrhaul of the recently-added GlobalISel Match Table backend which adds support for MIR patterns for both match and apply patterns. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D156315
2023-04-30[TableGen] Forward declare CodeGenRegister et al. (NFC)Sergei Barannikov1-0/+5
2023-03-15llvm-tblgen: Split out CodeGenIntrinsics.cpp from CodeGenTarget.cppNAKAMURA Takumi1-318/+0
Differential Revision: https://reviews.llvm.org/D143844
2023-03-02[AArch64][SME2] Add CodeGen support for target("aarch64.svcount").Sander de Smalen1-0/+1
This patch adds AArch64 CodeGen support such that the type can be passed and returned to/from functions, and also adds support to use this type in load/store operations and PHI nodes. Reviewed By: paulwalker-arm Differential Revision: https://reviews.llvm.org/D136862
2023-02-12llvm-tblgen: Apply IWYU in some filesNAKAMURA Takumi1-0/+5
2023-02-12CodeGenTarget.cpp: Reformat.NAKAMURA Takumi1-9/+10
2022-12-06[TableGen] llvm::Optional => std::optionalFangrui Song1-5/+3
2022-12-02[utils] Use std::nullopt instead of None (NFC)Kazu Hirata1-1/+1
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-29Add new vector types for LLVMMateja Marjanovic1-0/+8
Add v9i32, v9f32, v10i32, v10f32, v11i32, v11f32, v12i32 and v12f32. Differential Revision: https://reviews.llvm.org/D138136
2022-11-14[TableGen] Use MemoryEffects to represent intrinsic memory effects (NFCI)Nikita Popov1-10/+8
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-03[PowerPC] Add new DMR register classes to Future CPU.Stefan Pintilie1-0/+1
A new register class as well as a number of related subregisters are being added to Future CPU. These registers are Dense Math Registers (DMR) and are 1024 bits long. These regsiters can also be used in consecutive pairs which leads to a register that is 2048 bits. This patch also adds 7 new instructions that use these registers. More instructions will be added in future patches. Reviewed By: amyk, saghir Differential Revision: https://reviews.llvm.org/D136366
2022-10-11[TableGen] Change representation of ArgumentAttributes (NFC)Nikita Popov1-14/+25
Instead of a flat list that includes the argument index, use a nested vector, where each inner vector is the attribute set for a single argument. This is more obvious and makes followup changes simpler.
2022-09-13[ValueTypes] Define MVTs for v256i2/v128i4.Hendrik Greving1-0/+2
Adds MVT::v256i2, MVT::v128i4. Differential Revision: https://reviews.llvm.org/D133603
2022-09-08[llvm] Use std::size instead of llvm::array_lengthofJoe Loser1-1/+1
LLVM contains a helpful function for getting the size of a C-style array: `llvm::array_lengthof`. This is useful prior to C++17, but not as helpful for C++17 or later: `std::size` already has support for C-style arrays. Change call sites to use `std::size` instead. Differential Revision: https://reviews.llvm.org/D133429
2022-08-16[Intrinsics] Add initial support for NonNull attributeAlexander Shaposhnikov1-0/+3
Add initial support for NonNull attribute. (https://github.com/llvm/llvm-project/issues/57113) Test plan: verify that for __thread int x; int main() { int* y = &x; return *y; } (with this patch) clang -O -fsanitize=null -S -emit-llvm -o - doesn't emit a null-pointer check Differential revision: https://reviews.llvm.org/D131872
2022-06-22Rename GCCBuiltin into ClangBuiltinGuillaume Gomez1-2/+2
This patch is needed because developers expect "GCCBuiltin" items to be the GCC intrinsics equivalent and not the Clang internals. Reviewed By: #libc_abi, RKSimon, xbolva00 Differential Revision: https://reviews.llvm.org/D127460
2022-06-15[ValueTypes] Add types for nxv16bf16 and nxv32bf16.Craig Topper1-0/+2
This is needed by our downstream and makes bf16 and f16 have the same set of scalable vector types. Reviewed By: rui.zhang Differential Revision: https://reviews.llvm.org/D127877
2022-06-10[TableGen] const char *const x => const char x[]Fangrui Song1-1/+1
2022-06-02[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4.Hendrik Greving1-0/+6
Adds MVT::v128i2, MVT::v64i4, and implied MVT::i2, MVT::i4. Keeps MVT::i2, MVT::i4 lowering actions as expand, which should be removed once targets set this explicitly. Adjusts 11 lit tests to reflect slightly different behavior during DAG combine. Differential Revision: https://reviews.llvm.org/D125247
2022-06-01Revert "[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4."Hendrik Greving1-6/+0
This reverts commit 430ac5c3029c52e391e584c6d4447e6e361fae99. Due to failures in Clang tests. Differential Revision: https://reviews.llvm.org/D125247
2022-06-01[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4.Hendrik Greving1-0/+6
Adds MVT::v128i2, MVT::v64i4, and implied MVT::i2, MVT::i4. Keeps MVT::i2, MVT::i4 lowering actions as `expand`, which should be removed once targets set this explicitly. Adjusts 11 lit tests to reflect slightly different behavior during DAG combine. Differential Revision: https://reviews.llvm.org/D125247
2022-05-11[TableGen] Remove the use of global Record stateRiver Riddle1-1/+1
This commits removes TableGens reliance on managed static global record state by moving the RecordContext into the RecordKeeper. The RecordKeeper is now treated similarly to a (LLVM|MLIR|etc)Context object and is passed to static construction functions. This is an important step forward in removing TableGens reliance on global state, and in a followup will allow for users that parse tablegen to parse multiple tablegen files without worrying about Record lifetime. Differential Revision: https://reviews.llvm.org/D125276
2022-03-25Reapply "[Intrinsics] Add `nocallback` to the default intrinsic attributes"Johannes Doerfert1-0/+3
This reverts commit c5f789050daab25aad6770790987e2b7c0395936 and reapplies 7aea3ea8c3b33c9bb338d5d6c0e4832be1d09ac3 with additional test changes.
2022-03-24Revert "[Intrinsics] Add `nocallback` to the default intrinsic attributes"Johannes Doerfert1-3/+0
This reverts commit 7aea3ea8c3b33c9bb338d5d6c0e4832be1d09ac3 as it breaks the buildbots. I didn't see these failures in the pre-merge checks, looking into it.
2022-03-24[Intrinsics] Add `nocallback` to the default intrinsic attributesJohannes Doerfert1-0/+3
Most intrinsics, especially "default" ones, will not call back into the IR module. `nocallback` encodes this nicely. As it was not used before, this patch also makes use of `nocallback` in the Attributor which results in many more `norecurse` deductions. Tablegen part is mechanical, test updates by script. Differential Revision: https://reviews.llvm.org/D118680
2022-03-11Cleanup include: TableGenserge-sans-paille1-4/+1
This also includes a few cleanup from Support. Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D121331
2022-01-26Revert "Rename llvm::array_lengthof into llvm::size to match std::size from ↵Benjamin Kramer1-1/+1
C++17" This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2. - It conflicts with the existing llvm::size in STLExtras, which will now never be called. - Calling it without llvm:: breaks C++17 compat
2022-01-26Rename llvm::array_lengthof into llvm::size to match std::size from C++17serge-sans-paille1-1/+1
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no build breakage expected).
2021-12-03[TableGen][SelectionDAG] Use ComplexPattern type for non-leaf nodesJessica Clarke1-1/+1
When used as a non-leaf node, TableGen does not currently use the type of a ComplexPattern for type inference, which also means it does not check it doesn't conflict with the use. This differs from when used as a leaf value, where the type is used for inference. This addresses that discrepancy. The test case is not representative of most real-world uses but is sufficient to demonstrate inference is working. Some of these uses also make use of ValueTypeByHwMode rather than SimpleValueType and so the existing type inference is extended to support that alongside the new type inference. There are also currently various cases of using ComplexPatterns with an untyped type, but only for non-leaf nodes. For compatibility this is permitted, and uses the old behaviour of not inferring for non-leaf nodes, but the existing logic is still used for leaf values. This remaining discrepancy should eventually be eliminated, either by removing all such uses of untyped so the special case goes away (I imagine Any, or a more specific type in certain cases, would be perfectly sufficient), or by copying it to the leaf value case so they're consistent with one another if this is something that does need to keep being supported. All non-experimental targets have been verified to produce bit-for-bit identical TableGen output with this change applied. Reviewed By: kparzysz Differential Revision: https://reviews.llvm.org/D109035
2021-11-22Use std::string::substr (NFC)Kazu Hirata1-7/+4
2021-07-31[AArch64] Add a Machine Value Type for 8 consecutive registersAlexandros Lamprineas1-0/+1
Adds MVT::i64x8, a Machine Value Type needed for lowering inline assembly operands which materialize a sequence of eight general purpose registers. Differential Revision: https://reviews.llvm.org/D94096
2021-06-24[ValueTypes] Define MVTs for v3i64/v3f64 to complement v6i32/v6f32Carl Ritson1-0/+2
Having type symmetry with these is somewhat necessary when implementing support for 192-bit values. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D104621
2021-06-11[ValueTypes] Define MVTs for v6i32, v6f32, v7i32, v7f32Carl Ritson1-0/+4
For use in AMDGPU selection DAG. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D103881
2021-06-09[ValueTypes][RISCV] Cap RVV fixed-length vectors by sizeFraser Cormack1-0/+4
This patch changes RVV's policy for its supported list of fixed-length vector types by capping by vector size rather than element count. Now all 1024-byte vectors (of supported element types) are supported, rather than all 256-element vectors. This is a more natural fit for the architecture, and allows us to, for example, improve the support for vector bitcasts. This change necessitated the adding of some new simple types to avoid "regressing" on the number of currently-supported vectors. We round out the 1024-byte types by adding `v512i8`, `v1024i8`, `v512i16` and `v512f16`. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D103884
2021-06-09[ValueTypes] Add missing enum names for MVTsFraser Cormack1-0/+4
These types are (presumably) never used in the generated TableGen files. The `default` switch case silences any compiler warnings for these missing types so it's easy to miss. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D103883
2021-05-10[TableGen] Remove redundant `Error:` in msg (NFC)qixingxue1-2/+2
Since calling `PrintFatalError` will automatically add `error: ` prefix in the message printed, there is no need having an extra `ERROR:` prefix in the argument passed. Differential Revision: https://reviews.llvm.org/D102151 Reviewed By: Paul-C-Anagnostopoulos
2021-03-02[TableGen] Add IntrNoMerge as intrinsic propertyKrzysztof Parzyszek1-0/+3
There is a function attribute 'nomerge' in addition to 'noduplicate' and 'convergent'. Both 'noduplicate' and 'convergent' have corresponding intrinsic properties. This patch adds an intrinsic property for the 'nomerge' attribute. Differential Revision: https://reviews.llvm.org/D96364
2021-01-17[TableGen] Drop redundant const from return types (NFC)Kazu Hirata1-3/+1
Identified with readability-const-return-type.
2021-01-09[WebAssembly] Remove exnref and br_on_exnHeejin Ahn1-1/+0
This removes `exnref` type and `br_on_exn` instruction. This is effectively NFC because most uses of these were already removed in the previous CLs. Reviewed By: dschuff, tlively Differential Revision: https://reviews.llvm.org/D94041
2021-01-05[GlobalISel][TableGen] Fix ConstrainOperandRC bugGabriel Hjort Åkerlund1-1/+6
TableGen would pick the largest RC for constraining the operands, which could potentially be an unallocatable RC. This patch removes selection of unallocatable RCs. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D93945
2021-01-02[TableGen] Use llvm::append_range (NFC)Kazu Hirata1-2/+2
2021-01-01[llvm] Use *Map::lookup (NFC)Kazu Hirata1-5/+1