Đang chuẩn bị liên kết để tải về tài liệu:
compilers principles techniques and tools phần 10
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Là một xấp xỉ đầu tiên, chúng ta xem xét hai yếu tố mảng để chia sẻ cùng một dòng bộ nhớ cache khi và chỉ khi họ chia sẻ cùng một hàng trong một mảng hai chiều. Nói chung, trong một mảng kích thước d, chúng ta lấy các phần tử mảng để chia sẻ một dòng bộ nhớ cache nếu họ chỉ khác nhau ở kích thước cuối cùng. | Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com for i 0 i n Ỉ cl tl fO O c2 t2 f243 243 c3 t3 f243 243 x i tl t2 t3 int fO int v return 1 int f243 int v return 244 Figure 12.9 Result of propagating all possible constant arguments to the function f Even if cloning is not applied in the summary-based approach inferences about the effect of a called procedure are made accurately without the problem of unrealizable paths. Instead of cloning a function we could also inline the code. Inlining has the additional effect of eliminating the procedure-call overhead as well. We can handle recursion by computing the fixedpoint solution. In the presence of recursion we first find the strongly connected components in the call graph. In the bottom-up phase we do not visit a strongly connected component unless all its successors have been visited. For a nontrivial strongly connected component we iteratively compute the transfer functions for each procedure in the component until convergence is reached that is we iteratively update the transfer functions until no more changes occur. 12.1.6 Exercises for Section 12.1 Exercise 12.1.1 In Fig. 12.10 is a c program with two function pointers p and q. N is a constant that could be less than or greater than 10. Note that the program results in an infinite sequence of calls but that is of no concern for the purposes of this problem. a Identify all the call sites in this program. b For each call site what can p point to What can q point to c Draw the call graph for this program. d Describe all the call strings for f and g. Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com int p int int q int int f int i if i 10 p g return q i else p f return p i int g int j if j 10 q f return p j else q g return q j void mainO p f q g p q N Figure 12.10 Program for Exercise 12.1.1 Exercise 12.1.2 In Fig. 12.11 is a function id that is the identity function it returns exactly what it is given as an argument. We also