HBC210246PointerAnalysis题解

一沫阳光 算法基础篇 27 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Pointer analysis, which aims to figure out which objects accessible via a specific pointer variable in a program during the execution, is one of the fundamental parts of static program analysis. Now w

Pointer analysis, which aims to figure out which objects accessible via a specific pointer variable in a program during the execution, is one of the fundamental parts of static program analysis. Now we want you to perform the context-insensitive pointer analysis on the test data. A program contains 26 objects denoted by lowercase letters and each object has 26 member variables (a.k.a. fields, which are pointers that may point to some objects) denoted by lowercase letters as well. Meanwhile, there are 26 global pointers in the programs designated by uppercase letters. There are four kinds of statements in a program. We use [Variable] to represent the name of a pointer, [Field] to represent the name of a member variable, and [Object] to represent an object.  Format Example Description Allocation [Variable] = [Object] A = x pointer A can point to object x (i.e., x is accessible via A) Assignment [Variable] = [Variable] A = B pointer A can point to every object accessible via B Store [Variable].[Field] = [Variable] A.f = B for every object o accessible via A, the member variable f of o can point to every object accesible via B Load [Variable] = [Variable].[Field] A = B.f for every object o accessible via B, A can point to every object accessible via the member variable f of o The context-insensitive pointer analysis assumes that statements of the program will be executed in any order for a sufficient number of times. For example, in the following two programs, both A and B can point to the object x and object o. The reason for that is, in the real world, the exact execution order and execution times of statements are difficult to predict. First Program Second Program A = o A = x B = A B = A A = x A = o Now you are asked to perform a context-insensitive pointer analysis on a given program consists of N statements, and for each pointer, output the objects it can point to.

HBC210246PointerAnalysis题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC210246PointerAnalysis题解