about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/traversal.rs
AgeCommit message (Collapse)AuthorLines
2023-09-29Remove deleted docs + better link together MIR traversing docsMaybe Waffle-2/+33
2023-09-28Use `and_then` instead of while let chain to clarify `iter` scopeMaybe Waffle-1/+1
2023-09-28Remove unnecessary `&mut/ref mut` pairMaybe Waffle-1/+1
2023-09-28Don't resolve basic block data in `Postorder`Maybe Waffle-5/+5
The only usage immediately throws out the data, so.
2023-09-28`(&mut iter)` -> `iter.by_ref()`Maybe Waffle-1/+1
2023-09-28Simplify `Postorder::next`Maybe Waffle-6/+4
2023-09-28Remove `ReversePostorder` altogetherMaybe Waffle-58/+0
It was not used anywhere, instead we directly reverse postorder.
2023-09-28Remove outdated commentMaybe Waffle-2/+1
There is no `reset` anymore
2023-06-18remove redundant combinators between PO and RPORémy Rakic-30/+6
2023-06-14make `traversal::postorder` traverse RPO cache backwardsRémy Rakic-4/+36
2023-06-14make `traversal::reverse_postorder` use RPO cacheRémy Rakic-29/+6
2023-05-21Tweak the post-order for multi-successor blocksScott McMurray-13/+13
2023-04-09Convert manual loop into `while let`Nilstrieb-11/+1
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+2
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-01-17Refactor basic blocks control flow cachesTomasz Miąsko-50/+0
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-1/+1
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-2/+2
2022-07-07Make MIR basic blocks field publicTomasz Miąsko-16/+15
This makes it possible to mutably borrow different fields of the MIR body without resorting to methods like `basic_blocks_local_decls_mut_and_var_debug_info`. To preserve validity of control flow graph caches in the presence of modifications, a new struct `BasicBlocks` wraps together basic blocks and control flow graph caches. The `BasicBlocks` dereferences to `IndexVec<BasicBlock, BasicBlockData>`. On the other hand a mutable access requires explicit `as_mut()` call.
2022-07-05impl TypeVisitable in type traversal macrosAlan Egerton-1/+1
2022-06-14Rename rustc_serialize::opaque::Encoder as MemEncoder.Nicholas Nethercote-3/+3
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.)
2022-06-10Revert b983e42936feab29f6333e9835913afc6b4a394e.Nicholas Nethercote-3/+3
2022-06-08Rename `rustc_serialize::opaque::Encoder` as `MemEncoder`.Nicholas Nethercote-3/+3
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports).
2022-06-08Use delayed error handling for `Encodable` and `Encoder` infallible.Nicholas Nethercote-3/+1
There are two impls of the `Encoder` trait: `opaque::Encoder` and `opaque::FileEncoder`. The former encodes into memory and is infallible, the latter writes to file and is fallible. Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a bit verbose and has non-trivial cost, which is annoying given how rare failures are (especially in the infallible `opaque::Encoder` case). This commit changes how `Encoder` fallibility is handled. All the `emit_*` methods are now infallible. `opaque::Encoder` requires no great changes for this. `opaque::FileEncoder` now implements a delayed error handling strategy. If a failure occurs, it records this via the `res` field, and all subsequent encoding operations are skipped if `res` indicates an error has occurred. Once encoding is complete, the new `finish` method is called, which returns a `Result`. In other words, there is now a single `Result`-producing method instead of many of them. This has very little effect on how any file errors are reported if `opaque::FileEncoder` has any failures. Much of this commit is boring mechanical changes, removing `Result` return values and `?` or `unwrap` from expressions. The more interesting parts are as follows. - serialize.rs: The `Encoder` trait gains an `Ok` associated type. The `into_inner` method is changed into `finish`, which returns `Result<Vec<u8>, !>`. - opaque.rs: The `FileEncoder` adopts the delayed error handling strategy. Its `Ok` type is a `usize`, returning the number of bytes written, replacing previous uses of `FileEncoder::position`. - Various methods that take an encoder now consume it, rather than being passed a mutable reference, e.g. `serialize_query_result_cache`.
2022-06-05Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkinbors-3/+3
Replace `&Vec<_>`s with `&[_]`s It's generally preferable to use `&[_]` since it's one less indirection and it can be created from types other that `Vec`. I've left `&Vec` in some locals where it doesn't really matter, in cases where `TypeFoldable` is expected (`TypeFoldable: Clone` so slice can't implement it) and in cases where it's `&TypeAliasThatIsActiallyVec`. Nothing important, really, I was just a little annoyed by `visit_generic_param_vec` :D r? `@compiler-errors`
2022-06-03Remove emit_unitbjorn3-2/+2
It doesn't do anything for all encoders
2022-06-03Replace `&Vec<_>`s with `&[_]`sMaybe Waffle-3/+3
2022-05-17Change `Successors` to `impl Iterator<Item = BasicBlock>`SparrowLii-1/+1
2022-04-30Eliminate duplication of RPO calculation for mirSparrowLii-4/+86
add `postorder_cache` to mir Body add `ReversePostorderCache` struct correct struct name and comments
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-02-02Correct incorrect description of preorder traversals.Jakob Degen-4/+6
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-1/+1
See #91867 This was mostly straightforward. In several places, I take advantage of the fact that lifetimes are non-hygenic: a macro declares the 'tcx' lifetime, which is then used in types passed in as macro arguments.
2021-03-27Remove (lots of) dead codeJoshua Nelson-4/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2020-08-30mv compiler to compiler/mark-0/+311