Skip to content

Wrap const

WrapConst dataclass

WrapConst(frame: Frame)

Bases: RewriteRule


              flowchart TD
              kirin.rewrite.wrap_const.WrapConst[WrapConst]
              kirin.rewrite.abc.RewriteRule[RewriteRule]

                              kirin.rewrite.abc.RewriteRule --> kirin.rewrite.wrap_const.WrapConst
                


              click kirin.rewrite.wrap_const.WrapConst href "" "kirin.rewrite.wrap_const.WrapConst"
              click kirin.rewrite.abc.RewriteRule href "" "kirin.rewrite.abc.RewriteRule"
            

Insert constant hints into the SSA values.

Note

This pass is not exactly the same as ConstantFold. ConstantFold only rewrites the SSAValue with const.Value into a constant statement. This rule, however, inserts the entire constant lattice into the SSAValue's hints. Thus enabling other rules/analysis to utilize the constant information beyond just const.Value.