hws/hw09.tex
changeset 901 33cff35bdc1a
parent 805 526e10d97435
child 906 2bf1516d730f
equal deleted inserted replaced
900:3be23d0df3db 901:33cff35bdc1a
    42 istore 1
    42 istore 1
    43 ifeq label
    43 ifeq label
    44 if_icmpge label
    44 if_icmpge label
    45 \end{lstlisting}
    45 \end{lstlisting}
    46 
    46 
       
    47 \item What does the following JVM function calculate?
       
    48 
       
    49 \begin{lstlisting}[language=JVMIS2,numbers=none]    
       
    50 .method public static bar(I)I
       
    51 .limit locals 1
       
    52 .limit stack 9
       
    53    iload 0
       
    54    ldc 0
       
    55    if_icmpne If_else_8
       
    56    ldc 0
       
    57    goto If_end_9
       
    58 If_else_8:
       
    59    iload 0
       
    60    ldc 1
       
    61    if_icmpne If_else_10
       
    62    ldc 1
       
    63    goto If_end_11
       
    64 If_else_10:
       
    65    iload 0
       
    66    ldc 1
       
    67    isub
       
    68    invokestatic bar(I)I
       
    69    iload 0
       
    70    ldc 2
       
    71    isub
       
    72    invokestatic bar(I)I
       
    73    iadd
       
    74 If_end_11:
       
    75 If_end_9:
       
    76    ireturn
       
    77 .end method  
       
    78 \end{lstlisting}
    47 
    79 
    48 \item What does the following LLVM function calculate? Give the
    80 \item What does the following LLVM function calculate? Give the
    49   corresponding arithmetic expression .
    81   corresponding arithmetic expression .
    50 
    82 
    51 \begin{lstlisting}[language=LLVM,numbers=none]  
    83 \begin{lstlisting}[language=LLVM,numbers=none]