slides/slides10.tex
changeset 818 6928a677d26f
parent 744 99c5916d9a8f
child 864 b5b1bc0a603b
equal deleted inserted replaced
817:89f9c68fc417 818:6928a677d26f
    72       };
    72       };
    73     \end{tikzpicture}
    73     \end{tikzpicture}
    74   \end{center}
    74   \end{center}
    75 \end{frame}
    75 \end{frame}
    76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
    77 
       
    78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
    79 \begin{frame}[c,fragile]
       
    80 \frametitle{Static Single-Assignment}  
       
    81 
       
    82 \bl{$(1 + a) + (3 + (b * 5))$}\bigskip\bigskip  
       
    83 
       
    84 \begin{lstlisting}[language=LLVMIR,numbers=left]
       
    85 let tmp0 = add 1 a in   
       
    86 let tmp1 = mul b 5 in 
       
    87 let tmp2 = add 3 tmp1 in 
       
    88 let tmp3 = add tmp0 tmp2
       
    89   in tmp3 
       
    90 \end{lstlisting}  
       
    91 
       
    92 
       
    93 \end{frame}
       
    94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    95 
       
    96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
    97 \begin{frame}[c,fragile]
       
    98 \small
       
    99 
       
   100 \mbox{}\bigskip\bigskip\bigskip
       
   101 
       
   102 \begin{lstlisting}[language={},numbers=left]
       
   103 define i32 @fact (i32 %n) {
       
   104    %tmp_20 = icmp eq i32  %n, 0
       
   105    br i1 %tmp_20, label %if_branch_24, label %else_branch_25
       
   106  if_branch_24:
       
   107    ret i32 1
       
   108  else_branch_25:
       
   109    %tmp_22 = sub i32  %n, 1
       
   110    %tmp_23 = call i32 @fact (i32 %tmp_22)
       
   111    %tmp_21 = mul i32  %n, %tmp_23
       
   112    ret i32 %tmp_21
       
   113 }  
       
   114 \end{lstlisting}  
       
   115 
       
   116 \begin{lstlisting}[language={},numbers=none]
       
   117 def fact(n) = if n == 0 then 1 else n * fact(n - 1)
       
   118 \end{lstlisting}  
       
   119 \end{frame}
       
   120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   121 
       
   122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
   123 \begin{frame}[c,fragile]
       
   124 
       
   125 
       
   126 \begin{lstlisting}[language=LLVM,numbers=none]
       
   127 br i1 %var, label %if_br, label %else_br
       
   128   
       
   129 icmp eq i32  %x, %y     ; for equal
       
   130 icmp sle i32 %x, %y     ;   signed less or equal
       
   131 icmp slt i32 %x, %y     ;   signed less than
       
   132 icmp ult i32 %x, %y     ;   unsigned less than 
       
   133 
       
   134 %var = call i32 @foo(...args...)
       
   135 \end{lstlisting}  
       
   136 
       
   137 \end{frame}
       
   138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    77 
   139 
    78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
   140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    79 \begin{frame}[c,fragile]
   141 \begin{frame}[c,fragile]
    80 
   142 
    81 
   143