Type-Directed Flow Analysis for Typed Intermediate Languages

Flow analysis is especially valuable for optimizing functional languages because control-flow information is not syntactically apparent in higher-order programs. Flow analyses typically operate on untyped languages. However, recent compilers for typed functional languages such as ML and Haskell use a typed intermediate language to expose data representations for optimization. This paper presents a polyvariant flow analysis framework for the predicative subset of system F, a common basis for typed intermediate languages. Analyses in this framework can take advantage of types to analyze programs more precisely. We study a specific analysis called SRT that uses types to control polyvariance. We prove that SRTrespects types: whenever it assigns abstract value \(\hat \upsilon\)to a variable and the type system assigns type σ to the same variable, then \(\left[ {\hat \upsilon } \right] \subseteq \left[ \sigma \right]\), where [ · ] denotes a set of values. SRT does not terminate 1569 1655 V 3 for some programs. We present several variants of SRT that are better suited to practical use.

[1]  Suresh Jagannathan,et al.  A unified treatment of flow analysis in higher-order languages , 1995, POPL '95.

[2]  John C. Mitchell,et al.  On the type structure of standard ML , 1993, TOPL.

[3]  David F. Bacon,et al.  Fast static analysis of C++ virtual function calls , 1996, OOPSLA '96.

[4]  Craig Chambers,et al.  Iterative type analysis and extended message splitting; optimizing dynamically-typed object-oriented programs , 1990, PLDI '90.

[5]  Anindya Banerjee A modular, polyvariant and type-based closure analysis , 1997, ICFP '97.

[6]  David A. McAllester,et al.  Linear-time subtransitive control flow analysis , 1997, PLDI '97.

[7]  Alexander Aiken,et al.  Soft typing with conditional types , 1994, POPL '94.

[8]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[9]  Simon L. Peyton Jones,et al.  Compiling Haskell by Program Transformation: A Report from the Trenches , 1996, ESOP.

[10]  Fritz Henglein,et al.  Polymorphic Binding-Time Analysis , 1994, ESOP.

[11]  Jens Palsberg,et al.  A type system equivalent to flow analysis , 1995, TOPL.

[12]  Nevin Heintze Control-Flow Analysis and Type Systems , 1995, SAS.

[13]  David A. Schmidt Natural-Semantics-Based Abstract Interpretation (Preliminary Version) , 1995, SAS.

[14]  Suresh Jagannathan,et al.  Effective Flow Analysis for Avoiding Run-Time Checks , 1995, SAS.

[15]  Matthias Felleisen,et al.  Componential set-based analysis , 1997, TOPL.

[16]  Franklyn Turbak,et al.  Strongly Typed Flow-Directed Representation Transformations. , 1997, ICFP 1997.

[17]  Flemming Nielson,et al.  Infinitary control flow analysis: a collecting semantics for closure analysis , 1997, POPL '97.

[18]  Suresh Jagannathan,et al.  Flow-directed inlining , 1996, PLDI '96.

[19]  J. Girard Une Extension De ĽInterpretation De Gödel a ĽAnalyse, Et Son Application a ĽElimination Des Coupures Dans ĽAnalyse Et La Theorie Des Types , 1971 .

[20]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .

[21]  Nevin Heintze,et al.  Set-based analysis of ML programs , 1994, LFP '94.

[22]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[23]  Philip Wadler,et al.  Once upon a type , 1995, FPCA '95.

[24]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.