Reconstructing Control Flow from Predicated Assembly Code

  • Björn Decker
  • Daniel Kästner
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2826)


Predicated instructions are a feature more and more common in contemporary instruction set architectures. Machine instructions are only executed if an individual guard register associated with the instruction evaluates to true. This enhances execution efficiency, but comes at a price: the control flow of a program is not explicit any more. Instead instructions from the same basic block may belong to different execution paths if they are subject to disjoint guard predicates. Postpass tools processing machine code with the purpose of program analyses or optimizations require the control flow graph of the input program to be known. The effectiveness of postpass analyses and optimizations strongly depends on the precision of the control flow reconstruction. If traditional reconstruction techniques are applied for processors with predicated instructions, their precision is seriously deteriorated. In this paper a generic algorithm is presented that can precisely reconstruct control flow from predicated assembly code. The algorithm is incorporated in the Propan system that enables high-quality machine-dependent postpass optimizers to be generated from a concise hardware specification. The control flow reconstruction algorithm is machine-independent, and automatically derives the required hardware-specific knowledge from the machine specification. Experimental results obtained for the Philips TriMedia TM1000 processor show that the precision of the reconstructed control flow is significantly higher than with reconstruction algorithms that do not specifically take predicated instructions into account.


Basic Block Instruction Variation Input Program Target Architecture Explicit Control 
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.
    Rau, B., Fisher, J.: Instruction-Level Parallel Processing: History, Overview, and Perspective. The Journal of Supercomputing 7, 9–50 (1993)CrossRefGoogle Scholar
  2. 2.
    Park, J., Schlansker, M.: On Predicated Execution. Tech. Rep. HPL-91-58, Hewlett-Packard Laboratories, Palo Alto CA (May 1991)Google Scholar
  3. 3.
    Dehnert, J., Towle, R.: Compiling for the Cydra 5. The Journal of Supercomputing 1/2, 181–228 (1993)CrossRefGoogle Scholar
  4. 4.
    Hu, P.: Static Analysis for Guarded Code. In: Languages, Compilers, and Run- Time Systems for Scalable Computers, pp. 44–56 (2000)Google Scholar
  5. 5.
    Philips Electronics North America Corporation, TriMedia TM1000 Preliminary Data Book (1997)Google Scholar
  6. 6.
    Analog Devices, ADSP-2106x SHARC User’s Manual (1995)Google Scholar
  7. 7.
    Intel, IA-64 Architecture Software Developer’s Manual, Vol  1: IA-64 Application Architecture, Revision 1.1 (July 2000)Google Scholar
  8. 8.
    Zivojnovic, V., Velarde, J., Schläger, C., Meyr, H.: DSPSTONE: A DSPOriented Benchmarking Methodology. In: Proceedings of the International Conference on Signal Processing Applications and Technology (1994)Google Scholar
  9. 9.
    Leupers, R.: Retargetable Code Generation for Digital Signal Processors. Kluwer Academic Publishers, Dordrecht (1997)zbMATHGoogle Scholar
  10. 10.
    Kästner, D., Langenbach, M.: Code Optimization by Integer Linear Programming. In: Jähnichen, S. (ed.) CC 1999. LNCS, vol. 1575, pp. 122–137. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  11. 11.
    Kästner, D.: PROPAN: A Retargetable System for Postpass Optimisations and Analyses. In: Proceedings of the ACM SIGPLAN Workshop on Languages, Compilers and Tools for Embedded Systems (June 2000)Google Scholar
  12. 12.
    Kästner, D.: Retargetable Code Optimisation by Integer Linear Programming. PhDthesis, Saarland University (2000)Google Scholar
  13. 13.
    Kästner, D., Wilhelm, S.: Generic Control Flow Reconstruction from Assembly Code. In: Proceedings of the ACM SIGPLAN Joined Conference on Languages, Compilers, and Tools for Embedded Systems (LCTES 2002) and Software and Compilers for Embedded Systems (SCOPES 2002) (June 2002)Google Scholar
  14. 14.
    Larus, J., Schnarr, E.: EEL: Machine-Independent Executable Editing. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 291–300 (1995)Google Scholar
  15. 15.
    Theiling, H.: Extracting Safe and Precise Control Flow from Binaries. In: 7th International Conference on Real-Time Computing Systems and Applications (July 2000)Google Scholar
  16. 16.
    Cifuentes, C., Simon, D., Fraboulet, A.: Assembly to High-Level Language Translation, August 1998, pp. 228–237 (1998)Google Scholar
  17. 17.
    Cifuentes, C.: Interprocedural Data Flow Decompilation. Tech. Rep. 4(2) (June 1996)Google Scholar
  18. 18.
    Warter, N.J., Mahlke, S.A., Hwu, W.-M.W., Rau, B.R.: Reverse If-Conversion. ACM SIGPLAN Notices 28(6), 290–299 (1993)CrossRefGoogle Scholar
  19. 19.
    Kästner, D.: ILP-based Approximations for Retargetable Code Optimization. In: Proceedings of the 5th International Conference on Optimization: Techniques and Applications, (ICOTA 2001) (2001)Google Scholar
  20. 20.
    Allen, J., Kennedy, K., Porterfield, C., Warren, J.: Conversion of control dependenceto data dependence. In: Conference record of the 10th ACM Symposium on Principles of Programming Languages (POPL), pp. 177–189 (1983)Google Scholar
  21. 21.
    Hoogerbrugge, J., Augusteijn, L.: Instruction Scheduling for TriMedia (1999)Google Scholar
  22. 22.
    Martin, F.: Generation of Program Analyzers. PhD thesis, Saarland University (1999)Google Scholar
  23. 23.
    Kästner, D.: TDL: A Hardware and Assembly Description Language. Tech. Rep. TDL1.4, Transferbereich 14, Saarland University (2000)Google Scholar
  24. 24.
    Decker, B.: Generic Reconstruction of Control Flow for Guarded Code from Assembly. Master’s thesis, Saarland University (2002)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Björn Decker
    • 1
  • Daniel Kästner
    • 2
  1. 1.Saarland University 
  2. 2.AbsInt GmbH 

Personalised recommendations