首页 » 编程代写 » 编程代写|PLT-4115 Final Review

编程代写|PLT-4115 Final Review

本次美国代写是一个编程语言相关的限时测试

Q1. Consider the basic block:

y := 3
x := y
z := 4 * x

Now consider the local optimizations:

– constant propagation
– copy propagation,
– constant folding.

– For this example, what is the best order in which to apply the three
optimizations, if each can be applied only once?

Q2. Consider the basic block:

y := 3
x := y
z := 4 * x

Now consider the local optimizations:

– constant propagation
– copy propagation,
– constant folding.

– For this example, What is the worst possible order (i.e., requires
the most passes) for the basic block?

Q3. Consider the following intermediate code:

1. x := 5
2. if y >1 goto Label3
3. Label1:
4. w := w + 1
5. if y > 2 goto Label3
6. Label2:
7. q := 3
8. if z < 1 goto Label1
9. Label3:
10.w := 2
11.if z > 1 goto Label2
12. q := y + w

a. Draw the CFG where each node is a BB.

b. Which variables are live immediately
before the execution of statement 7?
Assume only variable q is live after the
statement in line 12.

Q3. Consider the following intermediate code:

1. x := 5
2. if y >1 goto Label3
3. Label1:
4. w := w + 1
5. if y > 2 goto Label3
6. Label2:
7. q := 3
8. if z < 1 goto Label1
9. Label3:
10.w := 2
11.if z > 1 goto Label2
12.12: q := y + w

c. Assume the constant propagation algorithm has
completed. Which of the following statements is true?
– L_N is the statement at line N
– C(L,v,in) = C means that at the “in” of statement L
variable v is some constant
– C(L,v,in) = ⊤ means v is not a constant.


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。