Question: Task 3 The function find _ above _ instruction _ without _ dependencies ( ) scans a subset upward ( from bottom to top )

Task 3
The function find_above_instruction_without_dependencies() scans a subset upward (from bottom to top) until an instruction with no data dependencies is found. This alone will not be enough to sufficiently check the subset for suitable instructions to swap, because when a suitable instruction is not found searching bottom to top, the search must be repeated from top to bottom.
Complete find_above_instruction_without_dependencies().
Note: When checking whether or not an instruction is truly dependency-free, we must check in both directions (i.e., instruction_A against instruction_B and instruction_B against instruction_A.
The bidirectional check only applies to the intermediate instructions (intermediate_index) but not the current instruction (current_index). The current instruction is always below the test instruction (test_index), even after swapping. Thus, you only need to compare the rd of the test instruction with the rs of the current instruction.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!