Chapter 7: Intermediate representation and symbol table

Storage Allocation Information

. information about storage locations is kept in the symbol table

. if target is assembly code then assembler can take care of storage for various names

. compiler needs to generate data definitions to be appended to assembly code

. if target is machine code then compiler does the allocation

. for names whose storage is allocated at runtime no storage allocation is done

Information about the storage locations that will be bound to names at run time is kept in the symbol table. If the target is assembly code, the assembler can take care of storage for various names. All the compiler has to do is to scan the symbol table, after generating assembly code, and generate assembly language data definitions to be appended to the assembly language program for each name. If machine code is to be generated by the compiler, then the position of each data object relative to a fixed origin must be ascertained. The compiler has to do the allocation in this case. In the case of names whose storage is allocated on a stack or heap, the compiler does not allocate storage at all, it plans out the activation record for each procedure.