rust/compiler/rustc_codegen_ssa/src
bors dfa88b328f Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin
Implement intrinsics with fallback bodies

fixes #93145 (though we can port many more intrinsics)
cc #63585

The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for

* codegen_ssa (so llvm and gcc)
* codegen_cranelift

other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body).

cc `@scottmcm` `@WaffleLapkin`

### todo

* [ ] miri support
* [x] default intrinsic name to name of function instead of requiring it to be specified in attribute
* [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-16 09:53:01 +00:00
..
back clean up potential_query_instability with FxIndexMap and UnordMap 2024-02-14 18:36:37 +08:00
debuginfo Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs 2024-02-06 02:22:58 +00:00
mir Give const_deallocate a default body 2024-02-12 17:52:05 +00:00
traits Teach llvm backend how to fall back to default bodies 2024-02-12 17:50:39 +00:00
assert_module_sources.rs clean up potential_query_instability with FxIndexMap and UnordMap 2024-02-14 18:36:37 +08:00
base.rs clean up potential_query_instability with FxIndexMap and UnordMap 2024-02-14 18:36:37 +08:00
codegen_attrs.rs is_closure_like 2024-02-11 22:09:52 +00:00
common.rs move ConstValue into mir 2023-09-19 11:11:02 +02:00
errors.rs Turn the "no saved object file in work product" ICE into a translatable fatal error 2024-02-09 20:22:15 -05:00
lib.rs clean up potential_query_instability with FxIndexMap and UnordMap 2024-02-14 18:36:37 +08:00
meth.rs cg_ssa: remove pointee types and pointercast/bitcast-of-ptr 2023-07-29 13:18:20 -04:00
mono_item.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
size_of_val.rs fix computing the dynamic alignment of packed structs with dyn trait tails 2023-12-13 20:21:57 +01:00
target_features.rs Bump indexmap 2024-02-13 21:03:34 +00:00