4 Commits

Author SHA1 Message Date
Marco Elver
637f206241
[Support] Add getAllocTokenModeAsString() helper (#169650)
Add a helper function getAllocTokenModeAsString() to convert
AllocTokenMode values to their string representation.

NFC.
2025-11-26 14:58:38 +01:00
Marco Elver
ab7145231b
[Support] Permit "default" string in AllocToken mode parsing (#169351)
Update getAllocTokenModeFromString() to recognize "default" as a valid
mode string, mapping it to `DefaultAllocTokenMode`.
2025-11-24 17:33:51 +01:00
Marco Elver
29623f1e98
[AllocToken] Make token mode a pass parameter (#163634)
Refactor the AllocToken pass to accept the mode via pass options rather
than LLVM cl::opt. This is both cleaner, but also required to make the
mode frontend-driven and avoid potential inconsistencies.
2025-10-22 11:23:02 +02:00
Marco Elver
eeffaf110e
[AllocToken] Refactor stateless token calculation into Support (#163633)
Refactor the stateless (hash-based) token calculation logic out of the
`AllocToken` pass and into `llvm/Support/AllocToken.h`.

This helps with making the token calculation logic available to other
parts of the codebase, which will be necessary for frontend
implementation of `__builtin_infer_alloc_token` to perform constexpr
evaluation.

The `AllocTokenMode` enum and a new `AllocTokenMetadata` struct are
moved into a shared header. The `getAllocTokenHash()` function now
provides the source of truth for calculating token IDs for `TypeHash`
and `TypeHashPointerSplit` modes.
2025-10-22 10:27:55 +02:00