File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,6 +208,9 @@ def optimize(initial_memory):
208208 basic_blocks [0 ].prev = LABELS ['*START*' ].basic_block
209209 LABELS [END_PROGRAM_LABEL ].basic_block .add_goes_to (LABELS ['*__END_PROGRAM*' ].basic_block )
210210
211+ for x in basic_blocks :
212+ x .compute_cpu_state ()
213+
211214 for x in basic_blocks :
212215 x .optimize ()
213216
Original file line number Diff line number Diff line change @@ -518,6 +518,16 @@ def guesses_initial_state_from_origin_blocks(self):
518518
519519 return regs , mems
520520
521+ def compute_cpu_state (self ):
522+ """ Resets and updates internal cpu state of this block
523+ executing the instructions of the block. The block must be a basic block
524+ (i.e. already partitioned)
525+ """
526+ self .cpu .reset ()
527+
528+ for asm_line in self .code :
529+ self .cpu .execute (asm_line )
530+
521531 def optimize (self ):
522532 """ Tries to detect peep-hole patterns in this basic block
523533 and remove them.
You can’t perform that action at this time.
0 commit comments