Compiler Code Generation: Address Descriptors and Arrays

I am creating a simple DECAF compiler for MIPS assembly. Right now I can generate three address codes and I start with the code generation phase.

Several books use the structure of register descriptors and address descriptors. enter image description here

The problem I'm running into is that I don't know how to store the data in the address descriptor to access the array, since my three address codes usually have a temporary storage of the array index offset, and this may change temporarily at runtime.

For example:

y := b[$t1], x

      

In the case of simple variables, this is easy, because I have an identifier and even an integer corresponding to the memory location of the variable. How can I manage the cases of arrays to get the address descriptor working in my compiler?

thank

+3


source to share





All Articles