I have this code

S.D     F3, 0(R1)   ;  Mem [R1] ← F3            
DIV.D   F3,F2,F4    
L.D     F2, 0(R8)     ; F2 ← Mem [R8]
MPY.D   F4,F0,F3    
SUB.D   F3,F0,F4    
ADD.D   F5,F3,F2    

I need to rename the registers, but I in my task professor does not tell me which name to use, so I that confuse that because he always give me a name that I can use. But I think that free name is: R2,R3,R4,R5,R6,R7. Since renaming use for WAW and WAR so that is:

F3 in S.D and Div.D (WAW)
F2 in L.D and Div.D (WAR)
F4 in MPY.D and DIV.D (WAR)
F3 in SUB.D and MPY.D (WAR)
F3 in SUB.D,S.D and Div.D (WAW)

So new code is

    S.D     R2, 0(R1)       
    DIV.D   R3,F2,F4    
    L.D     R4, 0(R8)     
    MPY.D   F4,F0,R3    
    SUB.D   R6,F0,R5    
    ADD.D   F5,R6,R4    

But I am now so sure is this ok? because I do not have a specific way to do it, and I have question how I can rename register, i only saw one way, is there more? Can you help me?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.