rust/compiler/rustc_mir_transform/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
..
coroutine Don't ICE in ByMoveBody when coroutine is tainted 2024-02-09 00:36:30 +00:00
coverage coverage: Simplify code for adding prev to pending dups 2024-02-13 21:48:03 +11:00
inline Dejargnonize subst 2024-02-12 15:46:35 +09:00
abort_unwinding_calls.rs Fix mir pass ICE in the presence of other errors 2024-02-08 14:49:27 +00:00
add_call_guards.rs remove redundant imports 2023-12-10 10:56:22 +08:00
add_moves_for_packed_drops.rs remove redundant imports 2023-12-10 10:56:22 +08:00
add_retag.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
add_subtyping_projections.rs remove redundant imports 2023-12-10 10:56:22 +08:00
check_alignment.rs remove redundant imports 2023-12-10 10:56:22 +08:00
check_const_item_mutation.rs Rename TyCtxt::emit_spanned_lint as TyCtxt::emit_node_span_lint. 2024-01-23 08:09:05 +11:00
check_packed_ref.rs Remove Session methods that duplicate DiagCtxt methods. 2023-12-24 08:05:28 +11:00
check_unsafety.rs Use fewer delayed bugs. 2024-02-14 20:30:37 +11:00
cleanup_post_borrowck.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
const_debuginfo.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
const_prop_lint.rs validation: descend from consts into statics 2024-02-10 16:13:47 +01:00
const_prop.rs Use DiagnosticArgName in a few more places. 2024-02-03 09:02:50 +11:00
copy_prop.rs remove redundant imports 2023-12-10 10:56:22 +08:00
coroutine.rs remove a bunch of dead parameters in fn 2024-02-12 09:51:35 +08:00
cost_checker.rs Make is_intrinsic query return the intrinsic name 2024-02-12 09:33:52 +00:00
cross_crate_inline.rs Fix cases where std accidentally relied on inline(never) 2023-12-14 08:30:36 -05:00
ctfe_limit.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
dataflow_const_prop.rs Remove untested arithmetic ops. 2024-02-09 21:06:25 +00:00
dead_store_elimination.rs Auto merge of #116520 - Enselic:large-copy-into-fn, r=oli-obk 2024-01-16 19:33:14 +00:00
deduce_param_attrs.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
deduplicate_blocks.rs Merge dead bb pruning and unreachable bb deduplication. 2024-01-07 15:12:10 +00:00
deref_separator.rs remove redundant imports 2023-12-10 10:56:22 +08:00
dest_prop.rs Bump indexmap 2024-02-13 21:03:34 +00:00
dump_mir.rs Write to stdout if - is given as output file 2023-06-06 17:53:29 -04:00
early_otherwise_branch.rs Merge dead bb pruning and unreachable bb deduplication. 2024-01-07 15:12:10 +00:00
elaborate_box_derefs.rs remove redundant imports 2023-12-10 10:56:22 +08:00
elaborate_drops.rs Remove Session methods that duplicate DiagCtxt methods. 2023-12-24 08:05:28 +11:00
errors.rs Remove the lifetime from DiagnosticArgValue. 2024-01-30 18:46:06 +11:00
ffi_unwind_calls.rs Continue to borrowck even if there were previous errors 2024-02-08 08:10:43 +00:00
function_item_references.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
gvn.rs Split a bool argument into two named functions 2024-02-15 10:25:18 +00:00
inline.rs Check that the ABI of the instance we are inlining is correct 2024-02-11 19:17:42 +00:00
instsimplify.rs Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
jump_threading.rs Skip coroutines in jump threading to avoid query cycles 2024-02-15 00:00:00 +00:00
large_enums.rs Fix some comments 2023-12-28 12:23:14 +08:00
lib.rs Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
lint.rs compiler: Lower fn call arg spans down to MIR 2024-01-15 19:07:11 +01:00
lower_intrinsics.rs Make is_intrinsic query return the intrinsic name 2024-02-12 09:33:52 +00:00
lower_slice_len.rs compiler: Lower fn call arg spans down to MIR 2024-01-15 19:07:11 +01:00
match_branches.rs Merge dead bb pruning and unreachable bb deduplication. 2024-01-07 15:12:10 +00:00
multiple_return_terminators.rs remove redundant imports 2023-12-10 10:56:22 +08:00
normalize_array_len.rs remove redundant imports 2023-12-10 10:56:22 +08:00
nrvo.rs Remove uses of HybridBitSet. 2024-01-22 22:53:20 +00:00
pass_manager.rs Rollup merge of #120733 - klensy:trait-const-fn, r=oli-obk 2024-02-07 18:24:45 +01:00
prettify.rs remove redundant imports 2023-12-10 10:56:22 +08:00
promote_consts.rs Add a new debug_assertions instrinsic (compiler) 2024-02-08 11:49:08 -05:00
ref_prop.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
remove_noop_landing_pads.rs Avoid debug logging entire MIR body 2024-02-15 15:54:28 +01:00
remove_place_mention.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_storage_markers.rs Move condition enabling the pass to is_enabled 2024-01-23 20:58:44 +01:00
remove_uninit_drops.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_unneeded_drops.rs Merge dead bb pruning and unreachable bb deduplication. 2024-01-07 15:12:10 +00:00
remove_zsts.rs Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs 2024-02-06 02:22:58 +00:00
required_consts.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
reveal_all.rs remove redundant imports 2023-12-10 10:56:22 +08:00
shim.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
simplify_branches.rs remove redundant imports 2023-12-10 10:56:22 +08:00
simplify_comparison_integral.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
simplify.rs Merge dead bb pruning and unreachable bb deduplication. 2024-01-07 15:12:10 +00:00
sroa.rs remove redundant imports 2023-12-10 10:56:22 +08:00
ssa.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
uninhabited_enum_branching.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
unreachable_prop.rs rustc_mir_transform: Enforce rustc::potential_query_instability lint 2024-01-06 19:09:04 +01:00