In the end, this commit shows how we should replace the current
"inter-procedural function attribute deduction" with a fixpoint
iteration system. For some problems with the current implementation see
. The new system allows to determine various properties, including
inter-procedural function attributes, through interlaced fixpoint
iterations. All "in-flight" attributes can query the optimistic and
known values of other attributes computed in the same fixpoint
iteration. This allows better interference if there is a mutual
dependence. Dedicated fixpoint propagations determine information
alternating through forward and backward deduction (wrt. the execution
flow) until neither yields new results (or we decide to give up).
This prototype implementation:
- determines all attributes we did with the existing code
- adds detection for multiple new attributes
- shows how local information, e.g. dereferenceability due to a load, can be propagated by the system to callees of the function (if applicable) and users of the loaded pointer alike.
- distinguishes six different kinds of attribute "positions", e.g., function attributes and return attributes (see the enum ManifestPosition), five of which can be manifested in IR.
To deduce new attributes, at a known position (see the enum
ManifestPosition), one only needs to inherit from the AbstractAttribute
class and implement all methods without a default implementation. All
but the "bool updateImpl(Attributor &A, Direction Dir)" method are often
Comment and remarks welcome!