Newer
Older
use hercules_ir::ir::{Device, Schedule};
Forkify,
GCM,
GVN,
InferSchedules,
Inline,
InterproceduralSROA,
LiftDCMath,
_ => num == 0,
}
}
pub fn valid_arg_nums(&self) -> &'static str {
match self {
Pass::ArrayToProduct => "0 or 1",
}
}
}
#[derive(Debug, Clone)]
pub enum Selector {
Everything(),
Selection(Vec<ScheduleExp>),
}
#[derive(Debug, Clone)]
pub enum ScheduleExp {
Variable {
var: String,
},
Integer {
val: usize,
},
Boolean {
val: bool,
},
Field {
collect: Box<ScheduleExp>,
field: String,
},
RunPass {
pass: Pass,
args: Vec<ScheduleExp>,
on: Selector,
},
DeleteUncalled {
on: Selector,
},
Record {
fields: Vec<(String, ScheduleExp)>,
},
Block {
body: Vec<ScheduleStmt>,
res: Box<ScheduleExp>,
},
SetOp {
op: parser::SetOp,
lhs: Box<ScheduleExp>,
rhs: Box<ScheduleExp>,
},
Tuple {
exprs: Vec<ScheduleExp>,
},
TupleField {
lhs: Box<ScheduleExp>,
field: usize,
},
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// This is used to "box" a selection by evaluating it at one point and then
// allowing it to be used as a selector later on
Selection {
selection: Selector,
},
}
#[derive(Debug, Copy, Clone)]
pub enum FixpointLimit {
NoLimit(),
PrintIter(),
StopAfter(usize),
PanicAfter(usize),
}
#[derive(Debug, Clone)]
pub enum ScheduleStmt {
Fixpoint {
body: Box<ScheduleStmt>,
limit: FixpointLimit,
},
Block {
body: Vec<ScheduleStmt>,
},
Let {
var: String,
exp: ScheduleExp,
},
Assign {
var: String,
exp: ScheduleExp,
},
AddSchedule {
sched: Schedule,
on: Selector,
},
AddDevice {
device: Device,
on: Selector,
},
}