MCPcopy Create free account
hub / github.com/hashintel/hash / forward

Method forward

libs/@local/hashql/mir/src/pass/analysis/dataflow/framework.rs:562–704  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

560 /// 3. Edge effects (propagate to successors)
561 #[expect(clippy::too_many_lines, reason = "minimal amount")]
562 fn forward(self) {
563 let Self {
564 analysis,
565 lattice,
566 derived_states,
567
568 body,
569 state,
570 id,
571 block,
572 mut propagate,
573 } = self;
574
575 analysis.transfer_block_params(
576 Location {
577 block: id,
578 statement_index: 0,
579 },
580 block.params,
581 state,
582 );
583
584 // Statement indices start at 1 because index 0 represents the block parameters.
585 for (index, statement) in block.statements.iter().enumerate() {
586 let location = Location {
587 block: id,
588 statement_index: index + 1,
589 };
590
591 analysis.transfer_statement(location, statement, state);
592 }
593
594 let location = Location {
595 block: id,
596 statement_index: block.statements.len() + 1,
597 };
598
599 analysis.transfer_terminator(location, &block.terminator, state);
600
601 // After processing all instructions, `state` holds the exit state of this block.
602 let exit_state = state;
603 derived_states[id].clone_from(exit_state);
604
605 match &block.terminator.kind {
606 TerminatorKind::Goto(Goto { target }) => {
607 analysis.transfer_edge(
608 id,
609 &target.args,
610 target.block,
611 &body.basic_blocks[target.block].params,
612 exit_state,
613 );
614
615 propagate(target.block, exit_state);
616 }
617 &TerminatorKind::GraphRead(GraphRead {
618 head: _,
619 body: _,

Callers 8

serverFunction · 0.80
dump_snapshotMethod · 0.80
restore_snapshotMethod · 0.80
establish_connectionFunction · 0.80
runMethod · 0.80
runMethod · 0.80
serveFunction · 0.80

Calls 14

propagateFunction · 0.85
switch_int_dataMethod · 0.80
targetsMethod · 0.80
transfer_block_paramsMethod · 0.45
iterMethod · 0.45
transfer_statementMethod · 0.45
lenMethod · 0.45
transfer_terminatorMethod · 0.45
clone_fromMethod · 0.45
transfer_edgeMethod · 0.45

Tested by 1

establish_connectionFunction · 0.64