\documentclass[a4paper]{llncs} \usepackage{algpseudocode} \usepackage{alltt} \usepackage{amsfonts} \usepackage[british]{babel} \usepackage{hyperref} \usepackage[utf8]{inputenc} \usepackage{listings} \renewcommand{\verb}{\lstinline} \def\lstlanguagefiles{lst-grafite.tex} \lstset{language=Grafite} \begin{document} \mainmatter \title{On the correctness of a branch displacement algorithm\thanks{Research supported by the CerCo project, within the Future and Emerging Technologies (FET) programme of the Seventh Framework Programme for Research of the European Commission, under FET-Open grant number 243881}} \author{Jaap Boender \and Claudio Sacerdoti Coen} \institute{Dipartimento di Scienze dell'Informazione,\\ Universit\`a degli Studi di Bologna} \maketitle \begin{abstract} The branch displacement problem is a well-known problem in assembler design. It revolves around the feature, present in several processor families, of having different instructions, of different sizes, for jumps of different displacements. The problem, which is provably NP-hard, is then to select the instructions such that one ends up with the smallest possible program. During our research with the CerCo project on formally verifying a C compiler, we have implemented and proven correct an algorithm for this problem. In this paper, we discuss the problem, possible solutions, our specific solutions and the proofs. \keywords{formal verification, assembler, branch displacement optimisation} \end{abstract} \input{problem} \input{algorithm} \input{proof} \input{conclusion} \clearpage \bibliography{biblio} \bibliographystyle{splncs03} \end{document}