about summary refs log tree commit diff
path: root/compiler/stable_mir/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-12-20Add `ItemKind::Ctor` to stable mirCelina G. Val-0/+7
2023-12-18Add function ABI and type layout to StableMIRCelina G. Val-0/+1
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-07Add instance evaluation and methods to read allocCelina G. Val-0/+1
The instance evaluation is needed to handle intrinsics such as `type_id` and `type_name`. Since we now use Allocation to represent all evaluated constants, provide a few methods to help process the data inside an allocation.
2023-12-06Fix `is_foreign_item` for StableMIR instanceCelina G. Val-1/+1
Change the implementation of `Instance::is_foreign_item` to directly query the compiler for the instance `def_id` instead of incorrectly relying on the conversion to `CrateItem`. Background: - In pull https://github.com/rust-lang/rust/pull/118524, I fixed the conversion from Instance to CrateItem to avoid the conversion if the instance didn't have a body available. This broke the `is_foreign_item`.
2023-11-26add successors and their formatterouz-a-1/+1
2023-11-25add pretty_terminatorouz-a-1/+1
2023-11-24Reorder imports and remove re-exportCelina G. Val-9/+10
2023-11-24Move the compiler interface defs to its own moduleCelina G. Val-160/+9
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-22Add CrateDef trait and methods to get def namesCelina G. Val-14/+13
2023-11-21Add support to get virtual table allocationCelina G. Val-0/+3
2023-11-21Add support to global allocation to stable-mirCelina G. Val-15/+15
2023-11-21remove quotation from filenameouz-a-1/+1
2023-11-20Add place.ty() and Ty build from a kind to smirCelina G. Val-2/+18
2023-11-17use new apis and add new functionouz-a-3/+6
2023-11-17move pretty into stable_mirOğuz Ağcayazı-1/+8
2023-11-16Fix has_body() and change resolve_drop_in_place() sigCelina G. Val-1/+1
Fixed the `has_body()` function operator. Before that, this function was returning false for all shims. Change resolve_drop_in_place() to also return an instance for empty shims, since they may still be required for vtable construction.
2023-11-16Add more APIs and fix `Instance::body`Celina G. Val-5/+36
Add more APIs to retrieve information about types, and add more instance resolution options. Make `Instance::body()` return an Option<Body>, since not every instance might have an available body. For example, foreign instances, virtual instances, dependencies.
2023-11-16Add more SMIR internal impl and callback return valueCelina G. Val-8/+12
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-10-30Add a stable MIR visitorCelina G. Val-3/+4
Add a few utility functions as well and extend most `mir` and `ty` ADTs to implement `PartialEq` and `Eq`.
2023-10-24Remove fold code and add Const::internal()Celina G. Val-4/+0
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-23Remove unsafe and `Rc`Celina G. Val-8/+5
2023-10-23Add method to convert internal to stable constructsCelina G. Val-26/+26
2023-10-19Add stable Instance::body() and RustcInternal traitCelina G. Val-0/+4
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-15/+28
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-13change fn name, return loc info, local nameOğuz Ağcayazı-2/+2
2023-10-11implement get_filename/lines for spanOğuz Ağcayazı-5/+12
2023-10-10Rollup merge of #116560 - ouz-a:efficient_ids, r=oli-obkGuillaume Gomez-3/+23
In smir use `FxIndexMap` to store indexed ids Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases. Addresses https://github.com/rust-lang/project-stable-mir/issues/35 r? ``@oli-obk``
2023-10-10add new wrapper for FxIndexMapOğuz Ağcayazı-3/+23
2023-10-09return crates instead of a crateOğuz Ağcayazı-4/+4
2023-09-25Split out the stable part of smir into its own crate to prevent accidental ↵Oli Scherer-0/+242
usage of forever unstable things