diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-15 01:58:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-15 01:58:54 +0000 |
commit | 3e295b1b59e47916c8ae5d42eb27a23bd580cabe (patch) | |
tree | 9b73bba903fb129c9988ecc670f6eacce757a3db | |
parent | 15d443b56660ecd0bae89898de1bcc8a08e1cd8d (diff) |
Add two new methods which can be used to enable a bunch of transformations
in common cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12407 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/AliasAnalysis.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index fb848ebd57..5be8af899c 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -100,6 +100,28 @@ public: /// virtual bool pointsToConstantMemory(const Value *P) { return false; } + /// doesNotAccessMemory - If the specified function is known to never read or + /// write memory, return true. + /// + /// Many optimizations (such as CSE and LICM) can be performed on calls to it, + /// without worrying about aliasing properties, and many functions have this + /// property (e.g. 'sin' and 'cos'). + /// + /// This property corresponds to the GCC 'const' attribute. + /// + virtual bool doesNotAccessMemory(Function *F) { return false; } + + /// onlyReadsMemory - If the specified function is known to only read from + /// non-volatile memory (or not access memory at all), return true. + /// + /// This property allows many common optimizations to be performed in the + /// absence of interfering store instructions, such as CSE of strlen calls. + /// + /// This property corresponds to the GCC 'pure' attribute. + /// + virtual bool onlyReadsMemory(Function *F) { return doesNotAccessMemory(F); } + + //===--------------------------------------------------------------------===// /// Simple mod/ref information... /// |