Opened 13 years ago

Last modified 12 years ago

#1708 closed defect (fixed)

Strip unused functions from generated code

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: normal Milestone: 1.9.0
Component: Backend Version:
Keywords: Cc: Martin Sjölund, Frenkel, TUD

Description

In order to speed up code generation and compilation, the backend could remove all functions that can no longer be called after symbolic manipulation.
For example, MultiBody simulations contain a lot of functions that are inlined or compile-time evaluated expressions.

Change History (4)

comment:1 by Jens Frenkel, 13 years ago

This should not be to complicated.

  • add a new past optimisation module (copy of removeunusedparameter)
  • collect all function calls in BackendDAE.DAE
  • collect all function calls in collected functions
  • use the collected functions for code generation 

comment:2 by Martin Sjölund, 13 years ago

If I had time, yes :)

I'd use a work list algorithm:
Create a new Function HashTable.
1) Find all paths called in the equations, add these to the work list
2) Pop the top of the work list, or stop
3) If not already visited, add function to the new function hashtable, add all called paths to the work list
4) Goto 2

comment:3 by Jens Frenkel, 13 years ago

implemented in 11318

comment:4 by Martin Sjölund, 12 years ago

Cc: Frenkel TUD added; Jens Frenkel removed
Component: Backend
Milestone: 1.9.0
Note: See TracTickets for help on using tickets.