LLVM API Documentation

EscapeAnalysis.h

Go to the documentation of this file.
00001 //===------------- EscapeAnalysis.h - Pointer escape analysis -------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines the interface for the pointer escape analysis.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_ANALYSIS_ESCAPEANALYSIS_H
00015 #define LLVM_ANALYSIS_ESCAPEANALYSIS_H
00016 
00017 #include "llvm/Pass.h"
00018 #include <set>
00019 
00020 namespace llvm {
00021 
00022 class Instruction;
00023 class Value;
00024 
00025 /// EscapeAnalysis - This class determines whether an allocation (a MallocInst 
00026 /// or an AllocaInst) can escape from the current function.  It performs some
00027 /// precomputation, with the rest of the work happening on-demand.
00028 class EscapeAnalysis : public FunctionPass {
00029 private:
00030   std::set<Instruction*> EscapePoints;
00031 
00032 public:
00033   static char ID; // Class identification, replacement for typeinfo
00034 
00035   EscapeAnalysis() : FunctionPass(intptr_t(&ID)) {}
00036 
00037   bool runOnFunction(Function &F);
00038   
00039   void releaseMemory() {
00040     EscapePoints.clear();
00041   }
00042 
00043   void getAnalysisUsage(AnalysisUsage &AU) const;
00044 
00045   //===---------------------------------------------------------------------
00046   // Client API
00047 
00048   /// escapes - returns true if the value, which must have a pointer type,
00049   /// can escape.
00050   bool escapes(Value* A);
00051 };
00052 
00053 } // end llvm namespace
00054 
00055 #endif



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.