summary refs log tree commit diff
path: root/compiler/rustc_smir/src/rustc_internal
AgeCommit message (Collapse)AuthorLines
2023-12-18Add function ABI and type layout to StableMIRCelina G. Val-0/+15
This change introduces a new module to StableMIR named `abi` with information from `rustc_target::abi` and `rustc_abi`, that allow users to retrieve more low level information required to perform bit-precise analysis. The layout of a type can be retrieved via `Ty::layout`, and the instance ABI can be retrieved via `Instance::fn_abi()`. To properly handle errors while retrieve layout information, we had to implement a few layout related traits.
2023-12-04Finish implementing `RustcInternal` for `TyKind`Celina G. Val-12/+185
This will allow us to provide methods to create `Ty` inside the stable MIR, which can be helpful while handling pointers and other stuff.
2023-12-04Add Variant and a few more APIs to stable_mirCelina G. Val-5/+17
2023-11-24Move the compiler interface defs to its own moduleCelina G. Val-1/+1
Separate items that are exposed in the `stable_mir` crate to be used by the compiler from items that we expect to be used by tool developers.
2023-11-24Break down `rustc_smir/mod.rs` fileCelina G. Val-1/+1
This file was getting too big and causing a lot of merge conflicts. All these changes shouldn't be visible to users since this module is private.
2023-11-22Provide conversion of stable span to internal spanCelina G. Val-2/+10
This will allow users to use rustc span messages to display user friendly messages.
2023-11-21Add support to get virtual table allocationCelina G. Val-3/+25
2023-11-21Add support to global allocation to stable-mirCelina G. Val-2/+3
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-20Improve code per PR commentsCelina G. Val-5/+1
- Simplified DefTy::internal - Break down place::ty() method
2023-11-20Add place.ty() and Ty build from a kind to smirCelina G. Val-2/+89
2023-11-17use new apis and add new functionouz-a-1/+1
2023-11-17move pretty into stable_mirOğuz Ağcayazı-299/+11
2023-11-17change smir to StableMirOğuz Ağcayazı-15/+27
2023-11-17remove unwrapOğuz Ağcayazı-10/+15
2023-11-17better formatting for statementsOğuz Ağcayazı-23/+46
2023-11-17cover statementsOğuz Ağcayazı-26/+155
2023-11-17emit basic smirOğuz Ağcayazı-0/+140
2023-11-16Add more SMIR internal impl and callback return valueCelina G. Val-13/+147
In cases like Kani, we will invoke the rustc_internal run command directly for now. It would be handly to be able to have a callback that can return a value. We also need extra methods to convert stable constructs into internal ones, so we can break down the transition into finer grain commits.
2023-11-10add CoroutineWitness to covered typesOğuz Ağcayazı-0/+4
2023-11-09Fix typo in internal.rsIkko Eltociear Ashimine-1/+1
covert -> convert
2023-10-24Use IndexMap for handling stable TyCelina G. Val-2/+2
2023-10-24Remove fold code and add Const::internal()Celina G. Val-8/+15
We are not planning to support user generated constant in the foreseeable future, so we are removing the Fold logic for now in favor of the Instance::resolve logic. The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that. I decided to keep the Const fields private in case we decide to translate them lazily.
2023-10-23Add test and remove double refCelina G. Val-3/+3
2023-10-23Remove unsafe and `Rc`Celina G. Val-13/+9
2023-10-23Add `internal()` method counterpart to `stable()`Celina G. Val-1/+5
Note: We do not expect to provide internalizing methods for all StableMIR constructs. They exist only to help migrating efforts to allow users to mix StableMIR and internal constructs.
2023-10-23Add method to convert internal to stable constructsCelina G. Val-12/+46
2023-10-23Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`Oli Scherer-58/+72
2023-10-21Rollup merge of #116964 - celinval:smir-mono-body, r=oli-obkMatthias Krüger-0/+71
Add stable Instance::body() and RustcInternal trait The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed. The tests here are very simple, and I'm planning on creating more exhaustive tests in the project-mir repo. But I was hoping to get some feedback here first. r? ```@oli-obk```
2023-10-20s/generator/coroutine/Oli Scherer-1/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-2/+2
2023-10-19Add stable Instance::body() and RustcInternal traitCelina G. Val-0/+71
The `Instance::body()` returns a monomorphized body. For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal. Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed.
2023-10-16Add MonoItems and Instance to stable_mirCelina G. Val-4/+24
Also add a few methods to instantiate instances and get an instance definition. We're still missing support to actually monomorphize the instance body.
2023-10-10add new wrapper for FxIndexMapOğuz Ağcayazı-28/+38
2023-10-09spans are now indexmappedOğuz Ağcayazı-10/+8
2023-10-09alloc id is indexmappedOğuz Ağcayazı-7/+8
2023-10-09defids are indexmappedOğuz Ağcayazı-10/+15
2023-10-06Remove unnecessary `pub`.Nicholas Nethercote-1/+1
2023-09-28add RegionDefouz-a-0/+4
2023-09-25Split out the stable part of smir into its own crate to prevent accidental ↵Oli Scherer-3/+3
usage of forever unstable things
2023-09-25Move `Opaque` to `stable_mir`Oli Scherer-21/+0
2023-09-25Eliminate escape hatchOli Scherer-0/+9
2023-09-25Eliminate `with_tables` helperOli Scherer-58/+1
2023-09-14span is indexouz-a-1/+16
2023-09-10Remove EarlyErrorHandler argument from after_analysis callbackbjorn3-2/+0
It is only used by miri which can create a new one using the Session.
2023-09-05Add tests and use ControlFlowCelina G. Val-32/+27
2023-09-05SMIR: Allow users to pick if compilation continuesCelina G. Val-8/+20
Currently we stop compilation, but some users might want to keep going. This is needed for us to test against rustc tests. Other tools, such as Kani, also implements parts of their logic as a backend so it is important for compilation to continue.
2023-09-05Diferentiate between ICE and compilation errorCelina G. Val-6/+8
2023-09-05Adjust StableMIR interface to return and not crashCelina G. Val-10/+25
Invoking StableMir::run() on a crate that has any compilation error was crashing the entire process. Instead, return a `CompilerError` so the user knows compilation did not succeed. I believe ICE will also be converted to `CompilerError`. I'm also adding a return value to the callback, because I think it will be handy for users (at least it was for my current task of implementing a tool to validate stable-mir). However, if people disagree, I can remove that.
2023-09-03Auto merge of #115470 - ericmarkmartin:stable-prov, r=oli-obkbors-1/+16
add stable provenance r? `@spastorino` implements rust-lang/project-stable-mir#22