John Simmons's Wiki Site

 

CompilersFinalProject

Page history last edited by John Simmons 2 yrs ago

12/30/2004

 

It looks like I need to look at my chapter 12 code to see what I did for

generating the final assembly language. I think that I need to modify part

of what I did for chapter 9 to produce yet another tree structure with a new

kind of fragment, say a Translate.AssemblyProcFrag, having a list of assembly

instructions. I'll have to decide whether to keep the other structures from

the previous fragments in this one, or drop them.

 

set SOURCEDIR=D:\uofm\c4041s2005\src\chap12

 

My Proc may need more information.

 

In chapter 12, I rewrote or added these classes:

 

Main

 

I added code to create an output file name, create a code generation visitor

based on it, and call it on the canonicalized version to generate assembly

code to a text file.

 

Frame.Frame

 

I added procEntryExit3() to transform an instruction list into a Proc

containing the instructions necessary to declare the function, adjust the

stack pointer, reset the stack pointer, jump to the return address, and mark

the end of the function.

 

Frame.Proc

 

This is new. It contains a prefix string, a list of body instructions, and a

postfix string. I may want to redo this.

 

jvm.GenerateAssemblyCode

 

The actual code generator. I need to review it.

 

jvm.JVMFrame

 

I added an implementation of procEntryExit3() and supporting methods to

generate the prefix and postfix. This should probably be reviewed. I may be

able to increase the efficiency by not creating a new AppendTypeVisitor each

time that I call this.

 

I'll examine these one at a time.

 

set SOURCEDIR=D:\uofm\c4041s2005\src\chap7

 

I just realized that, at the end of a function, you can add instructions to

move the values back into callee save registers after the instruction to

move the return value to the return register.

 

I need to review what is done in jvm.InFrame.

 

Will the label map and the internal function in jvm.JVMFrame work? It looks

like it must be called only on the prototype frame for this to work.

 

I still have a way to go to get the chapter 7 code javadoced.

 

Main

 

I create a jvm.GenerateAssemblyCode that knows the output file name, then

ran that visitor on the canonicalized result to generate Oolong assembly code

and write it to a file.

 

Frame.Frame

 

Frame.Proc

 

jvm.GenerateAssemblyCode

 

jvm.JVMFrame

 

The description of procEntryExit2 is on pages 199 and 200. I need to review

this.

 

List caller save registers in the def of a call.

 

I don't think that any of my examples have any comments in them. I should

add some to see if the students can handle them.

Comments (0)

You don't have permission to comment on this page.