16.07.2014 Views

PROGRAM STRUCTURE TREES - Software Systems Lab

PROGRAM STRUCTURE TREES - Software Systems Lab

PROGRAM STRUCTURE TREES - Software Systems Lab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

One possibility is to analyze different parts of a program with different<br />

accuracy, such that only interesting regions are analyzed precisely.<br />

Other regions could be analyzed roughly and, if required, be refined<br />

later.<br />

Another possiblity is to hide the complexity of a program, by considering<br />

only the overall effect of a region on the program state, but<br />

not simulating every single change that the execution of a program<br />

region implies. As the complexity of a lot of algorithms is related to the<br />

number of analyzed program states, reducing the number of program<br />

states might improve runtime significantly.<br />

5.1 The control flow automaton<br />

Static program analisis often uses a control flow automaton (CFA) to<br />

represent a program, in contrast to the CFGs that are more widespread<br />

in optimizing compilers.<br />

A control flow automaton is a graph G=(V, E) with a set of vertives V<br />

and a set of edges E. Every vertice represents a program state. Transitions<br />

in between program states are defined by the edges, that connect<br />

two states applying an operation. The operations can be either a set of<br />

calculations or a assume operation.<br />

5.2 Convert an CFG to an CFA<br />

To convert an CFG to an CFA as seen in 5 it is necessary to find the<br />

program states and transitions in an CFG. In a CFG the program state<br />

is changed by the operations executed in the basic blocks. Before and<br />

after the operations in a basic block, there is a defined program state.<br />

Therefore we can create for every basic block BB two new program<br />

states c 1, c 2 one defining the state before and one after the execution of<br />

BB. The transition between these two program states can be defined as<br />

execution of the operations contained in the basic block. If a terminating<br />

branch statement exists in the basic block, the conditions can be applied<br />

as assume operations on the transitions from c 2 to the next program<br />

states.<br />

8

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

Saved successfully!

Ooh no, something went wrong!