rust/compiler/rustc_codegen_ssa/src
Scott McMurray 89a18cb600 Add unsigned_offset_from on pointers
Like we have `add`/`sub` which are the `usize` version of `offset`, this adds the `usize` equivalent of `offset_from`.  Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`.

As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives.  That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change.

This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE.  It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.
2022-05-11 17:16:25 -07:00
..
back Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB. 2022-05-03 10:53:54 -07:00
coverageinfo Remove in_band_lifetimes from rustc_codegen_ssa 2021-12-15 00:41:41 -05:00
debuginfo Remove NodeIdHashingMode. 2022-04-12 19:59:32 +02:00
mir Add unsigned_offset_from on pointers 2022-05-11 17:16:25 -07:00
traits Merge new_metadata into codegen_allocator 2022-04-30 21:20:08 +02:00
base.rs Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB. 2022-05-03 10:53:54 -07:00
common.rs use tcx.require_lang_item() instead 2022-04-28 20:18:01 +08:00
glue.rs Improve AdtDef interning. 2022-03-11 13:31:24 +11:00
lib.rs Auto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister 2022-05-05 12:26:38 +00:00
meth.rs debuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create_vtable_metadata() to DebugInfoMethods::create_vtable_debuginfo() 2022-03-14 17:25:24 +01:00
mono_item.rs Add codegen for global_asm! sym operands 2022-04-15 14:36:30 +01:00
target_features.rs Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu 2022-03-23 03:05:28 +01:00