summary refs log tree commit diff
path: root/src/librustc_data_structures/graph
AgeCommit message (Collapse)AuthorLines
2019-10-23Rollup merge of #65648 - nnethercote:rm-intersect_opt, r=nikomatsakisMazdak Farrokhzad-21/+6
Eliminate `intersect_opt`. Its fourth argument is always `Some(pred)`, so the pattern matching is unnecessary. This commit inlines and removes it. r? @nikomatsakis
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-2/+2
2019-10-21Eliminate `intersect_opt`.Nicholas Nethercote-21/+6
Its fourth argument is always `Some(pred)`, so the pattern matching is unnecessary. This commit inlines and removes it.
2019-10-01Fix clippy warningsYuki Okushi-2/+2
2019-09-29remove indexed_vec re-export from rustc_data_structurescsmoe-5/+5
2019-09-29remove bit_set re-export from rustc_data_structurescsmoe-2/+2
2019-09-23Add cycle detection for graphsDylan MacKenzie-1/+224
2019-08-02Remove some more `cfg(test)`sVadim Petrochenkov-9/+4
2019-08-02librustc_data_structures: Unconfigure tests during normal buildVadim Petrochenkov-10/+9
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-0/+2
2019-07-03Add missing lifetime specifierJeremy Stucki-1/+1
2019-07-03Remove needless lifetimesJeremy Stucki-3/+3
2019-07-03Remove needless lifetimesJeremy Stucki-14/+14
2019-07-02more centril nitsNiko Matsakis-1/+1
2019-07-02address nits by mattewjasperNiko Matsakis-2/+1
2019-07-02pacify the mercilous tidyNiko Matsakis-1/+0
long lines, trailing newlines
2019-07-02add a `depth_first_search` helper functionNiko Matsakis-1/+49
2019-07-02introduce a `VecGraph` abstraction that cheaply stores graphsNiko Matsakis-1/+184
This is perhaps better than the linked list approach I was using before. Lower memory overhead, Theta(N+E) storage. Does require a sort. =)
2019-07-02implement the graph traits for SCCNiko Matsakis-1/+26
2019-04-09Kill dead code dominator code.Edd Barrett-47/+0
2019-02-10rustc: doc commentsAlexander Regueiro-3/+3
2019-02-09librustc_data_structures => 2018Taiki Endo-26/+22
2018-12-25Remove licensesMark Rousskov-110/+0
2018-11-13fix various typos in doc commentsAndy Russell-1/+1
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-4/+4
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-5/+5
2018-08-27micro-optimize dominator codeNiko Matsakis-2/+2
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-4/+4
2018-08-09A few cleanups for rustc_data_structuresljedrz-5/+6
2018-08-01Split out growth functionality into BitVector typeMark Rousskov-4/+4
2018-07-25parameterize `BitVector` and `BitMatrix` by their index typesNiko Matsakis-1/+1
2018-07-13nit: fix `all_sccs` commentNiko Matsakis-1/+1
2018-07-13nit: tweak comment orderNiko Matsakis-21/+23
2018-07-13nit: improve SCC commentsNiko Matsakis-4/+19
2018-07-13nit: clarify "keep it around" commentNiko Matsakis-2/+2
2018-07-13nit: s/successor/successors/Niko Matsakis-2/+2
2018-07-13compute region values using SCCs not iterative flowNiko Matsakis-0/+5
The strategy is this: - we compute SCCs once all outlives constraints are known - we allocate a set of values **per region** for storing liveness - we allocate a set of values **per SCC** for storing the final values - when we add a liveness constraint to the region R, we also add it to the final value of the SCC to which R belongs - then we can apply the constraints by just walking the DAG for the SCCs and union'ing the children (which have their liveness constraints within) There are a few intermediate refactorings that I really ought to have broken out into their own commits: - reverse the constraint graph so that `R1: R2` means `R1 -> R2` and not `R2 -> R1`. This fits better with the SCC computation and new style of inference (`->` now means "take value from" and not "push value into") - this does affect some of the UI tests, since they traverse the graph, but mostly the artificial ones and they don't necessarily seem worse - put some things (constraint set, etc) into `Rc`. This lets us root them to permit mutation and iteration. It also guarantees they don't change, which is critical to the correctness of the algorithm. - Generalize various helpers that previously operated only on points to work on any sort of region element.
2018-07-12introduce a generic SCC computationNiko Matsakis-3/+531
2018-07-12rename `control_flow_graph` to `graph`Niko Matsakis-0/+1103
2018-07-12rename `graph` to `control_flow_graph::implementation`Niko Matsakis-556/+0
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+13
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2018-03-07Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.Corey Farwell-24/+29
2018-03-07Replace iterator structures with `impl Trait`.Corey Farwell-77/+25
2017-10-09Refactor to use `debug_struct` in several Debug implsMalo Jaffré-13/+2
Fixes #44771.
2017-09-14rustc: Preallocate when building the dep graphAlex Crichton-0/+7
This commit alters the `query` function in the dep graph module to preallocate memory using `with_capacity` instead of relying on automatic growth. Discovered in #44576 it was found that for the syntex_syntax clean incremental benchmark the peak memory usage was found when the dep graph was being saved, particularly the `DepGraphQuery` data structure itself. PRs like #44142 which add more queries end up just making this much larger! I didn't see an immediately obvious way to reduce the size of the `DepGraphQuery` object, but it turns out that `with_capacity` helps quite a bit! Locally 831 MB was used [before] this commit, and 770 MB is in use at the peak of the compiler [after] this commit. That's a nice 7.5% improvement! This won't quite make up for the losses in #44142 but I figured it's a good start. [before]: https://gist.github.com/alexcrichton/2d2b9c7a65503761925c5a0bcfeb0d1e [before]: https://gist.github.com/alexcrichton/6da51f2a6184bfb81694cc44f06deb5b
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-190/+0
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-11/+11
Like #43008 (f668999), but _much more aggressive_.
2017-08-07rustc::middle::dataflow - visit the CFG in RPOAriel Ben-Yehuda-0/+79
We used to propagate bits in node-id order, which sometimes caused an excessive number of iterations, especially when macros were present. As everyone knows, visiting the CFG in RPO bounds the number of iterators by 1 plus the depth of the most deeply nested loop (times the height of the lattice, which is 1). Fixes #43704.
2016-12-15Warn unused type aliasesSeo Sanghyeon-2/+0
2016-11-02Added Graph::is_cyclicic_node algorithmHavvy-15/+82