2 Commits

Author SHA1 Message Date
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