CS453 Intro and PA1 1CS453 Lecture Day in the life of a Frag 1Plan for today Day in the life of a Frag– how is instruction selection performed on the body?– how is register allocation performed?– how are the prologue and epilogue added? Instruction selection and register allocationCS453 Lecture Day in the life of a Frag 2PrintSeven testing method public int testing() { System.out.println(7); return 0; }CS453 Lecture Day in the life of a Frag 3PrintSeven testing, instruction selection # ExpCALL # ExpCONST li t36, 7 # push parameter onto stack sw t36, 0($sp) subu $sp, $sp, 4 jal _printint # ExpCONST li t37, 0 #StmMOVE(ExpTEMP(t1), e) move $v0, t37CS453 Lecture Day in the life of a Frag 4SpillAll # ExpCALL # ExpCONST li $t0, 7 sw $t0, -12($fp) lw $t0, -12($fp) # push parameter onto stack sw $t0, 0($sp) subu $sp, $sp, 4 jal _printint # ExpCALL # ExpCONST li t36, 7 # push parameter onto stack sw t36, 0($sp) subu $sp, $sp, 4 jal _printint # ExpCONST li t37, 0 #StmMOVE(ExpTEMP(t1), e) move $v0, t37Before spillAfter spill # ExpCONST li $t0, 0 sw $t0, -16($fp) lw $t0, -16($fp) #StmMOVE(ExpTEMP(t1), e) move $v0, $t0CS453 Intro and PA1 2CS453 Lecture Day in the life of a Frag 5Prologue and Epilogue Prologue .text Foo_testing: Foo_testing_framesize=20 Foo_testing_paramsNregsaves=12 sw $ra, 0($sp) subu $sp, $sp, 4 sw $fp, 0($sp) subu $sp, $sp, 4 addu $fp, $sp, Foo_testing_paramsNregsaves subu $sp, $fp, Foo_testing_framesize ... # spilled instructions for body Epilogue # epilogue done2: lw $ra, -4($fp) move $t0, $fp lw $fp, -8($fp) move $fp, $sp jr
View Full Document