Alias analysis forty-four LLVM LLVM talk of the day

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/snsn1984/article/details/89672023

Alias ​​analysis is trying to decide whether two pointers point to a class of the same memory technology, this kind of technology there are many different algorithms and methods. Therefore, alias analysis is also often referred to as pointer analysis. Alias ​​is the alias analysis usually return, perhaps an alias and not an alias and other situations.

LLVM core alias analysis is AliasAnalysis class. This class provides the interface to the user or the system using the internal alias analysis LLVM required. AliasAnalysis class code has AliasAnalysis.cpp at llvm / lib / Analysis / directory.

AliasAnalysis class used in a very important enumeration (the code from AliasAnalysis.h):

   78 enum AliasResult : uint8_t {
   79   /// The two locations do not alias at all.
   80   ///
   81   /// This value is arranged to convert to false, while all other values
   82   /// convert to true. This allows a boolean context to convert the result to
   83   /// a binary flag indicating whether there is the possibility of aliasing.
   84   NoAlias = 0,
   85   /// The two locations may or may not alias. This is the least precise result.
   86   MayAlias,
   87   /// The two locations alias, but only due to a partial overlap.
   88   PartialAlias,
   89   /// The two locations precisely alias each other.
   90   MustAlias,
   91 };

To determine the result alias analysis. We can see from the code, in fact, a total of four possible result: not an alias, may be an alias, it is part of aliases and alias.

LLVM-depth understanding of alias analysis can refer to:

1, Documentation:  http://llvm.org/docs/AliasAnalysis.html

2、AliasAnalysis.h: http://llvm.org/doxygen/AliasAnalysis_8h_source.html

3 AliasAnalysis.cpp:  http://llvm.org/doxygen/AliasAnalysis_8cpp_source.html

Guess you like

Origin blog.csdn.net/snsn1984/article/details/89672023