ABSTRACT
This paper addresses the problem of how to apply pointer analysis to a wide variety of compiler applications. We are not presenting a new pointer analysis. Rather, we focus on putting two existing pointer analyses, points-to analysis and connection analysis, to work.We demonstrate that the fundamental problem is that one must be able to compare the memory locations read/written via pointer indirections, at different program points, and one must also be able to summarize the effect of pointer references over regions in the program. It is straightforward to compute read/write sets for indirections involving stack-directed pointers using points-to information. However, for heap-directed pointers we show that one needs to introduce the notion of anchor handles into the connection analysis and then express read/write sets to the heap with respect to these anchor handles.Based on the read/write sets we show how to extend traditional analyses like common subexpression elimination, loop-invariant removal and location-invariant removal to include pointer references. We also demonstrate the use of our information on more advanced techniques such as array dependence testing and program understanding. We have implemented our techniques in our McCAT C compiler, and we demonstrate examples of applying our methods on a set of pointer-intensive C benchmarks, as well as present concrete empirical data on the improvements achieved.
- 1.A. V. Aho, R. Sethi, and J. D. Ullman. Compilcra -- Principles, Techniques, and Tools. Addison-Wesley Pub. Co., Reading, Mass., corrected edition, 1988. Google ScholarDigital Library
- 2.J. Auslander, M. Philipose, C. Chambers, S. J. Eggers, and B. N. Bershad. Fast, effective dynamic compilation. In Proc. of the A GM SIGPLAN '96 Go,}. on Programming Lang.uage Desi.~n and lmpl~m~ntntlon, pages 149-159, Philadelphia, Fenn., May 1996. Google ScholarDigital Library
- 3.T. M. Austin, S. E. Breach, and G. S. Sold. Efliclen~ detection of allpointer and array access errors. In Proc. of the A CM SIGPLAN "9~ Conf. on Proyrammin9 Long,age Design and Implementation, pages 290-301, Orlando, Flor., June 1994. Google ScholarDigital Library
- 4.D. Callahma, S. Cart, and K. Kennedy. Improving feaster alloca~iort for subscripted variables. In Proc. bf the SIGPLAN '90 Gonfl on Programminq Lan. guage Design and Implementation, pages 53-65, White Plains, N. Y., June 1990. Google ScholarDigital Library
- 5.D. R. Chase, M. Wegman, mad F. K. Zadeck. Analysis of pointers and structures. In Proe. o} the SIGPLAN '90 Gonf. on Programming Language Desiqn and Implementaa'tion, pages 296-310, White Plains, N. Y., June 1990. Google ScholarDigital Library
- 6.J.-D. Choi, M. Burke, and P. Carini. Efficient flow-sensitive interprocedural computation of pointerinduced aliases and side effects. {n Conf_; Rec. of the ".l~entieSh Ann. ACM SIGPLAN-SIGACT Syrup. on Principles of Programming Languages, pages 232-245, Charleston, South Carolina, Jan. 1993. Google ScholarDigital Library
- 7.K.D. Cooper and J. Lu. Register promotion in C pro- ~rogmS. In Proc. of the A CM SIGPLAN '97 Conf. on ramming Language Design and Implementation, pages 308-319, Las Vegas, Nee., Jtm. 1997. Google ScholarDigital Library
- 8.A. Deutsch. A stordess model of aliasing and its abstractions using finite representations of right-rea-~lar equivalence relations. In Proc. of the 1992 Intl. Conf. on Computer Languages, pages 2-13, Oakland, Calif., Apr. 1992.Google ScholarCross Ref
- 9.A. Deutsch. Interprocedural may-alias analysis for ~v~inters: Beyond k-limiting. In Proc. Of the A CM SIG- AN '9g Uonf. on Programming Language Design and lmple'mentation, pages 230-241, Orlando, Flor., June 1994. Google ScholarDigital Library
- 10.M. Emami, R. Ghiya, and L. J. Hendren. Contextsensitive interprocedural points-to analysis in the presence of function pointers. In Proc. of the A GM SIC- PLAN '9J Conf-. on Programming Language Design and Imple'mentation, pages 242-256, Orlando, Flor., June 1994. Google ScholarDigital Library
- 11.R. Ghiya. Putting Pointer Analysis to Work. Phi) thesis, School of Computer Science, McGill University, November 1997. In Preparation. Google ScholarDigital Library
- 12.R. Ghiya and L. J. Hendren. Connection analysis: A practical interprocedural heap analysis for C. Intl. J. of Parallel Programming, 24(6), pages 547-578, 1996. Google ScholarDigital Library
- 13.R. Ghiya and L. J. Hendren. Is it a tree, a DAG, or a cyclic graph? a shape analysis for he_ap-~rec_ted_po'mt: ers in -{2. In Conf. Ree. of the 23rd A CM ~IGPI,AN- SIGA CT ,.qymp. on Principles of Programming Languages, pages 1-15, St. Petersburg, Flor., Jan. 1996. Google ScholarDigital Library
- 14.V. A. Guarna, Jr. A technique for analyzing pointer and structure references in parallel restructmJng compilers. In Proc. of the 1988 Intl. Conf. on Parallel Processing, volume II, pages 212-220, St. Charles, Ill., Aug. 1988.Google Scholar
- 15.L. Hendren, C. Donawa, M. Emami, G. Gao, Justiani, and B. Sridharan. Designing the McCAT compiler based on a family of structured intermediate representations. In Proe. of the 5th lntl. Work. on Languages and Compilers for Parallel Computing, number 757 in Lec. Notes in Comp. Sci., pages 406-420, New Haven, Conn., Aug. 1992. Springer-Verlag. Publ. in 1993. Google ScholarDigital Library
- 16.L. J. Hendren and A. Nicolau. Parallelizing programs with recursive data structures. IEEE Trans. on Parallel and Distrib. Systems, 1(1):35-47, Jan. 1990. Google ScholarDigital Library
- 17.S. Horwitz, P. Pfeiffer, and T. Reps. Dependence grisly, sis for pointer variables. In Proe. of the SIGPLAN 89 Conf. on Programming Language Design and Implementation, pages 28-40, Portland, Ore., Jun. 1989. Google ScholarDigital Library
- 18.J. Hummd, L. J. Hendren, and A. Nicolau. A general data dependence test for dynamic, pointer-based data structures. In Proceedings of the A CM SIGPLAN Conference on Programming Language Design and Implementation, pages 218-229, Odando, Flor., June 1994. Google ScholarDigital Library
- 19.W. Landi and B. G. Ryder. A safe approximate algorithm for interprocedural pointer aliasing. In Proe. of the A CM SIGPLAN '92 Conf. on Programming Language Design and Implementation, pages 235-248, San Francisco, Calif., Jun. 1992. Google ScholarDigital Library
- 20.W. Landi, B. G. Ryder, and S. Zhang. Interprocedural modification side effect analysis with pointer aliasing. In Proe. of the A CM SIGPLAN "93 Conf. on Programming Language Design and Implementation, pages 56-- 67, Albuquerque, hi. Mex., Jun. 1993. Google ScholarDigital Library
- 21.C. Lapkowski and L. J. ttendren. Extended SSA numbering: Introducing SSAproperties to !a.~_g?aages with multi=level pointem, In Proceedings of CASCON'96, "lbronto, Ontario, Nov. 1996. Google ScholarDigital Library
- 22.J. R. Lan~ and P. N. Hilfinger. Detecting conflicts between structure accesses. In Proe. of the SIGPLAN "88 Conf. on Programming Language Design and Implementation, pages 21-34, Atlanta, Georgia, Jun. 1988. Google ScholarDigital Library
- 23.J. It. Larns and E. Schnarr. EEL: Machine~ independent executable editing. In Proc. of the A GM SIGPLAN "95 Conf. on Programming Language Design and Implementation, pages 291--300, La Jolla, Calif., Jun. 1995. Google ScholarDigital Library
- 24.C.-K. Luk and T. C. Mowry. Compiler-based prefetching for recursive data structures. In Proe. of_ the Seventh Intl. Conf. on Architectural Support for Programming Languages and Operating Systems, pages 222- 233, Cambridge, Mass., Oct. 1996. Google ScholarDigital Library
- 25.A. Rogers, M. C. Carlisle, J. H. Reppy, and L. J. Hendren. Supporting dynamic data structures on distributed-memory mac/~es. A CM Trans. on Programming Languages and Systems, 17(2):233-263, Mar. 1995. Google ScholarDigital Library
- 26.E. Ruf. Context-insensitive alias analysis reconsidered. In Proc. of the A CM 3IGPLAN '95 Conf. on Programming Language Design and Implementation, pages 13- 22, La JolIa, Calif., Jun. 1995. Google ScholarDigital Library
- 27.M. Sagiv, T. Reps, and It. Wilhelm. Solving shapeanalysis problems in languages with destructive up dating. In Conf. Ree. of the 23rd A CM SIGPLAN- SIGtfCT Syrup. on Principles of Programming Languages, pages 16-31, St. Petersburg, Flor., Jan. 1996. Google ScholarDigital Library
- 28.M. Shapiro and S. Horwitz. The effects of the precision of pointer analysis. In Proceedings of the 1997 Static Analysis Symposium, Paris, France, Sep. 1997. Google ScholarDigital Library
- 29.M. Shapiro and S. Horwitz. Fast and accurate flowinsensitive points-to analysis. In Con}. Rec. of the ~jlth A CM SIGPLAN-SIGA CT Syrup. on Principles of Programming Languages, pages 1-14, Paris, France, Jan. 1997. Google ScholarDigital Library
- 30.R. M. Stallrnan. Using and Porting GNU CG. Cambridge, Mass., Jun. 1992. Available via anonymous ftp from prop. ai.r, it. edu.Google Scholar
- 31.B. Steensgaard. Points-to analysis in almost linear time. In Conf. Rec. of the 23rd A CM SIGPLAN- SIGACT Syrup. on Principles of Programming Languages, pages 32-41, St. Petersburg, F}or., Jan. 1996. Google ScholarDigital Library
- 32.X. Tang, R. Ghiya, L. J. Hendren, and G. R. Gao. Heap analysis and optimizations for threaded programs. In Proe. of the 1997 Conf. on Parallel Architectures and Compilation Techniques (PA CT'97), San Francisco, Calif., Nov. 1997. Google ScholarDigital Library
- 33.R.P. WiLson and M. S. Lain. Efficient context-sensitive pointer analysis for C programs. In Proc. of the A CM SIGPLAN "95 Conf. on Programming Language Design and Implementation, pages 1-12, La Jolla, Calif., Jun. 1995. Google ScholarDigital Library
- 34.S. C. Woo, M. Ohara, E. Torrie, J. P. Shingh, and A. Gupta. The SPLAStt-2 programs: Characterization and methodological considerations. In Proc. of the ~2nd Ann. Intl. Syrup. on Computer Architecture, pages 24-36, Santa Margherita Ligure, Italy, Jtm. 1995. Google ScholarDigital Library
- 35.S. Zhang, B. G. Ryder, and W. Landi. Program decomposition for pointer aliasing: A step towards practical analyses. In Proceedings of the $th Symposium on the Foundations of Software Engineering, October 1996. Google ScholarDigital Library
Index Terms
- Putting pointer analysis to work
Recommendations
Semi-sparse flow-sensitive pointer analysis
POPL '09Pointer analysis is a prerequisite for many program analyses, and the effectiveness of these analyses depends on the precision of the pointer information they receive. Two major axes of pointer analysis precision are flow-sensitivity and context-...
Demand-driven pointer analysis
Known algorithms for pointer analysis are “global” in the sense that they perform an exhaustive analysis of a program or program component. In this paper we introduce a demand-driven approach for pointer analysis. Specifically, we describe a demand-...
Comments