C Compilers and Code Optimization for DSPs

  • Björn FrankeEmail author


Compilers take a central role in the software development tool chain for any processor and enable high-level programming. Hence, they increase programmer productivity and code portability while reducing time-to-market. The responsibilities of a C compiler go far beyond the translation of the source code into an executable binary and comprise additional code optimization for high performance and low memory footprint. However, traditional optimizations are typically oriented towards RISC architectures that differ significantly from most digital signal processors. In this chapter we provide an overview of the challenges faced by compilers for DSPs and outline some of the code optimization techniques specifically developed to address the architectural idiosyncrasies of the most prevalent digital signal processors on the market.


Digital Signal Processor Code Optimization Memory Bank Code Size Code Fragment 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Jaume Abella and Antonio Gonzalez and Josep Llosa and Xavier Vera: Near-Optimal Loop Tiling by Means of Cache Miss Equations and Genetic Algorithms. In: Proceedings of the 2002 International Conference on Parallel Processing Workshops (ICPPW ’02), Washington, DC, USA, 2002.Google Scholar
  2. 2.
    Allan, Vicki H. and Jones, Reese B. and Lee, Randall M. and Allan, Stephen J.: Software pipelining. ACM Computing Surveys, Vol. 27, No. 3, pp. 367–432, 1995.CrossRefGoogle Scholar
  3. 3.
    ACE Associated Compiler Experts bv: DSP-C - An extension to ISO/IEC IE 9899:1990. Netherlands, 1998.Google Scholar
  4. 4.
    David F. Bacon, Susan L. Graham, and Oliver J. Sharp: Compiler Transformations for High-Performance Computing. ACM Computing Surveys, Vol. 26, No. 4, December 1994.Google Scholar
  5. 5.
    Árpád Beszédes, Rudolf Ferenc, Tibor Gyimóthy, André Dolenc, and Karsisto, Konsta: Survey of code-size reduction methods. ACM Computing Surveys, Vol. 35, No. 3, pp. 223–267, 2003.CrossRefGoogle Scholar
  6. 6.
    Keith D. Cooper and Nathaniel McIntosh: Enhanced Code Compression for Embedded RISC Processors. In: Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation, pp. 139–149, 1999.Google Scholar
  7. 7.
    Keith D. Cooper, L. Taylor Simpson, and Christopher A. Vick: Operator Strength Reduction. ACM Transactions on Programming Languages and Systems, Vol. 23, Issue 5, pp. 603–625, Sept. 2001.CrossRefGoogle Scholar
  8. 8.
    Keith D. Cooper, Philip J. Schielke, and Devika Subramanian; Optimizing for Reduced Code Space using Genetic Algorithms. In: Proceedings of the ACM SIGPLAN 1999 workshop on Languages, Compilers, and Tools for Embedded Systems, pp. 1–9, Atlanta, Georgia, United States, 1999.Google Scholar
  9. 9.
    Sauma K. Debray, William Evans, Robert Muth, and Bjorn De Sutter: Compiler Techniques for Code Compaction. ACM Transactions on Programming Languages and Systems, Vol. 22, No. 2, March 2000, pp. 378–415.CrossRefGoogle Scholar
  10. 10.
    Depuydt, Francis and Goossens, Gert and DeMan, Hugo: Scheduling with register constraints for DSP architectures. Integration, the VLSI Journal, pp. 95–120, Vol. 18, No. 1, 1994.zbMATHCrossRefGoogle Scholar
  11. 11.
    Dubach, Christophe and Cavazos, John and Franke, Björn and Fursin, Grigori and O’Boyle, Michael F.P. and Temam, Olivier: Fast compiler optimisation evaluation using code-feature based performance prediction. In: Proceedings of the 4th International Conference on Computing Frontiers (CF ’07), Ischia, Italy, 2007.Google Scholar
  12. 12.
    ISO/IEC JTC1 SC22 WG14 N1169: Programming languages - C - Extensions to support embedded processors. Technical Report ISO/IEC TR 18037, 2006.Google Scholar
  13. 13.
    Fang, Jesse Zhixi: Compiler Algorithms on If-Conversion, Speculative Predicates Assignment and Predicated Code Optimizations. In: Proceedings of the 9th International Workshop on Languages and Compilers for Parallel Computing (LCPC ’96), pp. 135–153, London, UK, 1997.Google Scholar
  14. 14.
    Franz Franchetti and Markus Püschel: Short Vector Code Generation and Adaptation for DSP Algorithms. In: Proceedings of the International Conference on Acoustics, Speech, and Signal Processing (ICASSP), pp. 537–540, 2003.Google Scholar
  15. 15.
    Franke, Björn and O’Boyle, Michael: Array recovery and high-level transformations for DSP applications. ACM Transactions on Embedded Computing Systems, Vol.2, No. 2, pp. 132–162, 2003.CrossRefGoogle Scholar
  16. 16.
    C.W. Fraser, E.W. Myers, and A.L. Wendt: Analyzing and compressing assembly code. SIGPLAN Notices, Vol. 19, No. 6, pp. 117–121, June 1984.CrossRefGoogle Scholar
  17. 17.
    G. Gréwal and T. Wilson and A. Morton: An EGA Approach to the Compile-Time Assignment of Data to Multiple Memories in Digital-Signal Processors, SIGARCH Computer Architecture News, Vol. 31, No. 1, pp. 49–59, 2003.CrossRefGoogle Scholar
  18. 18.
    Masayo Haneda, Peter M.W. Knijnenburg, and Harry A.G. Wijshoff: Code Size Reduction by Compiler Tuning. In: S. Vassiliadis et al. (Eds.): SAMOS 2006, LNCS 4017, pp. 186–195, Springer-Verlag, 2006.Google Scholar
  19. 19.
    Hohenauer, Manuel and Engel, Felix and Leupers, Rainer and Ascheid, Gerd and Meyr, Heinrich: A SIMD optimization framework for retargetable compilers. ACM Transactions on Architecture and Code Optimization, Vol. 6, No. 1, pp. 1–27, 2009.CrossRefGoogle Scholar
  20. 20.
    ISO/IEC JTC1/SC22/WG14 working group. ISO/IEC 9899:1999 - Programming languages - C, 1999.Google Scholar
  21. 21.
    M-Y. Ko and S. S. Bhattacharyya: Data Partioning for DSP Software Synthesis. In: Proceedings of the International Workshop on Software and Compilers for Embedded Systems (SCOPES ’03), pp. 344–358, Vienna, Austria, 2003Google Scholar
  22. 22.
    Arvind Krishnaswamy and Rajiv Gupta: Mixed-width instruction sets. Communications of the ACM, Vol. 46, No. 8, pp. 47–52, 2003.CrossRefGoogle Scholar
  23. 23.
  24. 24.
    Leupers, R.: Code Optimization Techniques for Embedded Processors: Methods, Algorithms, and Tools. Kluwer Academic Publishers, Norwell, MA, USA, 2000.zbMATHGoogle Scholar
  25. 25.
    Leupers, Rainer: Code selection for media processors with SIMD instructions. In: Proceedings of the Conference on Design, Automation and Test in Europe (DATE ’00), Paris, France, pp. 4–8, 2000.Google Scholar
  26. 26.
    R. Leupers and D. Kotte: Variable Partioning for Dual Memory Bank DSPs. In: Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP ’01), pp. 1121–1124, Salt Lake City, USA, 2001.Google Scholar
  27. 27.
    Leupers, Rainer and Bashford, Steven: Graph-based code selection techniques for embedded processors. ACM Transactions on Design Automation of Electronic Systems, pp. 794–814, Vol. 5, No. 4, 2000.CrossRefGoogle Scholar
  28. 28.
    Leupers, Rainer: Register allocation for common subexpressions in DSP data paths, In: Proceedings of the 2000 Asia and South Pacific Design Automation Conference (ASP-DAC ’00), pp. 235–240, Yokohama, Japan, 2000.Google Scholar
  29. 29.
    Liao, Stan and Devadas, Srinivas and Keutzer, Kurt and Tjiang, Steve andWang, Albert: Code optimization techniques for embedded DSP microprocessors. In: Proceedings of the 32nd Annual ACM/IEEE Design Automation Conference (DAC ’95), pp. 599–604, San Francisco, California, United States, 1995.Google Scholar
  30. 30.
    Menard, Daniel and Chillet, Daniel and Charot, François and Sentieys, Olivier: Automatic floating-point to fixed-point conversion for DSP code generation. In: Proceedings of the 2002 International Conference on Compilers, Architecture, and Synthesis for Embedded Systems (CASES ’02), pp. 270–276, Grenoble, France, 2002.Google Scholar
  31. 31.
    Monsifrot, Antoine and Bodin, François and Quiniou, Rene: A Machine Learning Approach to Automatic Production of Compiler Heuristics. In: Proceedings of the 10th International Conference on Artificial Intelligence: Methodology, Systems, and Applications (AIMSA ’02), pp. 41–50, London, UK, 2002.Google Scholar
  32. 32.
    Stephen S. Muchnick: Advanced compiler design and implementation. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1997.Google Scholar
  33. 33.
    Alastair Murray and Björn Franke: Using Genetic Programming for Source-Level Data Assignment to Dual Memory Banks. In: Proceedings of the 3rd Workshop on Statistical and Machine Learning Approaches to Architecture and Compilation (SMARTâĂŹ09), Paphos, Cyprus, 2009.Google Scholar
  34. 34.
    Alastair Murray and Björn Franke: Fast Source-Level Data Assignment to Dual Memory Banks. In: Proceedings of the Workshop on Software & Compilers for Embedded Systems (SCOPES 2008), March 2008, Munich, Germany.Google Scholar
  35. 35.
    Nuzman, Dorit and Rosen, Ira and Zaks, Ayal: Auto-vectorization of interleaved data for SIMD. ACM SIGPLAN Notices, Vol. 41, No. 6, pp. 132–143, 2006.CrossRefGoogle Scholar
  36. 36.
    Preeti Ranjan Panda, Hiroshi Nakamura, Nikil D. Dutt, Alexandru Nicolau: Augmenting Loop Tiling with Data Alignment for Improved Cache Performance. IEEE Transactions on Computers, Vol. 48, No. 2, pp. 142–149, February, 1999.Google Scholar
  37. 37.
    Pokam, Gilles and Bihan, Stéphane and Simonnet, Julien and Bodin, François: SWARP: A retargetable preprocessor for multimedia instructions. Concurrency and Computation: Practice & Experience, Volume 16, Issue 2–3, pp. 303–318, January 2004.CrossRefGoogle Scholar
  38. 38.
    Pouchet, Louis-Noël and Bastoul, Cédric and Cohen, Albert and Cavazos, John: Iterative Optimization in the Polyhedral Model: Part II, Multidimensional Time. In: Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’08), pp. 90–100, New York, NY, USA, 2008.Google Scholar
  39. 39.
    Pujare, S., Lee, C.G., and Chow, P.: Machine-independent compiler optimizations for the UofT DSP architecture. In: Proceedings of the 6th International Conference on Signal Processing Applications and Technology (ICSPAT), pp. 860–865, 1995.Google Scholar
  40. 40.
    M.A.R. Saghir, P.Chow and C.G. Lee: Exploiting Dual Data-Memory Banks in Digital Signal Processors. In: Proceedings of the 7th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-VII), pp. 234–243, Cambridge, Massachusetts, USA, 1996.Google Scholar
  41. 41.
    Sair, S., Kaeli, D., Meleis, W.: A study of loop unrolling for VLIW-based DSP processors. In: Proceedings of the IEEE Workshop on Signal Processing Systems, 1998.Google Scholar
  42. 42.
    V. Sipkovà: Efficient Variable Allocation to Dual Memory Banks of DSPs. In: Proceedings of the 7th InternationalWorkshop on Software and Compilers for Embedded Systems (SCOPES ’03), pp. 359–372, Vienna, Austria, 2003.Google Scholar
  43. 43.
    Mark Stephenson and Saman Amarasinghe: Predicting Unroll Factors Using Supervised Classification. In: Proceedings of the International Symposium on Code Generation and Optimization (CGO ’05), pp. 123–134, Washington, DC, USA, 2005.Google Scholar
  44. 44.
    Uh, Gang-Ryung; Wang, Yuhong; Whalley, David B.; Jinturkar, Sanjay; Burns, Chris and Cao, Vincent: Techniques for Effectively Exploiting a Zero Overhead Loop Buffer. In: Proceedings of the 9th International Conference on Compiler Construction (CC ’00), pp. 157–172, London, UK, 2000.Google Scholar
  45. 45.
    Vienna University of Technology, Institute of Communications and Radio-Frequency Engineering: Address Code Optimization., retrieved August 2009.
  46. 46.
    Michael Joseph Wolfe: Optimizing Supercompilers for Supercomputers. MIT Press, Cambridge, MA, USA, 1990.Google Scholar
  47. 47.
    Zivojnovic, V., Martinez, J., Schläger, C. & Meyr, H.: DSPstone: A DSP-Oriented Benchmarking Methodology. In: Proceedings of the International Conference on Signal Processing Applications and Technology (ICSPAT’94), Dallas, Oct. 1994.Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2010

Authors and Affiliations

  1. 1.School of Informatics, Informatics ForumUniversity of EdinburghEdinburghUK

Personalised recommendations