Binary file handouts/ho09.pdf has changed
Binary file slides/slides10.pdf has changed
--- a/slides/slides10.tex Fri Dec 04 14:48:40 2020 +0000
+++ b/slides/slides10.tex Mon Dec 14 19:22:12 2020 +0000
@@ -77,6 +77,68 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
+\frametitle{Static Single-Assignment}
+
+\bl{$(1 + a) + (3 + (b * 5))$}\bigskip\bigskip
+
+\begin{lstlisting}[language=LLVMIR,numbers=left]
+let tmp0 = add 1 a in
+let tmp1 = mul b 5 in
+let tmp2 = add 3 tmp1 in
+let tmp3 = add tmp0 tmp2
+ in tmp3
+\end{lstlisting}
+
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c,fragile]
+\small
+
+\mbox{}\bigskip\bigskip\bigskip
+
+\begin{lstlisting}[language={},numbers=left]
+define i32 @fact (i32 %n) {
+ %tmp_20 = icmp eq i32 %n, 0
+ br i1 %tmp_20, label %if_branch_24, label %else_branch_25
+ if_branch_24:
+ ret i32 1
+ else_branch_25:
+ %tmp_22 = sub i32 %n, 1
+ %tmp_23 = call i32 @fact (i32 %tmp_22)
+ %tmp_21 = mul i32 %n, %tmp_23
+ ret i32 %tmp_21
+}
+\end{lstlisting}
+
+\begin{lstlisting}[language={},numbers=none]
+def fact(n) = if n == 0 then 1 else n * fact(n - 1)
+\end{lstlisting}
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c,fragile]
+
+
+\begin{lstlisting}[language=LLVM,numbers=none]
+br i1 %var, label %if_br, label %else_br
+
+icmp eq i32 %x, %y ; for equal
+icmp sle i32 %x, %y ; signed less or equal
+icmp slt i32 %x, %y ; signed less than
+icmp ult i32 %x, %y ; unsigned less than
+
+%var = call i32 @foo(...args...)
+\end{lstlisting}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c,fragile]
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]