A Non-iterative Data-Flow Algorithm for Computing Liveness Sets in Strict SSA Programs

  • Benoit Boissinot
  • Florian Brandner
  • Alain Darte
  • Benoît Dupont de Dinechin
  • Fabrice Rastello
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7078)

Abstract

We revisit the problem of computing liveness sets (the sets of variables live-in and live-out of basic blocks) for programs in strict static single assignment (SSA). In strict SSA, aka SSA with dominance property, the definition of a variable always dominates all its uses. We exploit this property and the concept of loop-nesting forest to design a fast two-phases data-flow algorithm: a first pass traverses the control-flow graph (CFG), propagating liveness information backwards, a second pass traverses a loop-nesting forest, updating liveness sets within loops. The algorithm is proved correct even for irreducible CFGs. We analyze its algorithmic complexity and evaluate its efficiency on SPECINT 2000. Compared to traditional iterative data-flow approaches, which perform updates until a fixed point is reached, our algorithm is 2 times faster on average. Other approaches are possible that propagate from uses to definitions, one variable at a time, instead of unioning sets as in data-flow analysis. Our algorithm is 1.43 times faster than the fastest alternative on average, when sets are represented as bitsets and for optimized programs, which have non-trivial live-ranges and a larger number of variables.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley (2006)Google Scholar
  2. 2.
    Allen, F.E., Cocke, J.: A program data flow analysis procedure. Communications ACM 19(3), 137 (1976)CrossRefMATHGoogle Scholar
  3. 3.
    Appel, A.W., Palsberg, J.: Modern Compiler Implementation in Java, 2nd edn. Cambridge University Press (2002)Google Scholar
  4. 4.
    Bender, M., Farach-Colton, M.: The LCA Problem Revisited. In: Gonnet, G.H., Viola, A. (eds.) LATIN 2000. LNCS, vol. 1776, pp. 88–94. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  5. 5.
    Boissinot, B., Darte, A., Dupont de Dinechin, B., Guillon, C., Rastello, F.: Revisiting out-of-SSA translation for correctness, code quality, and efficiency. In: Symp. on Code Generation and Optimization (CGO 2009), pp. 114–125. ACM (2009)Google Scholar
  6. 6.
    Boissinot, B.: Towards an SSA-Based Compiler Back-End: Some Interesting Properties of SSA and its Extensions. PhD thesis, ENS-Lyon (September 2010)Google Scholar
  7. 7.
    Boissinot, B., Brandner, F., Darte, A., de Dinechin, B.D., Rastello, F.: Computing liveness sets for SSA-form programs. TR Inria RR-7503 (2011)Google Scholar
  8. 8.
    Boissinot, B., Brisk, P., Darte, A., Rastello, F.: SSI properties revisited. ACM Transactions on Embedded Computing Systems, Special Issue on Software and Compilers for Embedded Systems (2009) (to appear)Google Scholar
  9. 9.
    Boissinot, B., Hack, S., Grund, D., de Dinechin, B.D., Rastello, F.: Fast liveness checking for SSA-programs. In: IEEE/ACM Symposium on Code Generation and Optimization (CGO 2008), pp. 35–44. ACM (2008)Google Scholar
  10. 10.
    Bouchez, F., Darte, A., Guillon, C., Rastello, F.: Register Allocation: What does the NP-Completeness Proof of Chaitin et al. Really Prove? In: Almási, G.S., Caşcaval, C., Wu, P. (eds.) KSEM 2006. LNCS, vol. 4382, pp. 283–298. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  11. 11.
    Briggs, P., Cooper, K.D., Harvey, T.J., Simpson, L.T.: Practical improvements to the construction and destruction of static single assignment form. Software—Practice and Experience 28(8), 859–881 (1998)CrossRefGoogle Scholar
  12. 12.
    Briggs, P., Torczon, L.: An efficient representation for sparse sets. ACM Letters on Programming Languages and Systems (LOPLAS) 2, 59–69 (1993)CrossRefGoogle Scholar
  13. 13.
    Carter, L., Ferrante, J., Thomborson, C.: Folklore confirmed: Reducible flow graphs are exponentially larger. In: ACM SIGACT/SIGPLAN Symposium on Principles of Programming Languages (POPL 2003), pp. 106–114. ACM (2003)Google Scholar
  14. 14.
    Click, C., Paleczny, M.: A simple graph-based intermediate representation. In: ACM Workshop on Intermediate Representations, pp. 35–49. ACM (1995)Google Scholar
  15. 15.
    Cooper, K.D., Harvey, T.J., Kennedy, K.: An empirical study of iterative data-flow analysis. In: 15th International Conference on Computing (ICC 2006), pp. 266–276. IEEE Computer Society, Washington, DC, USA (2006)CrossRefGoogle Scholar
  16. 16.
    Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadek, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13(4), 451–490 (1991)CrossRefGoogle Scholar
  17. 17.
    de Dinechin, B.D., de Ferrière, F., Guillon, C., Stoutchinin, A.: Code generator optimizations for the ST120 DSP-MCU core. In: Compilers, Architecture, and Synthesis for Embedded Systems (CASES 2000), pp. 93–102. ACM (2000)Google Scholar
  18. 18.
    Hack, S., Grund, D., Goos, G.: Register Allocation for Programs in SSA Form. In: Mycroft, A., Zeller, A. (eds.) CC 2006. LNCS, vol. 3923, pp. 247–262. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  19. 19.
    Havlak, P.: Nesting of reducible and irreducible loops. ACM Transactions on Programming Languages and Systems 19(4), 557–567 (1997)CrossRefGoogle Scholar
  20. 20.
    Hecht, M.S., Ullman, J.D.: Characterizations of reducible flow graphs. Journal of the ACM 21(3), 367–375 (1974)MathSciNetCrossRefMATHGoogle Scholar
  21. 21.
    Hecht, M.S., Ullman, J.D.: Analysis of a simple algorithm for global data flow problems. In: 1st Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 1973), pp. 207–217. ACM (1973)Google Scholar
  22. 22.
    Janssen, J., Corporaal, H.: Making graphs reducible with controlled node splitting. ACM Trans. on Programming Languages and Systems 19, 1031–1052 (1997)CrossRefGoogle Scholar
  23. 23.
    Kam, J.B., Ullman, J.D.: Global data flow analysis and iterative algorithms. Journal of the ACM 23(1), 158–171 (1976)MathSciNetCrossRefMATHGoogle Scholar
  24. 24.
    Kildall, G.A.: A unified approach to global program optimization. In: Symposium on Principles of Programming Languages (POPL 1973), pp. 194–206. ACM (1973)Google Scholar
  25. 25.
    Kotzmann, T., Wimmer, C., Mössenböck, H., Rodriguez, T., Russell, K., Cox, D.: Design of the Java HotSpotTM client compiler for Java 6. ACM Transactions on Architecture and Code Optimization 5, 1–32 (2008)CrossRefGoogle Scholar
  26. 26.
    Leung, A., George, L.: Static single assignment form for machine code. In: ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 999), pp. 204–214. ACM Press (1999)Google Scholar
  27. 27.
    LibFirm: A library that provides an intermediate representation and optimisations for compilers, http://pp.info.uni-karlsruhe.de/firm
  28. 28.
    LLVM: The LLVM compiler infrastructure, http://llvm.org
  29. 29.
    McAllester, D.: On the complexity analysis of static analyses. Journal of the ACM 49, 512–537 (2002)MathSciNetCrossRefMATHGoogle Scholar
  30. 30.
    Minoux, M.: LTUR: A simplified linear-time unit resolution algorithm for Horn formulae and computer implementation. Inform. Processing Letters 29, 1–12 (1988)MathSciNetCrossRefMATHGoogle Scholar
  31. 31.
    Mono: NET development framework, http://www.mono-project.com
  32. 32.
    Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis. Springer-Verlag New York, Inc. (1999)Google Scholar
  33. 33.
    Pereira, F.M.Q., Palsberg, J.: Register Allocation Via Coloring of Chordal Graphs. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 315–329. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  34. 34.
    Ramalingam, G.: Identifying loops in almost linear time. ACM Transactions on Programming Languages and Systems 21(2), 175–188 (1999)CrossRefGoogle Scholar
  35. 35.
    Ramalingam, G.: On loops, dominators, and dominance frontiers. ACM Transactions on Programming Languages and Systems 24(5), 455–490 (2002)CrossRefGoogle Scholar
  36. 36.
    Ryder, B.G., Paull, M.C.: Elimination algorithms for data flow analysis. ACM Computing Surveys 18(3), 277–316 (1986)CrossRefGoogle Scholar
  37. 37.
    Sreedhar, V.C., Ju, R.D.-C., Gillies, D.M., Santhanam, V.: Translating out of Static Single Assignment Form. In: Cortesi, A., Filé, G. (eds.) SAS 1999. LNCS, vol. 1694, pp. 194–210. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  38. 38.
    Tarjan, R.E.: Testing flow graph reducibility. Journal of Computer and System Sciences 9(3), 355–365 (1974)MathSciNetCrossRefMATHGoogle Scholar
  39. 39.
    Wimmer, C., Franz, M.: Linear scan register allocation on SSA form. In: Symp. on Code Generation and Optimization (CGO 2010), pp. 170–179. ACM (2010)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Benoit Boissinot
    • 1
  • Florian Brandner
    • 1
  • Alain Darte
    • 1
  • Benoît Dupont de Dinechin
    • 2
  • Fabrice Rastello
    • 1
  1. 1.LIP, UMR 5668 CNRS, INRIA, ENS-Lyon, UCB-LyonFrance
  2. 2.KalrayFrance

Personalised recommendations