Skip to content

Commit 56df599

Browse files
Rename: PassType -> PassIdentifier; pass_type() -> pass_id()
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
1 parent ed579fb commit 56df599

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

dialects/hir/src/transforms/spill.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use alloc::rc::Rc;
33
use midenc_hir::{
44
adt::SmallDenseMap,
55
dialects::builtin::{Function, FunctionRef, LocalVariable},
6-
pass::{pass::PassType, IRAfterPass, Pass, PassExecutionState},
6+
pass::{pass::PassIdentifier, IRAfterPass, Pass, PassExecutionState},
77
BlockRef, BuilderExt, EntityMut, Op, OpBuilder, OperationName, OperationRef, Report, Rewriter,
88
SourceSpan, Spanned, Symbol, ValueRef,
99
};
@@ -19,8 +19,8 @@ impl Pass for TransformSpills {
1919
"transform-spills"
2020
}
2121

22-
fn pass_type(&self) -> Option<PassType> {
23-
Some(PassType::TransformSpills)
22+
fn pass_id(&self) -> Option<PassIdentifier> {
23+
Some(PassIdentifier::TransformSpills)
2424
}
2525

2626
fn argument(&self) -> &'static str {

dialects/scf/src/transforms/cfg_to_scf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use midenc_hir::{
77
diagnostics::Severity,
88
dialects::builtin,
99
dominance::DominanceInfo,
10-
pass::{pass::PassType, IRAfterPass, Pass, PassExecutionState},
10+
pass::{pass::PassIdentifier, IRAfterPass, Pass, PassExecutionState},
1111
Builder, EntityMut, Forward, Op, Operation, OperationName, OperationRef, RawWalk, Report,
1212
SmallVec, Spanned, Type, ValueRange, ValueRef, WalkResult,
1313
};
@@ -35,8 +35,8 @@ impl Pass for LiftControlFlowToSCF {
3535
"lift-control-flow"
3636
}
3737

38-
fn pass_type(&self) -> Option<PassType> {
39-
Some(PassType::LiftControlFlowToSCF)
38+
fn pass_id(&self) -> Option<PassIdentifier> {
39+
Some(PassIdentifier::LiftControlFlowToSCF)
4040
}
4141

4242
fn argument(&self) -> &'static str {

hir-transform/src/canonicalization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use alloc::{boxed::Box, format, rc::Rc};
22

33
use midenc_hir::{
4-
pass::{pass::PassType, IRAfterPass, OperationPass, Pass, PassExecutionState},
4+
pass::{pass::PassIdentifier, IRAfterPass, OperationPass, Pass, PassExecutionState},
55
patterns::{self, FrozenRewritePatternSet, GreedyRewriteConfig, RewritePatternSet},
66
Context, EntityMut, Operation, OperationName, Report, Spanned,
77
};
@@ -62,8 +62,8 @@ impl Pass for Canonicalizer {
6262
"canonicalizer"
6363
}
6464

65-
fn pass_type(&self) -> Option<PassType> {
66-
Some(PassType::Canonicalizer)
65+
fn pass_id(&self) -> Option<PassIdentifier> {
66+
Some(PassIdentifier::Canonicalizer)
6767
}
6868

6969
fn argument(&self) -> &'static str {

hir-transform/src/sccp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use midenc_hir::{
2-
pass::{pass::PassType, IRAfterPass, Pass, PassExecutionState},
2+
pass::{pass::PassIdentifier, IRAfterPass, Pass, PassExecutionState},
33
patterns::NoopRewriterListener,
44
BlockRef, Builder, EntityMut, OpBuilder, Operation, OperationFolder, OperationName, RegionList,
55
Report, SmallVec, ValueRef,
@@ -26,8 +26,8 @@ impl Pass for SparseConditionalConstantPropagation {
2626
"sparse-conditional-constant-propagation"
2727
}
2828

29-
fn pass_type(&self) -> Option<PassType> {
30-
Some(PassType::SparseConditionalConstantPropagation)
29+
fn pass_id(&self) -> Option<PassIdentifier> {
30+
Some(PassIdentifier::SparseConditionalConstantPropagation)
3131
}
3232

3333
fn argument(&self) -> &'static str {

hir-transform/src/sink.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use midenc_hir::{
44
adt::SmallDenseMap,
55
dominance::DominanceInfo,
66
matchers::{self, Matcher},
7-
pass::{pass::PassType, IRAfterPass, Pass, PassExecutionState},
7+
pass::{pass::PassIdentifier, IRAfterPass, Pass, PassExecutionState},
88
traits::{ConstantLike, Terminator},
99
Backward, Builder, EntityMut, Forward, FxHashSet, OpBuilder, Operation, OperationName,
1010
OperationRef, ProgramPoint, RawWalk, Region, RegionBranchOpInterface,
@@ -84,8 +84,8 @@ impl Pass for ControlFlowSink {
8484
"control-flow-sink"
8585
}
8686

87-
fn pass_type(&self) -> Option<PassType> {
88-
Some(PassType::ControlFlowSink)
87+
fn pass_id(&self) -> Option<PassIdentifier> {
88+
Some(PassIdentifier::ControlFlowSink)
8989
}
9090

9191
fn argument(&self) -> &'static str {
@@ -165,8 +165,8 @@ impl Pass for SinkOperandDefs {
165165
"sink-operand-defs"
166166
}
167167

168-
fn pass_type(&self) -> Option<PassType> {
169-
Some(PassType::SinkOperandDefs)
168+
fn pass_id(&self) -> Option<PassIdentifier> {
169+
Some(PassIdentifier::SinkOperandDefs)
170170
}
171171

172172
fn argument(&self) -> &'static str {

hir/src/pass.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use self::{
1212
analysis::{Analysis, AnalysisManager, OperationAnalysis, PreservedAnalyses},
1313
instrumentation::{PassInstrumentation, PassInstrumentor, PipelineParentInfo},
1414
manager::{IRPrintingConfig, Nesting, OpPassManager, PassDisplayMode, PassManager},
15-
pass::{IRAfterPass, OperationPass, Pass, PassExecutionState, PassType},
15+
pass::{IRAfterPass, OperationPass, Pass, PassExecutionState, PassIdentifier},
1616
registry::{PassInfo, PassPipelineInfo},
1717
specialization::PassTarget,
1818
statistics::{PassStatistic, Statistic, StatisticValue},
@@ -37,7 +37,7 @@ enum PassFilter {
3737
/// Print IR regardless of which pass is executed.
3838
All,
3939
/// Only print IR if the pass's name is present in the vector.
40-
Certain(Vec<PassType>),
40+
Certain(Vec<PassIdentifier>),
4141
}
4242

4343
#[derive(Default, Debug)]
@@ -164,7 +164,7 @@ impl Print {
164164
match &self.pass_filter {
165165
Some(PassFilter::All) => true,
166166
Some(PassFilter::Certain(passes)) => passes.iter().any(|p| {
167-
if let Some(p_type) = pass.pass_type() {
167+
if let Some(p_type) = pass.pass_id() {
168168
*p == p_type
169169
} else {
170170
false

hir/src/pass/manager.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::{
99
PassInstrumentor, PipelineParentInfo, Statistic,
1010
};
1111
use crate::{
12-
pass::{pass::PassType, IRAfterPass, Print},
12+
pass::{pass::PassIdentifier, IRAfterPass, Print},
1313
traits::IsolatedFromAbove,
1414
Context, EntityMut, OpPrintingFlags, OpRegistration, Operation, OperationName, OperationRef,
1515
Report,
@@ -37,14 +37,14 @@ pub struct IRPrintingConfig {
3737
pub print_after_only_on_failure: bool,
3838
// NOTE: Taken from the Options struct
3939
pub print_ir_after_all: bool,
40-
pub print_ir_after_pass: Vec<PassType>,
40+
pub print_ir_after_pass: Vec<PassIdentifier>,
4141
pub print_ir_after_modified: bool,
4242
pub flags: OpPrintingFlags,
4343
}
4444

4545
impl From<&Options> for IRPrintingConfig {
4646
fn from(options: &Options) -> Self {
47-
let pass_filters: Vec<PassType> =
47+
let pass_filters: Vec<PassIdentifier> =
4848
options.print_ir_after_pass.iter().map(|a| a.into()).collect();
4949
IRPrintingConfig {
5050
print_ir_after_all: options.print_ir_after_all,
@@ -735,7 +735,7 @@ impl OpToOpPassAdaptor {
735735
}
736736

737737
#[allow(dead_code)]
738-
fn pass_type(&self) -> Option<PassType> {
738+
fn pass_id(&self) -> Option<PassIdentifier> {
739739
None
740740
}
741741

@@ -1060,7 +1060,7 @@ impl Pass for OpToOpPassAdaptor {
10601060
crate::interner::Symbol::intern(self.name()).as_str()
10611061
}
10621062

1063-
fn pass_type(&self) -> Option<PassType> {
1063+
fn pass_id(&self) -> Option<PassIdentifier> {
10641064
None
10651065
}
10661066

hir/src/pass/pass.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub trait OperationPass {
1616
fn into_any(self: Box<Self>) -> Box<dyn Any>;
1717
fn name(&self) -> &'static str;
1818

19-
fn pass_type(&self) -> Option<PassType>;
19+
fn pass_id(&self) -> Option<PassIdentifier>;
2020

2121
fn argument(&self) -> &'static str {
2222
// NOTE: Could we compute an argument string from the type name?
@@ -64,8 +64,8 @@ where
6464
<P as Pass>::as_any(self)
6565
}
6666

67-
fn pass_type(&self) -> Option<PassType> {
68-
<P as Pass>::pass_type(self)
67+
fn pass_id(&self) -> Option<PassIdentifier> {
68+
<P as Pass>::pass_id(self)
6969
}
7070

7171
fn as_any_mut(&mut self) -> &mut dyn Any {
@@ -144,7 +144,7 @@ where
144144
}
145145

146146
#[derive(Debug, PartialEq, Clone, Copy)]
147-
pub enum PassType {
147+
pub enum PassIdentifier {
148148
Canonicalizer,
149149
ControlFlowSink,
150150
LiftControlFlowToSCF,
@@ -154,17 +154,17 @@ pub enum PassType {
154154
TransformSpills,
155155
}
156156

157-
impl From<&String> for PassType {
157+
impl From<&String> for PassIdentifier {
158158
fn from(pass_name: &String) -> Self {
159159
match pass_name.as_str() {
160-
"canonicalizer" => PassType::Canonicalizer,
161-
"control-flow-sink" => PassType::ControlFlowSink,
162-
"lift-control-flow" => PassType::LiftControlFlowToSCF,
163-
"sink-operand-defs" => PassType::SinkOperandDefs,
160+
"canonicalizer" => PassIdentifier::Canonicalizer,
161+
"control-flow-sink" => PassIdentifier::ControlFlowSink,
162+
"lift-control-flow" => PassIdentifier::LiftControlFlowToSCF,
163+
"sink-operand-defs" => PassIdentifier::SinkOperandDefs,
164164
"sparse-conditional-constant-propagation" => {
165-
PassType::SparseConditionalConstantPropagation
165+
PassIdentifier::SparseConditionalConstantPropagation
166166
}
167-
"transform-spills" => PassType::TransformSpills,
167+
"transform-spills" => PassIdentifier::TransformSpills,
168168
_ => panic!("ERROR: '{pass_name}' unrecognized pass."),
169169
}
170170
}
@@ -295,7 +295,7 @@ pub trait Pass: Sized + Any {
295295
state.run_pipeline(pipeline, op)
296296
}
297297

298-
fn pass_type(&self) -> Option<PassType>;
298+
fn pass_id(&self) -> Option<PassIdentifier>;
299299
}
300300

301301
impl<P> Pass for Box<P>
@@ -322,8 +322,8 @@ where
322322
(**self).name()
323323
}
324324

325-
fn pass_type(&self) -> Option<PassType> {
326-
(**self).pass_type()
325+
fn pass_id(&self) -> Option<PassIdentifier> {
326+
(**self).pass_id()
327327
}
328328

329329
#[inline]

0 commit comments

Comments
 (0)