Skip to content

Resolve get rec idx

ResolveGetRecIdx dataclass

ResolveGetRecIdx(measure_id_frame: MeasureIDFrame)

Bases: RewriteRule


              flowchart TD
              bloqade.stim.rewrite.resolve_get_rec_idx.ResolveGetRecIdx[ResolveGetRecIdx]

              

              click bloqade.stim.rewrite.resolve_get_rec_idx.ResolveGetRecIdx href "" "bloqade.stim.rewrite.resolve_get_rec_idx.ResolveGetRecIdx"
            

Replace GetRecIdxFromMeasurement / GetRecIdxFromPredicate with computed constants.

After MeasureIDAnalysis has produced RecId lattice elements for each helper statement, this rewrite reads RecId.idx (the final stim record index) and creates a py.Constant to replace all uses. The helper statement becomes unused and is cleaned up by DCE.