about summary refs log tree commit diff
path: root/compiler/rustc_smir/src/rustc_internal
AgeCommit message (Collapse)AuthorLines
2025-07-06move `stable_mir` back to its own crate and move `rustc_internal` to ↵Makai-295/+0
the`stable_mir` crate As part of this reorganization, some traits need to be moved from `rustc_smir::context::traits` to `stable_mir::unstable::internal_cx`. These traits are specifically designed for `InternalCx` to clarify the behavior of different functions that share the same name. This move is necessary to avoid orphan rule violations.
2025-07-04refactor: move `convert` to `unstable`Makai-1/+1
We want to keep StableMIR definitions and logic separate from any sort of conversion and usage of internal rustc code. So we bundle all unstable items that have no stability guarantees into `stable_mir::unstable`.
2025-07-04fix: resolve the unsoundnessMakai-5/+8
add a new trait `InternalCx`, which defines the methods that are fine to call from `RustcInternal`. `RustcInternal::internal()` then takes a `impl InternalCx<'tcx>` instead of `TyCtxt<'tcx>`. make `tcx` in `SmirCtxt` public, since we need to pass it to `RustcInternal::internal()` in `SmirInterface`.
2025-07-04refactor: move `IndexMap` to `rustc_smir`Makai-38/+1
we should no longer keep `IndexMap` in `rustc_internal`, as we've decided to migrate `rustc_internal` to `stable_mir` under a feature.
2025-07-04refactor: unify `Tables` implementation with bridge types and re-export ↵Makai-35/+1
`IndexedVal` define bridge types for `***Def`s. consolidate scattered `Tables` implementations into single inherent impl.
2025-07-04refactor: remove the `tcx` field in `Tables`Makai-1/+1
the only functionality of `Tables` is caching results. this commit moves calls to rustc queries from `Tables` to `SmirCtxt`.
2025-07-04refactor: move `convert` module to `stable_mir`Makai-659/+1
note that this commit delete `convert/error.rs`, we would use `SmirError::from_internal` instead. **Unresolved questions:** - There are still a few direct calls to rustc's internals scattered across `impl Stable`s, but most of them appear to be relatively stable, e.g., `mir::interpret::ConstAllocation::inner(self)` and `mir::syntax::SwitchTargets::otherwise(self)`.
2025-07-04refactor: move `IndexedVal` from `stable_mir` to `rustc_smir`Makai-2/+1
2025-07-04refactor: make `SmirInterface` a trait and impl it for `SmirContainer`Makai-1/+0
- rewrite all `SmirInterface` apis. - add `BridgeTys` to impl those associated types in `Bridge`. - move `**_def()` stuffs living in `impl Tables` from `rustc_internal` to `stable_mir`.
2025-07-03refactor: add `Tables<'tcx, B: Bridge>` and `SmirContainer`Makai-132/+25
2025-07-01Remove support for dyn*Michael Goulet-1/+0
2025-06-25compiler: Trim the misleading C from ExternAbi::CCmse*Jubilee Young-2/+2
2025-06-24Add rust-invalid ABIMichael Goulet-0/+1
2025-06-12add `extern "custom"` functionsFolkert de Vries-0/+1
2025-04-24Rollup merge of #140232 - nnethercote:rm-unnecessary-clones, r=SparrowLiiMatthias Krüger-8/+7
Remove unnecessary clones r? `@SparrowLii`
2025-04-24Rollup merge of #139852 - makai410:smir-refactor, r=celinvalMatthias Krüger-7/+13
StableMIR: Implement `CompilerInterface` This PR implements part of [the document](https://hackmd.io/``@celinaval/H1lJBGse0).`` With `TablesWrapper` wrapped by `CompilerInterface`, the stable-mir's TLV stores a pointer to `CompilerInterface`, while the rustc-specific TLV stores a pointer to tables.
2025-04-24Refactor `StableMir` to avoid some clones.Nicholas Nethercote-8/+7
Pass `args` to `run` instead of storing it in a field. This avoids the need to clone it within `run`. Also, change `args` from `Vec<String>` to `&[String]`, avoiding the need for some vecs and clones.
2025-04-23Make `SmirInterface` pub(crate) and rename `Context` to `SmirContext`Makai-4/+4
Co-authored-by: Celina G. Val <celinval@amazon.com>
2025-04-18Implement `SmirInterface`Makai-7/+13
- With `Context` wrapped by `SmirInterface`, the stable-mir's TLV stores a pointer to `SmirInterface`, while the rustc-specific TLV stores a pointer to tables. - This PR make the `rustc_smir` mod public.
2025-04-13import rustc_smir::rustc_internal in run_driver!zjp-0/+1
2025-04-13add missing `extern crate rustc_middle` in rustc_smir::run! docstringzjp-0/+2
2025-04-06remove compiler support for `extern "rust-intrinsic"` blocksSkgland-1/+0
2025-04-05let `rustc_smir` host `stable_mir` for refactoringMakai-0/+3
2025-04-01Implement `associated_items` api.makai410-0/+8
2025-03-06Remove the `Option` part of range ends in the HIROli Scherer-3/+1
2025-03-06Avoid having to handle an `Option` in the type systemOli Scherer-2/+2
2025-03-06Prefer a two value enum over boolOli Scherer-1/+2
2025-02-05Implement RustcInternal for RawPtrKindCarolyn Zech-1/+13
2025-01-23Remove RunCompilerbjorn3-2/+2
It has become nothing other than a wrapper around run_compiler.
2025-01-16Add gpu-kernel calling conventionFlakebi-0/+1
The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.
2024-12-17Auto merge of #134302 - bjorn3:remove_driver_queries, r=oli-obk,jieyouxubors-1/+1
Remove queries from the driver interface All uses of driver queries in the public api of rustc_driver have been removed in https://github.com/rust-lang/rust/pull/134130 already. This removes driver queries from rustc_interface and does a couple of cleanups around TyCtxt construction and entering enabled by this removal. Finishes the removal of driver queries started with https://github.com/rust-lang/rust/pull/126834.
2024-12-14Fix testsbjorn3-1/+1
2024-12-14Encode coroutine-closures in SMIRMichael Goulet-0/+8
2024-12-06Fix ui-fulldep testsbjorn3-2/+3
2024-11-09Pass TyCtxt instead of Queries to the after_analysis callbacksbjorn3-14/+13
There is no other query that may need to be called at that point anyway.
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-3/+3
2024-11-03compiler: Directly use rustc_abi in smir againJubilee Young-29/+29
2024-10-28stable_mir: Directly use types from rustc_abiJubilee Young-1/+1
2024-09-30Validate ExistentialPredicate argsMichael Goulet-9/+11
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-09-21add `C-cmse-nonsecure-entry` ABIFolkert de Vries-0/+1
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-1/+4
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+11
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-17Avoid comments that describe multiple `use` items.Nicholas Nethercote-0/+1
There are some comments describing multiple subsequent `use` items. When the big `use` reformatting happens some of these `use` items will be reordered, possibly moving them away from the comment. With this additional level of formatting it's not really feasible to have comments of this type. This commit removes them in various ways: - merging separate `use` items when appropriate; - inserting blank lines between the comment and the first `use` item; - outright deletion (for comments that are relatively low-value); - adding a separate "top-level" comment. We also entirely skip formatting for four library files that contain nothing but `pub use` re-exports, where reordering would be painful.
2024-07-11Remove extern "wasm" ABINikita Popov-1/+0
Remove the unstable `extern "wasm"` ABI (`wasm_abi` feature tracked in #83788). As discussed in https://github.com/rust-lang/rust/pull/127513#issuecomment-2220410679 and following, this ABI is a failed experiment that did not end up being used for anything. Keeping support for this ABI in LLVM 19 would require us to switch wasm targets to the `experimental-mv` ABI, which we do not want to do. It should be noted that `Abi::Wasm` was internally used for two things: The `-Z wasm-c-abi=legacy` ABI that is still used by default on some wasm targets, and the `extern "wasm"` ABI. Despite both being `Abi::Wasm` internally, they were not the same. An explicit `extern "wasm"` additionally enabled the `+multivalue` feature. I've opted to remove `Abi::Wasm` in this patch entirely, instead of keeping it as an ABI with only internal usage. Both `-Z wasm-c-abi` variants are now treated as part of the normal C ABI, just with different different treatment in adjust_for_foreign_abi.
2024-06-26Remove `f16` and `f128` ICE paths from smirTrevor Gross-0/+2
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-1/+1
AliasTy/AliasTerm/TraitRef/projection
2024-06-05Add `Ty` to `mir::Const::Ty`Boxy-1/+3
2024-06-04Split smir `Const` into `TyConst` and `MirConst`Boxy-26/+21