about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/dataflow/framework
AgeCommit message (Collapse)AuthorLines
2021-09-07Move the dataflow framework to its own crate.Camille GILLOT-3304/+0
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-95/+1
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-1/+1
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-17Fix bug in fmt_diff_withWill Crichton-1/+1
2021-08-17Expose graphviz modulesWill Crichton-1/+1
2021-04-19fix few typosklensy-1/+1
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.
2021-03-26Use iter::zip in compiler/Josh Stone-2/+3
2021-02-12[librustdoc] Reform lang string token splittingCasey Rodarmor-2/+2
Only split doctest lang strings on `,`, ` `, and `\t`. Additionally, to preserve backwards compatibility with pandoc-style langstrings, strip a surrounding `{}`, and remove leading `.`s from each token. Prior to this change, doctest lang strings were split on all non-alphanumeric characters except `-` or `_`, which limited future extensions to doctest lang string tokens, for example using `=` for key-value tokens. This is a breaking change, although it is not expected to be disruptive, because lang strings using separators other than `,` and ` ` are not very common
2020-11-09Add comments to explain memory usage optimizationCamelid-1/+8
2020-10-14Remove unused code from remaining compiler cratesest31-9/+0
2020-10-11Use SmallVec in SwitchTargetsJonas Schievink-1/+1
This allows building common SwitchTargets (eg. for `if`s) without allocation.
2020-10-10Refactor how SwitchInt stores jump targetsJonas Schievink-10/+8
2020-10-05Print to `stderr` when a graphviz file can't be writtenDylan MacKenzie-1/+1
`warn` prints nothing by default
2020-10-05Use MIR dump interface for dataflowDylan MacKenzie-23/+23
2020-10-04Replace `(Body, DefId)` with `Body` where possibleDylan MacKenzie-49/+17
A `Body` now contains its `MirSource`, which in turn contains the `DefId` of the item associated with the `Body`.
2020-09-26Remove intra-doc linkDylan MacKenzie-1/+1
2020-09-26Update engine to use new interfaceDylan MacKenzie-78/+68
2020-09-26Replace `discriminant_switch_effect` with more general versionDylan MacKenzie-21/+44
...that allows arbitrary effects on each edge of a `SwitchInt` terminator.
2020-09-25Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnrJonas Schievink-2/+20
Allow a unique name to be assigned to dataflow graphviz output Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.
2020-09-17Don't compile regex at every function call.Hanif Bin Ariffin-1/+9
Use `SyncOnceCell` to only compile it once. I believe this still adds some kind of locking mechanism?
2020-09-16Rollup merge of #76794 - richkadel:graphviz-font, r=ecstatic-morseTyler Mandry-1/+2
Make graphviz font configurable Alternative to PR #76776. To change the graphviz output to use an alternative `fontname` value, add a command line option like: `rustc --graphviz-font=monospace`. r? @ecstatic-morse
2020-09-16Make graphviz font configurableRich Kadel-1/+2
Alternative to PR ##76776. To change the graphviz output to use an alternative `fontname` value, add a command line option like: `rustc --graphviz-font=monospace`.
2020-09-15Strip a single leading tab when rendering dataflow diffsDylan MacKenzie-1/+1
2020-09-14Add `Engine::pass_name` to differentiate dataflow runsDylan MacKenzie-2/+20
2020-09-08Add -Zgraphviz_dark_modeRich Kadel-1/+5
Many developers use a dark theme with editors and IDEs, but this typically doesn't extend to graphviz output. When I bring up a MIR graphviz document, the white background is strikingly bright. This new option changes the colors used for graphviz output to work better in dark-themed UIs.
2020-09-07Auto merge of #76044 - ecstatic-morse:dataflow-lattice, r=oli-obkbors-515/+798
Support dataflow problems on arbitrary lattices This PR implements last of the proposed extensions I mentioned in the design meeting for the original dataflow refactor. It extends the current dataflow framework to work with arbitrary lattices, not just `BitSet`s. This is a prerequisite for dataflow-enabled MIR const-propagation. Personally, I am skeptical of the usefulness of doing const-propagation pre-monomorphization, since many useful constants only become known after monomorphization (e.g. `size_of::<T>()`) and users have a natural tendency to hand-optimize the rest. It's probably worth exprimenting with, however, and others have shown interest cc `@rust-lang/wg-mir-opt.` The `Idx` associated type is moved from `AnalysisDomain` to `GenKillAnalysis` and replaced with an associated `Domain` type that must implement `JoinSemiLattice`. Like before, each `Analysis` defines the "bottom value" for its domain, but can no longer override the dataflow join operator. Analyses that want to use set intersection must now use the `lattice::Dual` newtype. `GenKillAnalysis` impls have an additional requirement that `Self::Domain: BorrowMut<BitSet<Self::Idx>>`, which effectively means that they must use `BitSet<Self::Idx>` or `lattice::Dual<BitSet<Self::Idx>>` as their domain. Most of these changes were mechanical. However, because a `Domain` is no longer always a powerset of some index type, we can no longer use an `IndexVec<BasicBlock, GenKillSet<A::Idx>>>` to store cached block transfer functions. Instead, we use a boxed `dyn Fn` trait object. I discuss a few alternatives to the current approach in a commit message. The majority of new lines of code are to preserve existing Graphviz diagrams for those unlucky enough to have to debug dataflow analyses. I find these diagrams incredibly useful when things are going wrong and considered regressing them unacceptable, especially the pretty-printing of `MovePathIndex`s, which are used in many dataflow analyses. This required a parallel `fmt` trait used only for printing dataflow domains, as well as a refactoring of the `graphviz` module now that we cannot expect the domain to be a `BitSet`. Some features did have to be removed, such as the gen/kill display mode (which I didn't use but existed to mirror the output of the old dataflow framework) and line wrapping. Since I had to rewrite much of it anyway, I took the opportunity to switch to a `Visitor` for printing dataflow state diffs instead of using cursors, which are error prone for code that must be generic over both forward and backward analyses. As a side-effect of this change, we no longer have quadratic behavior when writing graphviz diagrams for backward dataflow analyses. r? `@pnkfelix`
2020-09-04Change ty.kind to a methodLeSeulArtichaut-1/+1
2020-08-30Add documentation to the `Analysis` traitsDylan MacKenzie-3/+19
2020-08-30Expand documentation for the `lattice` moduleDylan MacKenzie-17/+51
2020-08-30Add `FIXME` for faster cached block transfer functionsDylan MacKenzie-0/+5
I've tried a few ways of implementing this, but each fell short. Adding an auxiliary `_Idx` associated type to `Analysis` that defaults to `!` but is overridden in the blanket impl of `Analysis` for `A: GenKillAnalysis` to `A::Idx` seems promising, but the trait solver is unable to prove equivalence between `A::Idx` and `A::_Idx` within the overridden version of `into_engine`. Without full-featured specialization, removing `into_engine` or splitting it into a different trait would have a significant ergonomic penalty. Alternatively, we could erase the index type and store a `GenKillSet<u32>` as well as a function pointer for transmuting between `&mut A::Domain` and `&mut BitSet<u32>` in the hopes that LLVM can devirtualize a simple function pointer better than the boxed closure. However, this is brittle, requires `unsafe` code, and doesn't work for index types that aren't the same size as a `u32` (e.g. `usize`) since `GenKillSet` stores a `HybridBitSet`, which may be a `Vec<I>`. Perhaps safe transmute could help here?
2020-08-30Extend dataflow framework to support arbitrary latticesDylan MacKenzie-511/+734
2020-08-30Allow access to the underlying `Results` from a `ResultsCursor`Dylan MacKenzie-1/+6
2020-08-30mv compiler to compiler/mark-0/+3110