10.07.2015 Views

MIPS - AG Softwaretechnik

MIPS - AG Softwaretechnik

MIPS - AG Softwaretechnik

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

append wrapper procedures to your code during pretty-printing that will helpyou with this. They are:– _print: prints the content of register a0. Modifies a0,v0.– _halloc: allocates the number of bytes in a0 and leaves a pointer to thenewly allocated memory in v0. Modifies a0.– _error: prints “ERROR” and aborts.• The Spim website contains a statically-linked Spim 9.0.5 binary for Linux, whichthe KangaToMips tests use to compare the output of Kanga programs in theinterpreter with the output of your <strong>MIPS</strong> programs in Spim. Unfortunately,there is no headless Spim for Windows, so the test tool chain works on Linuxonly.Register Allocation by Graph coloringThis last part of the project consists of two parts, combining the theoretical and practicalaspects of register allocation.Liveness Analysis (5 Points = 5%)• Specify an (intra-procedural) liveness analysis for Spiglet.– In Spiglet, each procedure basically consists of a list of possibly labeledstatements. Each statement is uniquely identified by its position in the list.For a procedure S 0 . . . S n , we definepos(S 0 . . . S n ) = {0, . . . , n}to be the set of all possible positions within a procedure. We define as theentry point of the procedureand further as the exit pointinitial(S 0 . . . S n ) = 0final(S 0 . . . S n ) = nThe flow equations are now a mapping of labeled statement (with position)to a set of two positions denoting an edge in the flow graph.Example:flow([l : NOOP] i ) = {(i, i + 1)} ∀i ∈ {0, . . . , n − 1}Specify in a similar way the flow equations for all statement types in Spiglet.– For each statement, specify the use and def sets of temporaries. You maywant to define auxiliary definitions for expressions etc.The formal specification should be submitted as a PDF. An example for sucha specification can be found in Nielson et al., Principles of Program Analysis,Springer 2005, Chapter 2.1 and 2.1.4. (There, use sets are called gen sets, anddefs sets are called kill sets. Further, the labels they use do not correspond tolabels in SPiglet, but to the position of a statement in the statement list of aprocedure. )• Implement the construction of the flow graph and the liveness analysis for Spiglet.Test your liveness analysis thoroughly; debugging bad liveness information byobserving misbehaving Kanga programs is not fun.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!