diff options
author | Dan Gohman <gohman@apple.com> | 2010-10-21 21:55:35 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-10-21 21:55:35 +0000 |
commit | ee135131b16390177c09c1620e322bcf38a78e0a (patch) | |
tree | 704c9e0c56cd98176ae7c568fc7d6bfa86aef370 /lib/Analysis/TypeBasedAliasAnalysis.cpp | |
parent | 636ad14c8a93f914330bd7340ce56b030f06ab4f (diff) | |
download | llvm-ee135131b16390177c09c1620e322bcf38a78e0a.tar.gz llvm-ee135131b16390177c09c1620e322bcf38a78e0a.tar.bz2 llvm-ee135131b16390177c09c1620e322bcf38a78e0a.tar.xz |
Add some more documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/TypeBasedAliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/TypeBasedAliasAnalysis.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/Analysis/TypeBasedAliasAnalysis.cpp b/lib/Analysis/TypeBasedAliasAnalysis.cpp index 38f3a11372..65ab70f0b8 100644 --- a/lib/Analysis/TypeBasedAliasAnalysis.cpp +++ b/lib/Analysis/TypeBasedAliasAnalysis.cpp @@ -12,27 +12,33 @@ // // In LLVM IR, memory does not have types, so LLVM's own type system is not // suitable for doing TBAA. Instead, metadata is added to the IR to describe -// a type system of a higher level language. +// a type system of a higher level language. This can be used to implement +// typical C/C++ TBAA, but it can also be used to implement custom alias +// analysis behavior for other languages. // -// This pass is language-independent. The type system is encoded in -// metadata. This allows this pass to support typical C and C++ TBAA, but -// it can also support custom aliasing behavior for other languages. +// The current metadata format is very simple. TBAA MDNodes have up to +// three fields, e.g.: +// !0 = metadata !{ metadata !"an example type tree" } +// !1 = metadata !{ metadata !"int", metadata !0 } +// !2 = metadata !{ metadata !"float", metadata !0 } +// !3 = metadata !{ metadata !"const float", metadata !2, i64 1 } // -// This is a work-in-progress. It doesn't work yet, and the metadata -// format isn't stable. +// The first field is an identity field. It can be any value, usually +// an MDString, which uniquely identifies the type. The most important +// name in the tree is the name of the root node. Two trees with +// different root node names are entirely disjoint, even if they +// have leaves with common names. +// +// The second field identifies the type's parent node in the tree, or +// is null or omitted for a root node. A type is considered to alias +// all of its decendents and all of its ancestors in the tree. // -// The current metadata format is very simple. MDNodes have up to three -// fields, e.g.: -// !0 = metadata !{ !"name", !1, 0 } -// The first field is an identity field. It can be any MDString which -// uniquely identifies the type. The second field identifies the type's -// parent node in the tree, or is null or omitted for a root node. // If the third field is present, it's an integer which if equal to 1 -// indicates that the type is "constant" (meaning -// pointsToConstantMemory should return true; see +// indicates that the type is "constant" (meaning pointsToConstantMemory +// should return true; see // http://llvm.org/docs/AliasAnalysis.html#OtherItfs). // -// TODO: The current metadata encoding scheme doesn't support struct +// TODO: The current metadata format doesn't support struct // fields. For example: // struct X { // double d; |