@@ -21,30 +21,23 @@ use crate::{
21
21
EntityRef , Operation , OperationName , OperationRef ,
22
22
} ;
23
23
24
- /// Struct that handles IR printing, based on the IRPRintingConfig passed during creation. Currently,
25
- /// this struct is managed by the PassManager's PassInstrumentor, which calls the Print struct via
26
- /// its PassInstrumentation trait implementation.
24
+ /// Struct that handles IR printing, based on the [`IRPrintingConfig`] passed in
25
+ /// [Print::new]. Currently, this struct is managed by the [` PassManager`] 's [` PassInstrumentor`],
26
+ /// which calls the Print struct via its [` PassInstrumentation`] trait implementation.
27
27
///
28
- ///Print currently implements the following PassInstrumentation functions:
29
- /// - run_before_pipeline: This gets called before the entire pass pipeline, but it will only
30
- /// display output if the "only_when_modified" option is set to true. This is done to showcase the
31
- /// IR before any pass gets applied.
32
- /// - run_before_pass: This is called before each pass. This function is used to display the IR
33
- /// right before a specific Pass gets applied. If "only_when_modified" is set to true, this
34
- /// function will not display output.
35
- /// - run_after_pass: This is called after each pass. This function is used to display the
36
- /// modifications done to the IR by a specific Pass.
28
+ /// The configuration passed by [`IRPrintingConfig`] controls *when* the IR gets displayed, rather
29
+ /// than *how*. The display format itself depends on the `Display` implementation done by each
30
+ /// [`Operation`].
37
31
///
38
- /// NOTE: "only_when_modified" disables "run_before_pass" because it prints the IR before the pass
39
- /// is run, so there is no opportunity to check if the pass will actually modify the IR (since this
40
- /// is done later in the pipeline). So, in order to display the changes, "run_before_pipeline" is
41
- /// enabled. This has the effect of showing the IR before any passes, and then showing the IR only
42
- /// when it gets modified. the IR twice. All those functions call the [Print::print_ir] function,
43
- /// which handles IR printing based on Print's configuration.
32
+ /// [`Print::selected_passes`] controls which passes are selected to be printable. This means that
33
+ /// those selected passes will run all the configured filters; which will determine whether
34
+ /// the pass displays the IR or not. The available options are [`SelectedPasses::All`] to enable all
35
+ /// the passes and [`SelectedPasses::Just`] to enable a select set of passes.
44
36
///
45
- /// It is important to note that the [Print::print_ir] function is only calling the Display
46
- /// implementation of the specified operation. This means, that the format in which the Operation is
47
- /// displayed is handled by each Operation.
37
+ /// The filters that run on the selected passes are:
38
+ /// - [`Print::only_when_modified`] will only print the IR if said pass modified the IR.
39
+ ///
40
+ /// - [`Print::op_filter`] will only display a specific subset of operations.
48
41
#[ derive( Default ) ]
49
42
pub struct Print {
50
43
selected_passes : Option < SelectedPasses > ,
0 commit comments