Modeling Universal Instruction Selection

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.

[1]  Eduardo Pelegrí-Llopart,et al.  Optimal code generation for expression trees: an application BURS theory , 1988, POPL '88.

[2]  Mats Carlsson,et al.  Combinatorial spill code optimization and ultimate coalescing , 2014, LCTES '14.

[3]  Albrecht Kadlec,et al.  Generalized instruction selection using SSA-graphs , 2008, LCTES '08.

[4]  Jean-Louis Laurière,et al.  A Language and a Program for Stating and Solving Combinatorial Problems , 1978, Artif. Intell..

[5]  Krzysztof Kuchcinski,et al.  Instruction Selection and Scheduling for DSP Kernels on Custom Architectures , 2013, 2013 Euromicro Conference on Digital System Design.

[6]  Sebastian Buchwald,et al.  Instruction selection by graph transformation , 2010, CASES '10.

[7]  R. Leupers Code selection for media processors with SIMD instructions , 2000, Proceedings Design, Automation and Test in Europe Conference and Exhibition 2000 (Cat. No. PR00537).

[8]  Dominic Sweetman See MIPS Run, Second Edition , 2006 .

[9]  Ken Kennedy,et al.  Conversion of control dependence to data dependence , 1983, POPL '83.

[10]  François Charot,et al.  Constraint-Driven Instructions Selection and Application Scheduling in the DURASE system , 2009, 2009 20th IEEE International Conference on Application-specific Systems, Architectures and Processors.

[11]  Alfred V. Aho,et al.  Code generation using tree matching and dynamic programming , 1989, ACM Trans. Program. Lang. Syst..

[12]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

[13]  Gary William Grewal,et al.  An integrated approach to retargetable code generation , 1994, Proceedings of 7th International Symposium on High-Level Synthesis.

[14]  Mario Vento,et al.  A (sub)graph isomorphism algorithm for matching large graphs , 2004, IEEE Transactions on Pattern Analysis and Machine Intelligence.

[15]  David Gregg,et al.  Fast and flexible instruction selection with on-demand tree-parsing automata , 2006, PLDI '06.

[16]  Miodrag Potkonjak,et al.  MediaBench: a tool for evaluating and synthesizing multimedia and communications systems , 1997, Proceedings of 30th Annual International Symposium on Microarchitecture.

[17]  Cliff Click,et al.  Global code motion/global value numbering , 1995, PLDI '95.

[18]  John L. Bruno,et al.  Code Generation for a One-Register Machine , 1976, J. ACM.

[19]  Alan Mycroft,et al.  Combined Code Motion and Register Allocation Using the Value State Dependence Graph , 2003, CC.

[20]  Andreas Krall,et al.  Optimal and Heuristic Global Code Motion for Minimal Spilling , 2013, CC.

[21]  Krzysztof Kuchcinski,et al.  Combined scheduling and instruction selection for processors with reconfigurable cell fabric , 2010, ASAP 2010 - 21st IEEE International Conference on Application-specific Systems, Architectures and Processors.

[22]  M. Anton Ertl Optimal code selection in DAGs , 1999, POPL '99.

[23]  Gabriel Hjort Blindell Survey on Instruction Selection: An Extensive and Modern Literature Review , 2013, ArXiv.

[24]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[25]  Christoph W. Kessler,et al.  Optimal Integrated VLIW Code Generation with Integer Linear Programming , 2006, Euro-Par.

[26]  Catherine H. Gebotys,et al.  An efficient model for DSP code generation: performance, code size, estimated energy , 1997, Proceedings. Tenth International Symposium on System Synthesis (Cat. No.97TB100114).

[27]  David Ryan Koes,et al.  Near-optimal instruction selection on dags , 2008, CGO '08.

[28]  David S. Johnson,et al.  Computers and Intractability: A Guide to the Theory of NP-Completeness , 1978 .

[29]  Rainer Leupers,et al.  Constraint driven code selection for fixed-point DSPs , 1999, DAC '99.

[30]  Roberto Castañeda Lozano,et al.  Constraint-Based Register Allocation and Instruction Scheduling , 2012, CP.

[31]  Peter J. Stuckey,et al.  MiniZinc: Towards a Standard CP Modelling Language , 2007, CP.

[32]  Bernhard Scholz,et al.  Code Instruction Selection Based on SSA-Graphs , 2003, SCOPES.

[33]  Hiroaki Tanaka,et al.  A Code Selection Method for SIMD Processors with PACK Instructions , 2003, SCOPES.

[34]  Susan L. Graham,et al.  A new method for compiler code generation , 1978, POPL '78.