GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Which of the following are large, expensive, powerful comput…

Which of the following are large, expensive, powerful computers that can handle hundreds or thousands of connected users simultaneously and store tremendous amounts of data, instructions, and information?

Read Details

Many scanners include a certain kind of software, which can…

Many scanners include a certain kind of software, which can read and convert text documents into electronic files. What is that kind of software?

Read Details

Which of the following situations can NOT always be guarante…

Which of the following situations can NOT always be guaranteed to be reported at compile time?  (Select all that apply) (4 pts)

Read Details

Minimize the following DFA using Brzozowski’s algorithm.  S…

Minimize the following DFA using Brzozowski’s algorithm.  Show the resulting DFA after the first (backward) pass. Show the final resulting DFA after the second (forward) pass.  You may choose the names for states in each DFA. Write each DFA in the following format, illustrated with the original DFA:  States: 0, 1, 2, 3 Start state 0  Accepting states: 1, 3 Transitions: (0, a) = 1, (0, b) = 2, (1, a) = 1, (2, a) = 3, (3, a) = 3 (12 pts)

Read Details

Consider the optimization of inlining: replacing a function…

Consider the optimization of inlining: replacing a function call by expanding the called function’s body into the caller. Here is a simple example in Tiger IR to illustrate its behavior. Without inlining start_function square int square(int x) int-list: x float-list:square: ret = x * x; return ret;end_function square// somewhere else in the program: b = a * 2; r = call square(b); if a < r goto label1; With inlining, the code at the end becomes b = a * 2; r = b * b; // this line changed if a < r goto label1; Assuming no other optimizations occur, what is the performance benefit of inlining a function call? If other optimizations occur, can inlining provide further benefits? If so, describe how. Describe a way in which inlining may worsen performance. Based on parts (1) – (3), give a heuristic that an optimizer could use to decide if an individual function call should be inlined – i.e., the benefit of inlining it is likely to exceed the drawback. Are there cases where a function call cannot be inlined because doing so would cause incorrect or erroneous behavior? Briefly explain why or why not. (15 pts)

Read Details

Consider the following Tiger code that gets converted to its…

Consider the following Tiger code that gets converted to its MIPS assembly: function main()    begin        let            var a, i : int := 0;            var b : int := 1;        begin            a := a + b;            while (i < 10) do                a := a + b;                if (i < 5) then                    a := a + b;                else                    a := a - b;                endif;                a := a + b;                i := i + 1;            enddo;            printi(a);        end    end main:   addi $sp, $sp, __    li $t1, 0    li $s2, 0   li $t0, __    add $s2, $s2, $t0_L0:   li $t8, __   bge $t1, $t8, __    add $s2, $s2, $t0    li $t8, 5   bge $t1, $t8, _L2    add $s2, $s2, $t0   j ___L2:    sub $s2, $s2, $t0_L3:    add $s2, $s2, $t0   addi __, __, 1   j ___L1:    move $a0, $s2    li $v0, 1    syscall    li $a0, 10    li $v0, 11    syscall   addiu $sp, $sp, 40    jr $ra The MIPS assembly for the above code has some parts replaced with underline blanks. What values, temporary variables or labels need to be in these blanks?

Read Details

Given L1 and L2  is a regular language, which of the followi…

Given L1 and L2  is a regular language, which of the following are regular languages?

Read Details

Compilers, like programmers, can introduce inefficiencies wh…

Compilers, like programmers, can introduce inefficiencies while translating source language into IR. As a result, the compiler’s optimizer is very important in removing these inefficiencies. Give two examples of inefficiencies you would expect an optimizer to improve. Give two examples of inefficiencies you would expect an optimizer to miss, even though they can be improved. Explain why an optimizer would have difficulty improving them. (8 pts)

Read Details

Which of the following situations can NOT always be guarante…

Which of the following situations can NOT always be guaranteed to be reported at compile time?  (Select all that apply) (4 pts)

Read Details

Minimize the following DFA using Brzozowski’s algorithm.  S…

Minimize the following DFA using Brzozowski’s algorithm.  Show the resulting DFA after the first (backward) pass. Show the final resulting DFA after the second (forward) pass.  You may choose the names for states in each DFA. Write each DFA in the following format, illustrated with the original DFA:  States: 0, 1, 2, 3 Start state 0  Accepting states: 1, 3 Transitions: (0, a) = 1, (0, b) = 2, (1, a) = 1, (2, a) = 3, (3, a) = 3 (12 pts)

Read Details

Posts pagination

Newer posts 1 … 21,897 21,898 21,899 21,900 21,901 … 59,803 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top