Lower riscv func
lower_riscv_func
¶
LowerSyscallOp
¶
Bases: RewritePattern
Lower SSA version of syscall, storing the optional result to a0.
Different platforms have different calling conventions. This lowering assumes that the inputs are stored in a0-a6, and the opcode is stored to a7. Upon return, the a0 contains the result value. This is not the case for some kernels.
In the future, this pass should take the compilation target as a parameter to guide the rewrites.
Issue tracking this: https://github.com/xdslproject/xdsl/issues/952
Source code in xdsl/transforms/lower_riscv_func.py
match_and_rewrite(op: riscv_func.SyscallOp, rewriter: PatternRewriter)
¶
Source code in xdsl/transforms/lower_riscv_func.py
InsertExitSyscallOp
¶
Bases: RewritePattern
Source code in xdsl/transforms/lower_riscv_func.py
match_and_rewrite(op: riscv_func.ReturnOp, rewriter: PatternRewriter)
¶
Source code in xdsl/transforms/lower_riscv_func.py
LowerRISCVFunc
dataclass
¶
Bases: ModulePass