Skip to main content

Modeling Universal Instruction Selection

Part of the Lecture Notes in Computer Science book series (LNPSE,volume 9255)

Abstract

Instruction selection implements a program under compilation by selecting processor instructions and has tremendous impact on the performance of the code generated by a compiler. This paper introduces a graph-based universal representation that unifies data and control flow for both programs and processor instructions. The representation is the essential prerequisite for a constraint model for instruction selection introduced in this paper. The model is demonstrated to be expressive in that it supports many processor features that are out of reach of state-of-the-art approaches, such as advanced branching instructions, multiple register banks, and SIMD instructions. The resulting model can be solved for small to medium size input programs and sophisticated processor instructions and is competitive with LLVM in code quality. Model and representation are significant due to their expressiveness and their potential to be combined with models for other code generation tasks.

Keywords

  • Constraint Programming
  • Pattern Graph
  • Constraint Model
  • Program Graph
  • Register Allocation

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

An erratum to this chapter is available at DOI: 10.1007/978-3-319-23219-5_49

An erratum to this chapter can be found at http://dx.doi.org/10.1007/978-3-319-23219-5_49

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-319-23219-5_42
  • Chapter length: 18 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   84.99
Price excludes VAT (USA)
  • ISBN: 978-3-319-23219-5
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   109.99
Price excludes VAT (USA)

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Opturion CPX user’s guide: Version 1.0.2. Tech. rep., Opturion Pty Ltd (2013)

    Google Scholar 

  2. Aho, A.V., Ganapathi, M., Tjiang, S.W.K.: Code Generation Using Tree Matching and Dynamic Programming. Transactions on Programming Languages and Systems 11(4), 491–516 (1989)

    CrossRef  Google Scholar 

  3. Allen, J.R., Kennedy, K., Porterfield, C., Warren, J.: Conversion of Control Dependence to Data Dependence. In: ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pp. 177–189 (1983)

    Google Scholar 

  4. Arslan, M.A., Kuchcinski, K.: Instruction Selection and Scheduling for DSP Kernels on Custom Architectures. In: EUROMICRO Conference on Digital System Design (2013)

    Google Scholar 

  5. Barany, G., Krall, A.: Optimal and Heuristic Global Code Motion for Minimal Spilling. In: Jhala, R., De Bosschere, K. (eds.) Compiler Construction. LNCS, vol. 7791, pp. 21–40. Springer, Heidelberg (2013)

    CrossRef  Google Scholar 

  6. Bashford, S., Leupers, R.: Constraint Driven Code Selection for Fixed-Point DSPs. In: ACM/IEEE Design Automation Conference, pp. 817–822 (1999)

    Google Scholar 

  7. Bednarski, A., Kessler, C.W.: Optimal Integrated VLIW Code Generation with Integer Linear Programming. In: Nagel, W.E., Walter, W.V., Lehner, W. (eds.) Euro-Par 2006. LNCS, vol. 4128, pp. 461–472. Springer, Heidelberg (2006)

    CrossRef  Google Scholar 

  8. Bruno, J., Sethi, R.: Code Generation for a One-Register Machine. Journal of the ACM 23(3), 502–510 (1976)

    MATH  MathSciNet  CrossRef  Google Scholar 

  9. Buchwald, S., Zwinkau, A.: Instruction Selection by Graph Transformation. In: International Conference on Compilers, Architectures and Synthesis for Embedded Systems, pp. 31–40 (2010)

    Google Scholar 

  10. Castañeda Lozano, R., Carlsson, M., Blindell, G.H., Schulte, C.: Combinatorial spill code optimization and ultimate coalescing. In: Kulkarni, P. (ed.) Languages, Compilers, Tools and Theory for Embedded Systems, pp. 23–32. ACM Press, Edinburgh, UK (2014)

    Google Scholar 

  11. Lozano, R.C., Carlsson, M., Drejhammar, F., Schulte, C.: Constraint-Based Register Allocation and Instruction Scheduling. In: Milano, M. (ed.) CP 2012. LNCS, vol. 7514, pp. 750–766. Springer, Heidelberg (2012)

    CrossRef  Google Scholar 

  12. Click, C.: Global Code Motion/Global Value Numbering. In: ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, pp. 246–257 (1995)

    Google Scholar 

  13. Cordella, L.P., Foggia, P., Sansone, C., Vento, M.: A (Sub)Graph Isomorphism Algorithm for Matching Large Graphs. IEEE Transactions on Pattern Analysis and Machine Intelligence 26(10), 1367–1372 (2004)

    CrossRef  Google Scholar 

  14. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. ACM TOPLAS 13(4), 451–490 (1991)

    CrossRef  Google Scholar 

  15. Ebner, D., Brandner, F., Scholz, B., Krall, A., Wiedermann, P., Kadlec, A.: Generalized Instruction Selection Using SSA-Graphs. In: ACM SIGPLAN-SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, pp. 31–40 (2008)

    Google Scholar 

  16. Eckstein, E., König, O., Scholz, B.: Code Instruction Selection Based on SSA-Graphs. In: Anshelevich, E. (ed.) SCOPES 2003. LNCS, vol. 2826, pp. 49–65. Springer, Heidelberg (2003)

    CrossRef  Google Scholar 

  17. Ertl, M.A.: Optimal Code Selection in DAGs. In: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 242–249 (1999)

    Google Scholar 

  18. Ertl, M.A., Casey, K., Gregg, D.: Fast and Flexible Instruction Selection with On-Demand Tree-Parsing Automata. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 52–60 (2006)

    Google Scholar 

  19. Floch, A., Wolinski, C., Kuchcinski, K.: Combined Scheduling and Instruction Selection for Processors with Reconfigurable Cell Fabric. In: International Conference on Application-Specific Systems, Architectures and Processors, pp. 167–174 (2010)

    Google Scholar 

  20. Garey, M., Johnson, D.: Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman (1979)

    Google Scholar 

  21. Gebotys, C.H.: An Efficient Model for DSP Code Generation: Performance, Code Size, Estimated Energy. In: International Symposium on System Synthesis, pp. 41–47 (1997)

    Google Scholar 

  22. Glanville, R.S., Graham, S.L.: A New Method for Compiler Code Generation. In: ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pp. 231–254 (1978)

    Google Scholar 

  23. Hjort Blindell, G.: Survey on Instruction Selection: An Extensive and Modern Literature Study. Tech. Rep. KTH/ICT/ECS/R-13/17-SE, KTH Royal Institute of Technology, Sweden (October 2013)

    Google Scholar 

  24. Johnson, N., Mycroft, A.: Combined Code Motion and Register Allocation Using the Value State Dependence Graph. In: International Conference of Compiler Construction, pp. 1–16 (2003)

    Google Scholar 

  25. Koes, D.R., Goldstein, S.C.: Near-Optimal Instruction Selection on DAGs. In: IEEE/ACM International Symposium on Code Generation and Optimization, pp. 45–54 (2008)

    Google Scholar 

  26. Lattner, C., Adve, V.: LLVM: A compilation framework for lifelong program analysis & transformation. In: IEEE/ACM International Symposium on Code Generation and Optimization (2004)

    Google Scholar 

  27. Laurière, J.L.: A Language and a Program for Stating and Solving Combinatorial Problems. Artificial Intelligence 10(1), 29–127 (1978)

    MATH  MathSciNet  CrossRef  Google Scholar 

  28. Lee, C., Potkonjak, M., Mangione-Smith, W.H.: MediaBench: A tool for evaluating and synthesizing multimedia and communications systems. In: IEEE MICRO-30, pp. 330–335 (1997)

    Google Scholar 

  29. Leupers, R.: Code Selection for Media Processors with SIMD Instructions. In: Conference on Design, Automation and Test in Europe, pp. 4–8 (2000)

    Google Scholar 

  30. Martin, K., Wolinski, C., Kuchcinski, K., Floch, A., Charot, F.: Constraint-Driven Instructions Selection and Application Scheduling in the DURASE System. In: International Conference on Application-Specific Systems, Architectures and Processors, pp. 145–152 (2009)

    Google Scholar 

  31. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.R.: MiniZinc: Towards a Standard CP Modelling Language. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 529–543. Springer, Heidelberg (2007)

    CrossRef  Google Scholar 

  32. Pelegrí-Llopart, E., Graham, S.L.: Optimal Code Generation for Expression Trees: An Application of BURS Theory. In: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 294–308 (1988)

    Google Scholar 

  33. Sweetman, D.: See MIPS Run, Second Edition. Morgan Kaufmann (2006)

    Google Scholar 

  34. Tanaka, H., Kobayashi, S., Takeuchi, Y., Sakanushi, K., Imai, M.: A Code Selection Method for SIMD Processors with PACK Instructions. In: International Workshop on Software and Compilers for Embedded Systems, pp. 66–80

    Google Scholar 

  35. Živojnović, V., Martínez Velarde, J., Schläger, C., Meyr, H.: DSPstone: A DSP-Oriented Benchmarking Methodology. In: Conference on Signal Processing Applications and Technology, pp. 715–720 (1994)

    Google Scholar 

  36. Wilson, T., Grewal, G., Halley, B., Banerji, D.: An Integrated Approach to Retargetable Code Generation. In: International Symposium on High-Level Synthesis, pp. 70–75 (1994)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gabriel Hjort Blindell .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Hjort Blindell, G., Castañeda Lozano, R., Carlsson, M., Schulte, C. (2015). Modeling Universal Instruction Selection. In: Pesant, G. (eds) Principles and Practice of Constraint Programming. CP 2015. Lecture Notes in Computer Science(), vol 9255. Springer, Cham. https://doi.org/10.1007/978-3-319-23219-5_42

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-23219-5_42

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-23218-8

  • Online ISBN: 978-3-319-23219-5

  • eBook Packages: Computer ScienceComputer Science (R0)