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
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Opturion CPX userās guide: Version 1.0.2. Tech. rep., Opturion Pty Ltd (2013)
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)
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)
Arslan, M.A., Kuchcinski, K.: Instruction Selection and Scheduling for DSP Kernels on Custom Architectures. In: EUROMICRO Conference on Digital System Design (2013)
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)
Bashford, S., Leupers, R.: Constraint Driven Code Selection for Fixed-Point DSPs. In: ACM/IEEE Design Automation Conference, pp. 817ā822 (1999)
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)
Bruno, J., Sethi, R.: Code Generation for a One-Register Machine. Journal of the ACM 23(3), 502ā510 (1976)
Buchwald, S., Zwinkau, A.: Instruction Selection by Graph Transformation. In: International Conference on Compilers, Architectures and Synthesis for Embedded Systems, pp. 31ā40 (2010)
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)
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)
Click, C.: Global Code Motion/Global Value Numbering. In: ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, pp. 246ā257 (1995)
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)
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)
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)
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)
Ertl, M.A.: Optimal Code Selection in DAGs. In: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 242ā249 (1999)
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)
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)
Garey, M., Johnson, D.: Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman (1979)
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)
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)
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)
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)
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)
Lattner, C., Adve, V.: LLVM: A compilation framework for lifelong program analysis & transformation. In: IEEE/ACM International Symposium on Code Generation and Optimization (2004)
LauriĆØre, J.L.: A Language and a Program for Stating and Solving Combinatorial Problems. Artificial Intelligence 10(1), 29ā127 (1978)
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)
Leupers, R.: Code Selection for Media Processors with SIMD Instructions. In: Conference on Design, Automation and Test in Europe, pp. 4ā8 (2000)
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)
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)
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)
Sweetman, D.: See MIPS Run, Second Edition. Morgan Kaufmann (2006)
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
Ž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)
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)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights 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)