Permalink
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (69 sloc) 3.33 KB
-*- mode: Text -*-
--------------------------------------------------------------------
C-Reduce TODO list:
ways to speculate:
all pessimistic
all optimisitc
mix...
documentation about creating a c-reduce pass
side effects, directory restrictions, etc.
support predicates written as perl modules
Konstantin suggestion:
deal with un-preprocessed code in a smart way, for example by
incrementally preprocessing files from inside c-reduce
implement suggestion from Joerg Sonnenberger:
do transformations in chunks, like the line-reducer pass already does
requires a good model of when this will be profitable
make it again possible to run just selected passes
optionally, keep stats about fast vs. slow tests and
successful vs. unsuccessful xforms
exploit early-exit from delta test to speed this up
keep per-pass statistic on the probability of requiring the slow test
invert this to decide how many fast tests to run in a row
need to keep checkpoints of reducer state + file
factor timeout out of test script: creduce can supply a timeout
decrease it as the test starts to run faster
support testcase obfuscation better
try to find passes that need to try a little harder-- run them in
isolation and see how long it takes to reach a fixpoint; adjust them
to back up a bit after each successful transformation, perhaps
--------------------------------------------------------------------
clang_delta TODO list:
replace for-loops with expressions guessed from initializers
guess that it executes 0 and 1 times
reduce the indirect level of struct member accesses
s.f1.f2.f3 => s.f1.f2 or s.f2.f3
Note that to do these kinds of simplification, we also need to
change struct declarations appropriately.
change string literals
change operators to other operators, e.g., replace / with +
rename enumerate types
typedef expansion
- add supports to C++ specific features
* rename class member functions to m_fn1 ...
* rename class member variables to m_a, m_b ...
* seems simple-inliner doesn't work with class member functions,
need to fix it or add a CXX-specific inlining pass
- From Konstantin Tokarev
As you may know, there is a clang-based tool "Include What You Use"
[1]. I think similar approach could be useful in C-Reduce to remove
whole header files instead of separate lines. Though I'm not sure it's
feasible without non-preprocessed source file and compilation command
line available.
I can imagine the next algorithm of reduction:
1. Reduce only the last section of translation unit corresponding to
original source file without #includes using all available passes.
2. Try to remove sections corresponding to "unused" headers
3. Move to section N-1 and proceed.
Assuming that "interesting" fragment of code is located in sections
with big numbers (source file and local headers) while first sections
contain library headers, this approach might be more efficient than
traditional line-based reduction.
[1] http://code.google.com/p/include-what-you-use
- (low priority) format string reductions:
* remove anything that's not a %d or whatever from the format string
* remove a %d directive and also the corresponding argument from a printf
- constant folding
- (low priority) constant-propagation
- (low priority) replace peephole passes in c_reduce
--------------------------------------------------------------------