Skip to main content

Modeling Universal Instruction Selection

  • Conference paper
  • First Online:
Principles and Practice of Constraint Programming (CP 2015)

Part of the book series: Lecture Notes in Computer Science ((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.

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, 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. 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)

    ArticleĀ  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)

    ChapterĀ  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)

    ChapterĀ  Google ScholarĀ 

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

    ArticleĀ  MATHĀ  MathSciNetĀ  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)

    ChapterĀ  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)

    ArticleĀ  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)

    ArticleĀ  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)

    ChapterĀ  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)

    ArticleĀ  MATHĀ  MathSciNetĀ  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)

    ChapterĀ  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)

Publish with us

Policies and ethics