Generate code for the following three-address statements assuming stack allocation where register SP points to the top of the stack.
call p call q return call r return return
100: LD SP, #stackStart 108: ADD SP, SP, #psize 116: ST *SP, #132 124: BR pStart 132: SUB SP, SP, #psize 140: ADD SP, SP, #qsize 148: ST *SP, #164 156: BR qStart 164: SUB SP, SP, #qsize 172: BR **SP
Generate code for the following three-address statements again assuming stack allocation and assuming a and b are arrays whose elements are 4-byte values.
The four-statement sequence
x = a[i] y = b[j] a[i] = y b[j] = x
The three-statement sequence
x = a[i] y = b[i] z = x * y
x = a[i] y = b[x] a[i] = y
120: ST 364, #140 132: BR 200 140: ACTION2
图 8-4 部分代码
100: LD, SP, #600 108: ACTION1 128: ADD SP, SP, #msize 136: ST *SP, #152
图 8-6 部分代码
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8