Abstract
This paper introduces a constraint model and solving techniques for code generation in a compiler back-end. It contributes a new model for global register allocation that combines several advanced aspects: multiple register banks (subsuming spilling to memory), coalescing, and packing. The model is extended to include instruction scheduling and bundling. The paper introduces a decomposition scheme exploiting the underlying program structure and exhibiting robust behavior for functions with thousands of instructions. Evaluation shows that code quality is on par with LLVM, a state-of-the-art compiler infrastructure.
The paper makes important contributions to the applicability of constraint programming as well as compiler construction: essential concepts are unified in a high-level model that can be solved by readily available modern solvers. This is a significant step towards basing code generation entirely on a high-level model and by this facilitates the construction of correct, simple, flexible, robust, and high-quality code generators.
Access provided by Autonomous University of Puebla. Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
Keywords
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.
References
Lattner, C., Adve, V.: LLVM: A compilation framework for lifelong program analysis & transformation. In: CGO (March 2004)
Goodwin, D.W., Wilken, K.D.: Optimal and near-optimal global register allocations using 0-1 integer programming. Software – Practice and Experience 26, 929–965 (1996)
Appel, A.W., George, L.: Optimal spilling for CISC machines with few registers. SIGPLAN Not. 36, 243–253 (2001)
Scholz, B., Eckstein, E.: Register allocation for irregular architectures. SIGPLAN Not. 37, 139–148 (2002)
Anton Ertl, M., Krall, A.: Optimal Instruction Scheduling Using Constraint Logic Programming. In: Małuszyński, J., Wirsing, M. (eds.) PLILP 1991. LNCS, vol. 528, pp. 75–86. Springer, Heidelberg (1991)
Malik, A.M., McInnes, J., van Beek, P.: Optimal basic block instruction scheduling for multiple-issue processors using constraint programming. International Journal on Artificial Intelligence Tools 17(1), 37–54 (2008)
Leupers, R., Marwedel, P.: Time-constrained code compaction for DSP’s. IEEE Transactions on Very Large Scale Integration Systems 5, 112–122 (1997)
Wilken, K., Liu, J., Heffernan, M.: Optimal instruction scheduling using integer programming. SIGPLAN Not. 35, 121–133 (2000)
Malik, A.M., Chase, M., Russell, T., van Beek, P.: An Application of Constraint Programming to Superblock Instruction Scheduling. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 97–111. Springer, Heidelberg (2008)
Winkel, S.: Exploring the performance potential of Itanium processors with ILP-based scheduling. In: CGO, pp. 189–200. IEEE (2004)
Chou, H.C., Chung, C.P.: An optimal instruction scheduler for superscalar processor. IEEE Transactions on Parallel and Distributed Systems 6, 303–313 (1995)
Shobaki, G., Wilken, K.: Optimal superblock scheduling using enumeration. In: MICRO, pp. 283–293. IEEE (2004)
Gebotys, C.H., Elmasry, M.I.: Simultaneous scheduling and allocation for cost constrained optimal architectural synthesis. In: DAC, pp. 2–7. ACM (1991)
Kästner, D.: PROPAN: A Retargetable System for Postpass Optimisations and Analyses. In: Davidson, J., Min, S.L. (eds.) LCTES 2000. LNCS, vol. 1985, pp. 63–80. Springer, Heidelberg (2001)
Kuchcinski, K.: Constraints-driven scheduling and resource assignment. ACM Trans. Des. Autom. Electron. Syst. 8, 355–383 (2003)
Nagarakatte, S.G., Govindarajan, R.: Register Allocation and Optimal Spill Code Scheduling in Software Pipelined Loops Using 0-1 Integer Linear Programming Formulation. In: Adsul, B., Vetta, A. (eds.) CC 2007. LNCS, vol. 4420, pp. 126–140. Springer, Heidelberg (2007)
Bashford, S., Leupers, R.: Phase-coupled mapping of data flow graphs to irregular data paths. Design Automation for Embedded Systems, 119–165 (1999)
Wilson, T., Grewal, G., Halley, B., Banerji, D.: An integrated approach to retargetable code generation. In: ISSS, pp. 70–75. IEEE (1994)
Eriksson, M.V., Skoog, O., Kessler, C.W.: Optimal vs. heuristic integrated code generation for clustered VLIW architectures. In: SCOPES, pp. 11–20 (2008)
Sweetman, D.: See MIPS Run, 2nd edn. Morgan Kaufmann (2006)
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)
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)
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)
Smith, M.D., Ramsey, N., Holloway, G.: A generalized algorithm for graph-coloring register allocation. SIGPLAN Not. 39, 277–288 (2004)
Appel, A.W.: SSA is functional programming. SIGPLAN Not. 33(4), 17–20 (1998)
Aycock, J., Horspool, N.: Simple Generation of Static Single-Assignment Form. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, pp. 110–124. Springer, Heidelberg (2000)
Beldiceanu, N., Carlsson, M.: Sweep as a Generic Pruning Technique Applied to the Non-overlapping Rectangles Constraint. In: Walsh, T. (ed.) CP 2001. LNCS, vol. 2239, pp. 377–391. Springer, Heidelberg (2001)
Pereira, F., Palsberg, J.: Register allocation by puzzle solving. SIGPLAN Not. 43, 216–226 (2008)
Aggoun, A., Beldiceanu, N.: Extending CHIP in order to solve complex scheduling and placement problems. Mathematical and Computer Modelling 17(7), 57–73 (1993)
Kessler, C.W.: Compiling for VLIW DSPs. In: Handbook of Signal Processing Systems, pp. 603–638. Springer (2010)
Chaitin, G.J., Auslander, M.A., Chandra, A.K., Cocke, J., Hopkins, M.E., Markstein, P.W.: Register allocation via coloring. Computer Languages 6(1), 47–57 (1981)
Boissinot, B., Hack, S., Grund, D., Dupont de Dinechin, B., Rastello, F.: Fast liveness checking for SSA-form programs. In: CGO, pp. 35–44. ACM (2008)
Gecode Team: Gecode: generic constraint development environment (2006), http://www.gecode.org
Chow, F., Hennessy, J.: Register allocation by priority-based coloring. SIGPLAN Not. 19(6), 222–232 (1984)
Rau, B.R., Fisher, J.A.: Instruction-level parallel processing: history, overview, and perspective. J. Supercomput. 7, 9–50 (1993)
Hooker, J.N., Ottosson, G.: Logic-based Benders decomposition. Mathematical Programming 96(1), 33–60 (2003)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lozano, R.C., Carlsson, M., Drejhammar, F., Schulte, C. (2012). Constraint-Based Register Allocation and Instruction Scheduling. In: Milano, M. (eds) Principles and Practice of Constraint Programming. CP 2012. Lecture Notes in Computer Science, vol 7514. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-33558-7_54
Download citation
DOI: https://doi.org/10.1007/978-3-642-33558-7_54
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-33557-0
Online ISBN: 978-3-642-33558-7
eBook Packages: Computer ScienceComputer Science (R0)