Changeset 673


Ignore:
Timestamp:
Mar 10, 2011, 4:10:12 PM (9 years ago)
Author:
regisgia
Message:
  • Cosmetics.
Location:
Deliverables/D1.1/Presentations
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D1.1/Presentations/WP2-yann.tex

    r672 r673  
    148148
    149149\begin{itemize}
    150 \item How to represent  32bits values in an 8bits architecture?
     150\item How to represent  32 bits values in an 8 bits architecture?
    151151\item How to deal with heterogeneous representation of pointers and integers?
    152 (Words are 8bits long whereas memory addresses are stored using 16bits.)
    153 \item How to select instruction for this microprocessor?
     152(Words are 8 bits long whereas memory addresses are stored using 16 bits.)
     153\item How to select instructions for this microprocessor?
    154154\item What calling convention to use?
    155155\end{itemize}
     
    229229\bgroup\sf\medskip\begin{flushleft}
    230230
    231 \noindent\hspace*{0.00em}\textbf{unsigned} \textbf{char} search(\textbf{unsigned} \textbf{char} *tab, \textbf{unsigned} \textbf{char} size, \textbf{unsigned} \textbf{char} to\_{}find)~\linebreak
     231\noindent\hspace*{0.00em}\textbf{unsigned} \textbf{char} search(\textbf{unsigned} \textbf{char} *tab, \textbf{unsigned} \textbf{char} size, \linebreak
     232\noindent\hspace*{2.5cm}\textbf{unsigned} \textbf{char} to\_{}find)~\linebreak
    232233\noindent\hspace*{0.00em}\{~\linebreak
    233234\noindent\hspace*{1.00em}\textbf{unsigned} \textbf{char} low, high, i;~\linebreak
     
    287288\bgroup\sf\medskip\begin{flushleft}
    288289
    289 \noindent\hspace*{1.00em}\emph{// ...}~\linebreak
    290 \noindent\hspace*{1.00em}317\ensuremath{:~}  nop                ;; 1  \_{}cost4~\linebreak
    291 \noindent\hspace*{1.00em}318\ensuremath{:~}  mov   002h, \#{}000h  ;; 3  ~\linebreak
    292 \noindent\hspace*{1.00em}321\ensuremath{:~}  mov   A, 002h      ;; 1  ~\linebreak
    293 \noindent\hspace*{1.00em}323\ensuremath{:~}  mov   005h, A      ;; 1  ~\linebreak
    294 \noindent\hspace*{1.00em}325\ensuremath{:~}  mov   A, 009h      ;; 1  ~\linebreak
    295 \noindent\hspace*{1.00em}327\ensuremath{:~}  mov   004h, A      ;; 1  ~\linebreak
    296 \noindent\hspace*{1.00em}329\ensuremath{:~}  mov   A, 000h      ;; 1  ~\linebreak
    297 \noindent\hspace*{1.00em}331\ensuremath{:~}  push  0E0h         ;; 2  ~\linebreak
    298 \noindent\hspace*{1.00em}333\ensuremath{:~}  mov   A, 001h      ;; 1  ~\linebreak
    299 \noindent\hspace*{1.00em}335\ensuremath{:~}  push  0E0h         ;; 2  ~\linebreak
    300 \noindent\hspace*{1.00em}337\ensuremath{:~}  mov   0E0h, \#{}004h  ;; 3  ~\linebreak
    301 \noindent\hspace*{1.00em}340\ensuremath{:~}  add   A, 006h      ;; 1  ~\linebreak
    302 \noindent\hspace*{1.00em}342\ensuremath{:~}  mov   006h, A      ;; 1  ~\linebreak
    303 \noindent\hspace*{1.00em}344\ensuremath{:~}  mov   0E0h, \#{}000h  ;; 3  ~\linebreak
    304 \noindent\hspace*{1.00em}347\ensuremath{:~}  addc  A, 007h      ;; 1  ~\linebreak
    305 \noindent\hspace*{1.00em}349\ensuremath{:~}  mov   007h, A      ;; 1  ~\linebreak
    306 \noindent\hspace*{1.00em}351\ensuremath{:~}  mov   A, 005h      ;; 1  ~\linebreak
    307 \noindent\hspace*{1.00em}353\ensuremath{:~}  mov   083h, A      ;; 1  ~\linebreak
    308 \noindent\hspace*{1.00em}355\ensuremath{:~}  mov   A, 004h      ;; 1  ~\linebreak
    309 \noindent\hspace*{1.00em}357\ensuremath{:~}  mov   082h, A      ;; 1  ~\linebreak
    310 \noindent\hspace*{1.00em}359\ensuremath{:~}  ret                ;; 2 
     290\begin{tabular}{ll}
     291\noindent\hspace*{1.00em}\emph{// ...}~\\
     292\noindent\hspace*{1.00em}\textcolor{gray}{317\ensuremath{:~}}  nop               
     293&\textbf{;; 1  \textcolor{red}{\_{}cost4}}~\\
     294\noindent\hspace*{1.00em}\textcolor{gray}{318\ensuremath{:~}}  mov   002h, \#{}000h &\textbf{;; 3  }~\\
     295\noindent\hspace*{1.00em}\textcolor{gray}{321\ensuremath{:~}}  mov   A, 002h     &\textbf{;; 1  }~\\
     296\noindent\hspace*{1.00em}\textcolor{gray}{323\ensuremath{:~}}  mov   005h, A     &\textbf{;; 1  }~\\
     297\noindent\hspace*{1.00em}\textcolor{gray}{325\ensuremath{:~}}  mov   A, 009h     &\textbf{;; 1  }~\\
     298\noindent\hspace*{1.00em}\textcolor{gray}{327\ensuremath{:~}}  mov   004h, A     &\textbf{;; 1  }~\\
     299\noindent\hspace*{1.00em}\textcolor{gray}{329\ensuremath{:~}}  mov   A, 000h     &\textbf{;; 1  }~\\
     300\noindent\hspace*{1.00em}\textcolor{gray}{331\ensuremath{:~}}  push  0E0h        &\textbf{;; 2  }~\\
     301\noindent\hspace*{1.00em}\textcolor{gray}{333\ensuremath{:~}}  mov   A, 001h     &\textbf{;; 1  }~\\
     302\noindent\hspace*{1.00em}\textcolor{gray}{335\ensuremath{:~}}  push  0E0h        &\textbf{;; 2  }~\\
     303\noindent\hspace*{1.00em}\textcolor{gray}{337\ensuremath{:~}}  mov   0E0h, \#{}004h &\textbf{;; 3  }~\\
     304\noindent\hspace*{1.00em}\textcolor{gray}{340\ensuremath{:~}}  add   A, 006h     &\textbf{;; 1  }~\\
     305\noindent\hspace*{1.00em}\textcolor{gray}{342\ensuremath{:~}}  mov   006h, A     &\textbf{;; 1  }~\\
     306\noindent\hspace*{1.00em}\textcolor{gray}{344\ensuremath{:~}}  mov   0E0h, \#{}000h &\textbf{;; 3  }~\\
     307\noindent\hspace*{1.00em}\textcolor{gray}{347\ensuremath{:~}}  addc  A, 007h     &\textbf{;; 1  }~\\
     308\noindent\hspace*{1.00em}\textcolor{gray}{349\ensuremath{:~}}  mov   007h, A     &\textbf{;; 1  }~\\
     309\noindent\hspace*{1.00em}\textcolor{gray}{351\ensuremath{:~}}  mov   A, 005h     &\textbf{;; 1  }~\\
     310\noindent\hspace*{1.00em}\textcolor{gray}{353\ensuremath{:~}}  mov   083h, A     &\textbf{;; 1  }~\\
     311\noindent\hspace*{1.00em}\textcolor{gray}{355\ensuremath{:~}}  mov   A, 004h     &\textbf{;; 1  }~\\
     312\noindent\hspace*{1.00em}\textcolor{gray}{357\ensuremath{:~}}  mov   082h, A     &\textbf{;; 1  }~\\
     313\noindent\hspace*{1.00em}\textcolor{gray}{359\ensuremath{:~}}  ret               &\textbf{;; 2  }
     314\end{tabular}
     315\end{flushleft}\medskip\egroup\noindent
     316\end{code}
     317\end{frame}
     318
     319\begin{frame}
     320\frametitle{A glimpse on the compiler passes : Annotating in {\sc Clight}}
     321
     322\begin{code}[7.5cm]\scriptsize
     323\bgroup\sf\medskip\begin{flushleft}
     324
     325\noindent\hspace*{0.00em}\textbf{unsigned} \textbf{char} search(\textbf{unsigned} \textbf{char} *tab, \textbf{unsigned} \textbf{char} size, \linebreak
     326\noindent\hspace*{2.5cm}\textbf{unsigned} \textbf{char} to\_{}find)~\linebreak
     327\noindent\hspace*{0.00em}\{~\linebreak
     328\noindent\hspace*{1.00em}\textbf{unsigned} \textbf{char} low, high, i;~\linebreak
     329\noindent\hspace*{1.00em}\textcolor{red}{\_cost8:~\textbf{cost += 117;}} \linebreak
     330\noindent\hspace*{1.00em}low = (\textbf{unsigned} \textbf{char})0;~\linebreak
     331\noindent\hspace*{1.00em}high = (\textbf{unsigned} \textbf{char})((\textbf{int})size - 1);~\linebreak
     332\noindent\hspace*{1.00em}\textbf{while} ((\textbf{int})high \ensuremath{\ge} (\textbf{int})low) \{~\linebreak
     333\noindent\hspace*{2.00em}\textcolor{red}{\_cost6:~\textbf{cost += 77;}}~\linebreak
     334\noindent\hspace*{2.00em}i = (\textbf{unsigned} \textbf{char})(((\textbf{int})high + (\textbf{int})low) / 2);~\linebreak
     335\noindent\hspace*{2.00em}\textbf{if} ((\textbf{int})tab[i] {\scriptsize\ensuremath{==}} (\textbf{int})to\_{}find) \{  ~\linebreak
     336\noindent\hspace*{4.00em}\textcolor{red}{\_cost4\ensuremath{:~\textbf{cost += 30;}}} \textbf{return} i; ~\linebreak
     337\noindent\hspace*{2.00em}\} \textbf{else} \{\textcolor{red}{\_cost5:~\textbf{cost += 103;}}  \}~\linebreak
     338\noindent\hspace*{2.00em}\textbf{if} ((\textbf{int})tab[i] {\scriptsize\ensuremath{>}} (\textbf{int})to\_{}find) \{ ~\linebreak
     339\noindent\hspace*{3.00em}\textcolor{red}{\_cost2\ensuremath{:~\textbf{cost += 98;}}} high = (\textbf{unsigned} \textbf{char})((\textbf{int})i - 1); ~\linebreak
     340\noindent\hspace*{2.00em}\} \textbf{else} \{ \textcolor{red}{\_cost3\ensuremath{:~\textbf{cost += 85;}}}  \}~\linebreak
     341\noindent\hspace*{2.00em}\textbf{if} ((\textbf{int})tab[i] {\scriptsize\ensuremath{<}} (\textbf{int})to\_{}find) \{ ~\linebreak
     342\noindent\hspace*{3.00em}\textcolor{red}{\_cost0\ensuremath{:~\textbf{cost += 98;}}} low = (\textbf{unsigned} \textbf{char})((\textbf{int})i + 1); ~\linebreak
     343\noindent\hspace*{2.00em}\} \textbf{else} \{ \textcolor{red}{\_cost1\ensuremath{:~\textbf{cost += 88;}}} \}~\linebreak
     344\noindent\hspace*{1.00em}\}~\linebreak
     345\noindent\hspace*{1.00em}\textcolor{red}{\_cost7\ensuremath{:~\textbf{cost += 43;}}}~\linebreak
     346\noindent\hspace*{1.00em}\textbf{return} (\textbf{unsigned} \textbf{char})(-1);~\linebreak
     347\noindent\hspace*{0.00em}\}
    311348\end{flushleft}\medskip\egroup\noindent
    312349\end{code}
Note: See TracChangeset for help on using the changeset viewer.