Riscv scf for infer constant step
riscv_scf_for_infer_constant_step
¶
This pass converts a statically-known step value into a constant attribute in
riscv_scf loops when it fits into the bitwidth of the immediate in the addi
operation.
The rationale is to use one fewer register in the loop body.
The lower bound and upper bound don't benefit from the same transformation, as the
former is only used to initialise the induction variable, and the step is used in a
comparison which always takes two registers.
InferConstantStep
¶
Bases: RewritePattern
Source code in xdsl/transforms/riscv_scf_for_infer_constant_step.py
match_and_rewrite(op: riscv_scf.ForOp | riscv_scf.RofOp, rewriter: PatternRewriter) -> None
¶
Source code in xdsl/transforms/riscv_scf_for_infer_constant_step.py
RiscvScfForInferConstantStepPass
dataclass
¶
Bases: ModulePass