about summary refs log tree commit diff
path: root/compiler/stable_mir/src
AgeCommit message (Collapse)AuthorLines
2024-03-23Add+Use `mir::BinOp::Cmp`Scott McMurray-0/+4
2024-03-23Rollup merge of #122762 - RoboSchmied:RoboSchmied-typo, r=workingjubileeJubilee-3/+3
fix typo of endianness fix typo endianess -> endianness
2024-03-23refactor check_{lang,library}_ub: use a single intrinsic, put policy into ↵Ralf Jung-8/+2
library
2024-03-23rename MIR int2ptr casts to match library nameRalf Jung-1/+1
2024-03-22Split out ImplPolarity and PredicatePolarityMichael Goulet-1/+7
2024-03-21Rollup merge of #122801 - celinval:smir-pretty, r=compiler-errorsMatthias Krüger-341/+232
Fix misc printing issues in emit=stable_mir Trying to continue the work that ````@ouz-a```` started here: https://github.com/rust-lang/rust/pull/118364 Few modifications beyond fixes: 1. I made the `pretty_*` functions private. 2. I added a function to print the instance body 3. Changed a bunch of signatures to write to the writer directly. 4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation. 5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
2024-03-20s/place_debug/place_pretty in SMIRCelina G. Val-2/+2
2024-03-20Enable users to dump the body of an instanceCelina G. Val-1/+8
2024-03-20Improve emit stable mir bodyCelina G. Val-341/+225
2024-03-20Update target.rs alloc.rs event.rs simd.rsRoboSchmied-3/+3
fix typos
2024-03-20resolve clippy errorsonur-ozkan-4/+4
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-14Rollup merge of #122405 - celinval:smir-new-const, r=oli-obkMatthias Krüger-5/+39
Add methods to create StableMIR constant I've been experimenting with transforming the StableMIR to instrument the code with potential UB checks. The modified body will only be used by our analysis tool, however, constants in StableMIR must be backed by rustc constants. Thus, I'm adding a few functions to build constants, such as building string and other primitives. One question I have is whether we should create a global allocation instead for strings. r? ``````@oli-obk``````
2024-03-13Rollup merge of #122426 - celinval:smir-fix-full, r=oli-obkMatthias Krüger-1/+1
Fix StableMIR `WrappingRange::is_full` computation `WrappingRange::is_full` computation assumed that to be full the range couldn't wrap, which is not necessarily true. For example, a range of 1..=0 is a valid representation of a full wrapping range.
2024-03-13Fix StableMIR is_full computationCelina G. Val-1/+1
`WrappingRange::is_full` computation assumed that to be full the range couldn't wrap, which is not necessarily true. For example, a range of 1..=0 is a valid representation of a full wrapping range.
2024-03-13Rollup merge of #122203 - adpaco-aws:smir-intrinsic-name, r=celinvalMatthias Krüger-0/+12
Add `intrinsic_name` to get plain intrinsic name Add an `intrinsic_name` API to retrieve the plain intrinsic name. The plain name does not include type arguments (as `trimmed_name` does), which is more convenient to match with intrinsic symbols.
2024-03-12Add `intrinsic_name` to get plain intrinsic nameAdrian Palacios-0/+12
2024-03-12Add methods to create constantsCelina G. Val-5/+39
I've been experimenting with transforming the StableMIR to instrument the code with potential UB checks. The modified body will only be used by our analysis tool, however, constants in StableMIR must be backed by rustc constants. Thus, I'm adding a few functions to build constants, such as building string and other primitives.
2024-03-08Distinguish between library and lang UB in assert_unsafe_preconditionBen Kimock-2/+8
2024-03-01Add support to new float typesCelina G. Val-4/+24
2024-03-01Implement missing ABI structures in StableMIRCelina G. Val-10/+177
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-1/+0
2024-02-24compiler: use `addr_of!`Pavel Grigorenko-1/+1
2024-02-17Merge `CompilerError::CompilationFailed` and `CompilerError::ICE`.Nicholas Nethercote-8/+4
`CompilerError` has `CompilationFailed` and `ICE` variants, which seems reasonable at first. But the way it identifies them is flawed: - If compilation errors out, i.e. `RunCompiler::run` returns an `Err`, it uses `CompilationFailed`, which is reasonable. - If compilation panics with `FatalError`, it catches the panic and uses `ICE`. This is sometimes right, because ICEs do cause `FatalError` panics, but sometimes wrong, because certain compiler errors also cause `FatalError` panics. (The compiler/rustdoc/clippy/whatever just catches the `FatalError` with `catch_with_exit_code` in `main`.) In other words, certain non-ICE compilation failures get miscategorized as ICEs. It's not possible to reliably distinguish the two cases, so this commit merges them. It also renames the combined variant as just `Failed`, to better match the existing `Interrupted` and `Skipped` variants. Here is an example of a non-ICE failure that causes a `FatalError` panic, from `tests/ui/recursion_limit/issue-105700.rs`: ``` #![recursion_limit="4"] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] //~^ERROR recursion limit reached while expanding fn main() {{}} ```
2024-02-15Rollup merge of #120982 - momvart:smir-61-foreign_kind, r=oli-obkMatthias Krüger-5/+51
Add APIs for fetching foreign items Closes https://github.com/rust-lang/project-stable-mir/issues/61
2024-02-14Rewrite foreign item kind query using `DefKind`Mohammad Omidvar-2/+2
2024-02-12Add APIs for fetching foreign items including foreign modules, their ABIs, ↵Mohammad Omidvar-5/+51
and their items
2024-02-12Dejargnonize substShoyu Vanilla-2/+2
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-0/+3
And in clippy
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-2/+0
2024-01-25Remove unused featuresclubby789-1/+0
2024-01-19Make the remaining "private" fields actually privateOli Scherer-2/+2
2024-01-12Rollup merge of #119877 - celinval:smir-visit-projection, r=oli-obkGuillaume Gomez-19/+38
Add more information to `visit_projection_elem` Without the starting place, it's hard to retrieve any useful information from visiting a projection. Note: I still need to add a test.
2024-01-11Add more information to `visit_projection_elem`Celina G. Val-19/+38
Without the starting place, it's hard to retrieve any useful information from visiting a projection.
2024-01-09Fix all_trait* methods to return all trait availableCelina G. Val-11/+32
Also provide a mechanism to retrieve traits and implementations for a given crate.
2023-12-28Restore movability to SMIRMichael Goulet-8/+13
2023-12-28Remove movability from TyKind::CoroutineMichael Goulet-11/+8
2023-12-25Only regular coroutines have movabilityMichael Goulet-3/+3
2023-12-22Split coroutine desugaring kind from sourceMichael Goulet-21/+34
2023-12-20Rollup merge of #119141 - celinval:smir-instance-args, r=compiler-errorsMatthias Krüger-0/+9
Add method to get instance instantiation arguments Add a method to get the instance instantiation arguments, and include that information in the instance debug.
2023-12-20Add method to get instance instantiation argumentsCelina G. Val-0/+9
2023-12-20Add `ItemKind::Ctor` to stable mirCelina G. Val-0/+7
2023-12-20Rollup merge of #119094 - celinval:smir-layout, r=compiler-errorsMatthias Krüger-0/+306
Add function ABI and type layout to StableMIR 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. r? ```@compiler-errors```
2023-12-19Fix c_variadic flag and add opaque info to PassModeCelina G. Val-9/+6
We should expand the information in PassMode later.
2023-12-18Add the function body span to StableMIRCelina G. Val-2/+8
2023-12-18Add function ABI and type layout to StableMIRCelina G. Val-0/+309
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-15Add a method to check if type is a CStrCelina G. Val-0/+9
2023-12-15Rollup merge of #118927 - celinval:smir-missing-info, r=compiler-errorsAli MJ Al-Nasrawy-16/+85
Erase late bound regions from `Instance::fn_sig()` and add a few more details to StableMIR APIs The Instance `fn_sig()` still included a late bound regions which needed a new compiler function in order to be erased. I've also bundled the following small fixes in this PR, let me know if you want me to isolate any of them. - Add missing `CoroutineKind::AsyncGen`. - Add optional spread argument to function body which is needed to properly analyze compiler shims. - Add a utility method to iterate over all locals together with their declaration. - Add a method to get the description of `AssertMessage`*. * For the last one, we could consider eventually calling the internal `AssertKind::description()` to avoid code duplication. However, we still don't have ways to convert `AssertMessage`, `Operand`, `Place` and others, in order to use that. The other downside of using the internal method is that it will panic for some of the variants. r ? `@ouz-a`
2023-12-14Revert signature change for AssertMessage descriptionCelina G. Val-34/+21
2023-12-14Address PR commentsCelina G. Val-37/+46
- Remove `fn_sig()` from Instance. - Change return value of `AssertMessage::description` to `Cow<>`. - Add assert to instance `ty()`. - Generalize uint / int type creation.
2023-12-14add stable_mir output testouz-a-13/+30