1 / 5

Issues in compiling PASC into SPARC assembly. Predefined subroutines. Write them in C

Issues in compiling PASC into SPARC assembly. Predefined subroutines. Write them in C Compile them with GCC or CC Code generation must following the CC calling convention %o0: first argument %o1: second argument See lib.c and t1.s. Memory allocation:

pegeen
Télécharger la présentation

Issues in compiling PASC into SPARC assembly. Predefined subroutines. Write them in C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Issues in compiling PASC into SPARC assembly. • Predefined subroutines. • Write them in C • Compile them with GCC or CC • Code generation must following the CC calling convention • %o0: first argument • %o1: second argument • See lib.c and t1.s

  2. Memory allocation: • Global variables: just allocation a chunk of memory • Augment the symbol table to include offsets. • You can associate the symbol with its location. • Still need to use offset to deal with arrays and records. • Accessing the variables: see t2.pasc • Local variables: • Allocate space on the stack. • Access the variable through the frame point (using the offset information)

  3. Memory allocation: • Temporaries: • To simplify the compilation, we can always use memory to store the temporaries. • With the reuse scheme, the number of temporaries would not be too many – can just allocate as a global data • Code generation for calculations • SPARC only performs computations using registers. • Can just generate a sequence of code for each intermediate instruction, such as t1 := t2 + t3 • See example t3.s

  4. Other features of sparc assembly: • Delay slot – the instruction after a branch instruction will be executed. • To simplify code generation, add ‘nop’ to every branch instruction. • save/restore: the use of register files to speed up function calls. • Data alignment: integers must be aligned to 4 bytes.

  5. The use of proj4.c • See example1.c and example2.c • It would help if you implement the generate emit routine.

More Related