summaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp
AgeCommit message (Collapse)Author
2025-11-18Extend MemoryEffects to Support Target-Specific Memory Locations (#148650)CarolineConcatto
This patch introduces preliminary support for additional memory locations. They are: target_mem0 and target_mem1 and they model memory locations that cannot be represented with existing memory locations. It was a solution suggested in : https://discourse.llvm.org/t/rfc-improving-fpmr-handling-for-fp8-intrinsics-in-llvm/86868/6 Currently, these locations are not yet target-specific. The goal is to enable the compiler to express read/write effects on these resources.
2025-11-17[LLVM-Tablegen] Pretty Printing Arguments in LLVM Intrinsics (#162629)Dharuni R Acharya
This patch adds LLVM infrastructure to support pretty printing of the intrinsic arguments. The motivation is to improve the readability of LLVM intrinsics and facilitate easy modifications and debugging of LLVM IR. This feature adds a property `ArgInfo<ArgIndex, [ArgName<"argName">, ImmArgPrinter<"functionName">]>` to the intrinsic arguments to print self-explanatory inline comments for the arguments. The addition of pretty print support can provide a simple, low-overhead feature that enhances the usability of LLVM intrinsics without disrupting existing workflows. Link to the RFC, where this feature was discussed: https://discourse.llvm.org/t/rfc-pretty-printing-immediate-arguments-in-llvm-intrinsics/88536 --------- Signed-off-by: Dharuni R Acharya <dharunira@nvidia.com> Co-authored-by: Rahul Joshi <rjoshi@nvidia.com>
2025-11-04[IR] Add new function attribute nocreateundeforpoison (#164809)Jay Foad
Also add a corresponding intrinsic property that can be used to mark intrinsics that do not introduce poison, for example simple arithmetic intrinsics that propagate poison just like a simple arithmetic instruction. As a smoke test this patch adds the new property to llvm.amdgcn.fmul.legacy.
2025-10-23[LLVM][Intrinsics] Print note if manual name matches default name (#164716)Rahul Joshi
Print a note when the manually specified name in an intrinsic matches the default name it would have been assigned based on the record name, in which case the manual specification is redundant and can be eliminated. Also remove existing redundant manual names.
2025-09-26[Intrinsic] Unify IIT_STRUCT{2-9} into ITT_STRUCT to support upto 257 return ↵Michael Liao
values - Currently, Intrinsic can only have up to 9 return values. In case new intrinsics require more than 9 return values, additional ITT_STRUCTxxx values need to be added to support > 9 return values. Instead, this patch unifies them into a single IIT_STRUCT followed by a BYTE specifying the minimal 2 (encoded as 0) and maximal 257 (encoded as 255) return values.
2025-05-12[NFC][TableGen] Add {} for `else` when `if` body has {} (#139420)Rahul Joshi
2025-04-17[Intrinsics] Add support for range attributes (#135642)Nikita Popov
Add support for specifying range attributes in Intrinsics.td. Use this to specify the ucmp/scmp range [-1,2). This case is trickier than existing intrinsic attributes, because we need to create the attribute with the correct bitwidth. As such, the attribute construction now needs to be aware of the function type. We also need to be careful to no longer assign attributes on intrinsics with invalid signatures, as we'd make invalid assumptions about the number of arguments etc otherwise. Fixes https://github.com/llvm/llvm-project/issues/130179.
2024-12-03[LLVM][TableGen] Refine overloaded intrinsic suffix check (#117957)Mason Remy
Previously the check comments indicated that [pi][0-9]+ would match as a type suffix, however the check itself was looking for [pi][0-9]* and hence an 'i' suffix in isolation was being considered as a type suffix despite it not having a bitwidth. This change makes the check consistent with the comment and looks for [pi][0-9]+
2024-10-18[LLVM][TableGen] Change all `Init` pointers to const (#112705)Rahul Joshi
This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-10-15[LLVM][TableGen] Check overloaded intrinsic mangling suffix conflicts (#110324)Rahul Joshi
Check name conflicts between intrinsics caused by mangling suffix. If the base name of an overloaded intrinsic is a proper prefix of another intrinsic, check if the other intrinsic name suffix after the proper prefix can match a mangled type and issue an error if it can.
2024-10-05[NFC][TableGen] Change `CodeGenIntrinsics` to use const references (#111219)Rahul Joshi
Change `CodeGenIntrinsics` classes to vend out const references to `CodeGenIntrinsic` or `TargetSet` objects.
2024-09-25[LLVM][TableGen] Check name conflicts between target dep and independent ↵Rahul Joshi
intrinsics (#109826) Validate that for target independent intrinsics the second dotted component of their name (after the `llvm.`) does not match any existing target names (for which atleast one intrinsic has been defined). Doing so is invalid as LLVM will search for that intrinsic in that target's intrinsic table and not find it, and conclude that its an unknown intrinsic.
2024-09-19[LLVM][TableGen] Speed up sorting of intrinsics (#109230)Rahul Joshi
Speed up sorting of intrinsics by using the TargetPrefix to only discriminate beteween target dependent vs target independent intrinsics where target independent ones need to be sorted before target dependent ones. When comparing two target dependent intrinsics, the Name already includes `llvm.<TargetPrefix>` as a prefix, so no need to needlessly compare it separately.
2024-09-19[LLVM][TableGen] Add error check for duplicate intrinsic names (#109226)Rahul Joshi
Check for duplicate intrinsic names in the intrinsic emitter backend and issue a fatal error if we find one.
2024-09-05[TableGen] Add const variants of accessors for backend (#106658)Rahul Joshi
Split RecordKeeper `getAllDerivedDefinitions` family of functions into two variants: (a) non-const ones that return vectors of `Record *` and (b) const ones, that return vector/ArrayRef of `const Record *`. This will help gradual migration of TableGen backends to use `const RecordKeeper` and by implication change code to work with const pointers and better const correctness. Existing backends are not yet compatible with the const family of functions, so change them to use a non-constant `RecordKeeper` reference, till they are migrated.
2024-09-05[TableGen] Add check for number of intrinsic return values (#107326)Rahul Joshi
Fail if we see an intrinsic that returns more than the supported number of return values. Intrinsics can return only upto a certain nyumber of values, as defined by the `IIT_RetNumbers` list in `Intrinsics.td`. Currently, if we define an intrinsic that exceeds the limit, llvm-tblgen crashes. Instead, read this limit and fail if it's exceeded with a proper error message.
2024-09-04[TableGen] Refactor Intrinsics record (#106986)Rahul Joshi
Eliminate unused `isTarget` field in Intrinsic record. Eliminate `isOverloaded`, `Types` and `TypeSig` fields from the record, as they are already available through the `TypeInfo` field. Change intrinsic emitter code to look for this info using fields of the `TypeInfo` record attached to the `Intrinsic` record. Fix several intrinsic related unit tests to source the `Intrinsic` class def from Intrinsics.td as opposed to defining a skeleton in the test. This eliminates some duplication of information in the Intrinsic class, as well as reduces the memory allocated for record fields, resulting in ~2% reduction (though that's not the main goal).
2024-09-04[TableGen] Add `CodeGenIntrinsicsMap` for on-demand intrinsic creation (#107100)Rahul Joshi
- Add class `CodeGenIntrinsicMap` for on-demand creation of `CodeGenIntrinsic`. - Add class `CodeGenIntrinsicContext` to capture global information required to build `CodeGenIntrinsic` objects. - Adopt GlobalISel PatternParser and SearchableTableEmitter to use it.
2024-08-16[TableGen] Refactor Intrinsic handling in TableGen (#103980)Rahul Joshi
CodeGenIntrinsic changes: - Use `const` Record pointers, and `StringRef` when possible. - Default initialize several fields with their definition instead of in the constructor. - Simplify various string checks in the constructor using StringRef starts_with()/ends_with() functions. - Eliminate first argument to `setDefaultProperties` and use `TheDef` class member instead. IntrinsicEmitter changes: - Emit `namespace llvm::Intrinsic` instead of nested namespaces. - End generated comments with a . - Use range based for loops, and early continue within loops. - Emit `static constexpr` instead of `static const` for arrays. - Change `compareFnAttributes` to use std::tie() to compare intrinsic attributes and return a default value when all attributes are equal. STLExtras: - Add std::replace wrapper which takes a range.
2024-06-03[TableGen] CodeGenIntrinsic - pass DefaultProperties as ArrayRef instead of ↵Simon Pilgrim
std::vector by value. Avoid std::vector copies as setDefaultProperties just iterates across the Records Fixes #89207
2024-03-25[RFC][TableGen] Restructure TableGen Source (#80847)Pierre van Houtryve
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