正在加载图片...
The Code-Generation Algorithm Managing Register and Address Descriptors 1.For the instruction LD R,x -(a)Change the register descriptor for register R so it holds only x. -(b)Change the address descriptor for x by adding register R as an additional location. 2.For the instruction ST x,R,change the address descriptor for x to include its own location. 3.For an operation such as ADD Rx,Ry,Rz for x=y +z -(a)Change the register descriptor for Rx so that it holds only x. -(b)Change the address descriptor for x so that its only location is Rx. Note that the memory location for x is not now in the address descriptor for x. -(c)Remove Rx from the address descriptor of any variable other than x. 4.When process a copy statement x=y,after generating the load for y into register Ry,if needed,and after managing descriptors as for all load statements(per rule 1 ) -(a)Add x to the register descriptor for Ry. -(b)Change the address descriptor for x so that its only location is Ry. CS308 Compiler Theory 7The Code-Generation Algorithm • Managing Register and Address Descriptors 1 . For the instruction LD R, x – (a) Change the register descriptor for register R so it holds only x. – () g p y g g b ) Chan ge the address descri ptor for x b y addin g re gister R as an additional location. 2. For the instruction ST x, R, change the address descriptor for x to include its own location. 3. For an operation such as ADD Rx , Ry , Rz for x = y + z – ( ) Ch th i t d i t f R th t it h ld l ( a ) Change the regis ter descrip tor for Rx so th a t it h olds only x. – (b) Change the address descriptor for x so that its only location is Rx . – Note that the memory location for x is not now in the address descriptor for x . – (c) Remove Rx from the address descriptor of any variable other than x. 4. When process a copy statement x = y , after generating the load for y into register Ry, if needed, and after managing a nagin g descriptors ripto r s as for all load statements (per rule 1 ) : – (a) Add x to the register descriptor for Ry . – (b) Change the address descriptor for x so that its only location is Ry . CS308 Compiler Theory 7
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有