Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#14 summary of a function

open
nobody
None
5
2007-02-19
2007-02-19
No

I would like to have a summary of a given function in an ast dump from the gcc compiler.

it would summarize all assembly operations that take place.

first by type : it would list all types of operations and how often they take place.

each count is then a probability sample in some environment. that sampling experiment is indicated by the value. we can use that count by placing it as an object in the domain of occurance count.
it could even be replaced by vaguer(less exact) statements. or we just see it as a set of logic rules that can later be referenced.
now, if we drill down on the set of data that is behind the count, we automatically select the type because it defines the count.

the next step would be to introduce more constraints.

we could also then say we would like to select all the pairs of instances of that type of operation where there occurs that the values are read/write to/from some variable.

for each variable, I would like to see the summary of reads and writes with also some indication to the ordering of execution of them.

all of this data should be selected by processing the gcc dumped asts.

first we would roll up the usage to the top of the function. each block that is nested will pass on the usage data to its parent. finally the top level function will collect all data from the subblocks.

rollup (function decl ast) ->
instruction(type,args,context,function)

at the top level, we filter then by type. building sets of them by type :

instruction(type,args,context,function)
instruction<type>(args,context,function)

this creates a new template class, like in c++.

now, how can we find the access to a variable?
lets say that we have a set of variable names.

variables(context,function)

and we also have a knowledge where that variable was referenced in the arg:

references(args,context,function,variables)

that determines in there are some args that reference some function for a given instruction. it is implementation specific how it is implemented.

Discussion