Skip to main content

An Empirical Study on the Granularity of Pointer Analysis in C Programs

  • Conference paper
Languages and Compilers for Parallel Computing (LCPC 2002)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 2481))

Abstract

Pointer analysis plays a critical role in modern C compilers because of the frequent appearances of pointer expressions. It is even more important for data dependence analysis, which is essential in exploiting parallelism, because complex data structures such as arrays are often accessed through pointers in C. One of the important aspects of pointer analysis methods is their granularity, the way in which the memory objects are named for analysis. The naming schemes used in a pointer analysis affect its effectiveness, especially for pointers pointing to heap memory blocks. In this paper, we present a new approach that applies the compiler analysis and profiling techniques together to study the impact of the granularity in pointer analyses. An instrumentation tool, based on the Intel’s Open Resource Compiler (ORC), is devised to simulate different naming schemes and collect precise target sets for indirect references at runtime. The collected target sets are then fed back to the ORC compiler to evaluate the effectiveness of different granularity in pointer analyses. The change of the alias queries in the compiler analyses and the change of performance of the output code at different granularity levels are observed. With the experiments on the SPEC CPU2000 integer benchmarks, we found that 1) finer granularity of pointer analysis show great potential in optimizations, and may bring about up to 15% performance improvement, 2) the common naming scheme, which gives heap memory blocks names according to the line number of system memory allocation calls, is not powerful enough for some benchmarks. The wrapper functions for allocation or the user-defined memory management functions have to be recognized to produce better pointer analysis result, 3) pointer analysis of fine granularity requires inter-procedural analysis, and 4) it is also quite important that a naming scheme distinguish the fields of a structure in the targets.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Chase, D.R., Wegman, M., Zadeck, F.K.: Analysis of pointers and structures. In: Proceedings of SIGPLAN 1990 Conference on Programming Language Design and Implementation, pp. 296–310 (June 1990)

    Google Scholar 

  2. Landi, W., Ryder, B.G.: A safe approximate algorithm for interprocedural pointer aliasing. In: Proceedings of the SIGPLAN 1992 Conference on Programming Language Design and Implementation, July 1992, pp. 235–248 (1992)

    Google Scholar 

  3. Tang, X., Ghiya, R., Hendren, L.J., Gao, G.R.: Heap analysis and optimizations for threaded programs. In: Proc. of the 1997 Conf. on Parallel Architectures and Compilation Techniques (November 1997)

    Google Scholar 

  4. Choi, Burke, M., Carini, P.: Efficient flow-sensitive interprocedural computation of pointer-induced aliases and sife-effects. In: Proceedings of the ACM 20th Symposium on Principles of Programming Languages, January 1993, pp. 232–245 (1993)

    Google Scholar 

  5. Emami, M., Ghiya, R., Hendren, L.J.: Context-sensitive interprocedural points-to analysis in the presence of function pointers. In: Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, June 1994, pp. 242–256 (1994)

    Google Scholar 

  6. Heintze, N., Tardieu, O.: Demand-Driven Pointer Analysis. In: ACM SIGPLAN Conference on programming Language Design and Implementation 2001 (2001)

    Google Scholar 

  7. Wilson, R.P., Lam, M.S.: Efficient context-sensitive pointer analysis for C programs. In: Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, June 1995, pp. 1–12 (1995)

    Google Scholar 

  8. Steensgaard, B.: Points-to analysis in almost linear time. In: Conference Record of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of Programming Languages, January 1996, pp. 32–41 (1996)

    Google Scholar 

  9. Zheng, B.: Integrating scalar analyses and optimizations in a parallelizing and optimizing compiler. PhD thesis (February 2000)

    Google Scholar 

  10. Cheng, B.-C.: Compile-time memory disambiguation for C programs. PhD. Thesis (2000)

    Google Scholar 

  11. Hind, M., Pioli, A.: Evaluating the effectiveness of Pointer Alias Analysis. Science of Computer Programming 39(1), 31–35 (2001)

    Article  MATH  Google Scholar 

  12. Ghiya, R., Lavery, D., Sehr, D.: On the Importance of Points-To Analysis and Other Memory Disambiguation methods For C programs. In: Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, June 2001, pp. 47–58 (2001)

    Google Scholar 

  13. Mock, M., Das, M., Chambers, C., Eggers, S.J.: Dynamic Points-to Sets: A Comparison with Static Analyses and Potential Applications in Program Understanding and Optimzation. In: ACM SIGPLAN-SIGSOFT Workshop on Program Analysis 14for Software tools and Engineering (June 2001)

    Google Scholar 

  14. Ju, R., Chan, S., Wu, C.: Open Research Compiler for the Itanium Family. Tutorial at the 34th Annual International Symposium on Microarchitecture

    Google Scholar 

  15. Jones, N.D., Muchnick, S.S.: A Flexible Approach to Interprocedural Flow Analysis and Programs with Recursive Data Structures. In: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1982)

    Google Scholar 

  16. Zhang, S., Ryder, B.G., Landi, W.: Program decomposition for pointer aliasing: A step towards practical analyses. In: Proceedings of the 4th Symposium on the Foundations of Software Engineering (October 1996)

    Google Scholar 

  17. Chen, T., Lin, J., Hsu, W.-C., Yew, P.-C.: On the Impact of Naming Methods for Heap-Oriented Pointers in C Programs. In: International Symposium on Parallel Architectures, Algorithms, and Networks (2002)

    Google Scholar 

  18. Spec CPU 2000, http://www.specbench.org/osg/cpu2000/

  19. Gao, G.R., Amaral, J.N., Dehnert, J., Towle, R.: The SGI Pro64 compiler infrastructure: A tutorial. Tutorial presented at the International Conference on Parallel Architecture and Compilation Techniques (October 2000)

    Google Scholar 

  20. Chow, F., Lo, R., Liu, S.-M., Chan, S., Streich, M.: Effective Representation of Aliases and Indirect Memory Operations in SSA Form. In: Proc. of 6th Int’l Conf. on Compiler Construction, pp. 253–257 (April 1996)

    Google Scholar 

  21. Shapiro, M., Horwitz, S.: The effects of the precision of pointer analysis. In: Van Hentenryck, P. (ed.) SAS 1997. LNCS, vol. 1302. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  22. Chow, F., Chan, S., Kennedy, R., Liu, S.-M., Lo, R., Tu, P.: A new algorithm for partial redundancy elimination based on SSA form. In: Proc. of SIGPLAN 1997 Conference on Programming Language Design and Implementation, May 1997, pp. 273–286 (1997)

    Google Scholar 

  23. Wolf, M.E., Maydan, D.E., Chen, D.-K.: Combining Loop Transformations Considering Caches and Scheduling. Int’l J. of Parallel Programming 26(4), 479–503 (1998)

    Article  Google Scholar 

  24. Diwan, A., McKinley, K.S., Eliot, J., Moss, B.: Type-Based Alias Analysis. In: SIGPLAN Conference on Programming Language Design and Implementation, June 1998, pp. 106–117 (1998)

    Google Scholar 

  25. Yong, S.H., Horwitz, S., Reps, T.: Pointer Analysis for Programs with Structures and Casting. In: SIGPLAN Conference on Programming Language Design and Implementation, vol. 34, pp. 91–103 (1999)

    Google Scholar 

  26. Ruf, E.: Context-Insensitive Alias Analysis Reconsidered. In: ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation (PLDI 1995), La Jolla, California, June 1995, vol. 30, pp. 13–22 (1995)

    Google Scholar 

  27. Choi, D., Burke, M.G., Carini, P.: Efficient flow-sensitive interprocedural computation of pointer induced aliases and side effects. In: Conference Record of the Twentieth Annual ACM Symposium on Principles of Programming Languages, January 1993, pp. 232–245 (1993)

    Google Scholar 

  28. Ryder, B.G., Landi, W.A., Stocks, P.A., Zhang, S., Altucher, R.: A Scheme for Interprocedural Modification Side-Effect Analysis with Pointer Aliasing. ACM Transactions on Programming Languages and Systems (TOPLAS) 23(2), 105–186 (2001)

    Article  Google Scholar 

  29. Hind, M., Pioli, A.: An Empirical Comparison of Interprocedural Pointer Alias Analyses. IBM Report #21058 (December 1997)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Chen, T., Lin, J., Hsu, WC., Yew, PC. (2005). An Empirical Study on the Granularity of Pointer Analysis in C Programs. In: Pugh, B., Tseng, CW. (eds) Languages and Compilers for Parallel Computing. LCPC 2002. Lecture Notes in Computer Science, vol 2481. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11596110_11

Download citation

  • DOI: https://doi.org/10.1007/11596110_11

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-30781-5

  • Online ISBN: 978-3-540-31612-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics