Miguel Angel wrote:
> Hello!
> 
> I have a VERY simple example:
> int f1 (int i) {i = (i-7)/9+3; return i;}
> int f2 (int i) {i = (i-7)/9+3; return i;}
> 
> It could be reduced to:
> int f1 (int i) {i = (i-7)/9+3; return i;}
> int f2 (int i) {return f1 (i);}
> 
> 
> Are there any ideas on how and where to add a target and language
> independent code compaction pass into gcc?

Some people call this "uninlining".  I've also heard the term
"procedural abstraction".  The generalization is to identify common code
fragments that can be turned into functions.  Then, replace the users of
the common code with function calls.

If we wanted to do this in GCC, it might well make sense to do this at
the same place we presently do inlining.  Some toolchains do it in the
linker, at the level of assembly code.

-- 
Mark Mitchell
CodeSourcery
[EMAIL PROTECTED]
(650) 331-3385 x713

Reply via email to