X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FAliasAnalysis.rst;h=fe7fcbd4bc50f5d181ba06df7a42bad02bdf08b6;hb=5a9e526f29cf8510ab5c3d566fbdcf47ac24e1e9;hp=54b4a4a746500e90f92a854cfa68e3ac44e8c281;hpb=5eabd76ae38bdb424aa287aeecccb8ea1aaf7e5a;p=oota-llvm.git diff --git a/docs/AliasAnalysis.rst b/docs/AliasAnalysis.rst index 54b4a4a7465..fe7fcbd4bc5 100644 --- a/docs/AliasAnalysis.rst +++ b/docs/AliasAnalysis.rst @@ -1,5 +1,3 @@ -.. _alias_analysis: - ================================== LLVM Alias Analysis Infrastructure ================================== @@ -53,7 +51,7 @@ starting address and size, and function calls are represented as the actual get mod/ref information for arbitrary instructions. All ``AliasAnalysis`` interfaces require that in queries involving multiple -values, values which are not `constants `_ are all +values, values which are not :ref:`constants ` are all defined within the same function. Representation of Pointers @@ -113,7 +111,7 @@ returns MustAlias, PartialAlias, MayAlias, or NoAlias as appropriate. Like all ``AliasAnalysis`` interfaces, the ``alias`` method requires that either the two pointer values be defined within the same function, or at least one of -the values is a `constant `_. +the values is a :ref:`constant `. .. _Must, May, or No: @@ -128,7 +126,7 @@ used for reading memory. Another is when the memory is freed and reallocated between accesses through one pointer and accesses through the other --- in this case, there is a dependence, but it's mediated by the free and reallocation. -As an exception to this is with the `noalias `_ keyword; +As an exception to this is with the :ref:`noalias ` keyword; the "irrelevant" dependencies are ignored. The ``MayAlias`` response is used whenever the two pointers might refer to the @@ -248,6 +246,20 @@ analysis run method (``run`` for a ``Pass``, ``runOnFunction`` for a return false; } +Required methods to override +---------------------------- + +You must override the ``getAdjustedAnalysisPointer`` method on all subclasses +of ``AliasAnalysis``. An example implementation of this method would look like: + +.. code-block:: c++ + + void *getAdjustedAnalysisPointer(const void* ID) override { + if (ID == &AliasAnalysis::ID) + return (AliasAnalysis*)this; + return this; + } + Interfaces which may be specified --------------------------------- @@ -274,8 +286,8 @@ Mod/Ref result, simply return whatever the superclass computes. For example: .. code-block:: c++ - AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size, - const Value *V2, unsigned V2Size) { + AliasResult alias(const Value *V1, unsigned V1Size, + const Value *V2, unsigned V2Size) { if (...) return NoAlias; ... @@ -377,11 +389,10 @@ in its ``getAnalysisUsage`` that it does so. Some passes attempt to use ``AU.addPreserved``, however this doesn't actually have any effect. -``AliasAnalysisCounter`` (``-count-aa``) and ``AliasDebugger`` (``-debug-aa``) -are implemented as ``ModulePass`` classes, so if your alias analysis uses -``FunctionPass``, it won't be able to use these utilities. If you try to use -them, the pass manager will silently route alias analysis queries directly to -``BasicAliasAnalysis`` instead. +``AliasAnalysisCounter`` (``-count-aa``) are implemented as ``ModulePass`` +classes, so if your alias analysis uses ``FunctionPass``, it won't be able to +use these utilities. If you try to use them, the pass manager will silently +route alias analysis queries directly to ``BasicAliasAnalysis`` instead. Similarly, the ``opt -p`` option introduces ``ModulePass`` passes between each pass, which prevents the use of ``FunctionPass`` alias analysis passes.