Issues in compiling PASC into SPARC assembly. - PowerPoint PPT Presentation

About This Presentation
Title:

Issues in compiling PASC into SPARC assembly.

Description:

Compile them with GCC or CC. Code generation must ... Global variables: just allocation a chunk of memory. Augment the symbol table to include offsets. ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 6
Provided by: wfa
Learn more at: http://www.cs.fsu.edu
Category:

less

Transcript and Presenter's Notes

Title: Issues in compiling PASC into SPARC assembly.


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.
Write a Comment
User Comments (0)
About PowerShow.com