Function transformations
function_transformations
¶
TIMER_START = 'timer_start'
module-attribute
¶
TIMER_END = 'timer_end'
module-attribute
¶
ArgNamesToArgAttrsPass
¶
Bases: RewritePattern
Source code in xdsl/transforms/function_transformations.py
match_and_rewrite(op: func.FuncOp, rewriter: PatternRewriter)
¶
Source code in xdsl/transforms/function_transformations.py
AddBenchTimersPattern
dataclass
¶
Bases: RewritePattern
Source code in xdsl/transforms/function_transformations.py
start_func_t: FunctionType
instance-attribute
¶
end_func_t: FunctionType
instance-attribute
¶
__init__(start_func_t: FunctionType, end_func_t: FunctionType) -> None
¶
match_and_rewrite(op: func.FuncOp, rewriter: PatternRewriter)
¶
Source code in xdsl/transforms/function_transformations.py
TestAddBenchTimersToTopLevelFunctions
dataclass
¶
Bases: ModulePass
Adds timers to top-level functions, by adding timer_start() -> f64 and timer_end(f64) -> f64
to the start and end of each module-level function. The time is stored in an llvm.ptr passed in
as a function arg.
Source code in xdsl/transforms/function_transformations.py
name = 'test-add-timers-to-top-level-funcs'
class-attribute
instance-attribute
¶
apply(ctx: Context, op: builtin.ModuleOp) -> None
¶
Source code in xdsl/transforms/function_transformations.py
FunctionPersistArgNamesPass
dataclass
¶
Bases: ModulePass
Persists func.func arg name hints to arg_attrs.
Such that, for instance
func.func @my_func(%arg_name: i32) -> ...
becomes
`func.func @my_func(%arg_name: i32 {"llvm.name" = "arg_name"}) -> ...