Contents    Page-10    Prev    Next    Page+10    Index   

Pointer References

A pointer operator specifies indirect addressing. For example, in the test program, the code john^.favorite produces the intermediate code:


  (aref (^ john) 32)

Note that a pointer operator can occur in Pascal only as the first operand of an aref, and in this case the offset is usually a constant. Compiling code for it is simple: the address is the sum of the pointer value and the offset:


 movq -1016(%rbp),%rcx  #  john -> %rcx
 movl %eax,32(%rcx)     #  %eax -> ^.[32+%rcx]
This example shows a store of %eax into memory at a location 32 bytes past the pointer value in the variable john.