MemoryBuiltins.h revision 2b3e9580536dfb5666b9d91e99baebf6d45bfa5f
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===- llvm/Analysis/MemoryBuiltins.h- Calls to memory builtins -*- C++ -*-===//
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//                     The LLVM Compiler Infrastructure
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
5effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// This file is distributed under the University of Illinois Open Source
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// License. See LICENSE.TXT for details.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)//===----------------------------------------------------------------------===//
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
109ab5563a3196760eb381d102cbb2bc0f7abc6a50Ben Murdoch// This family of functions identifies calls to builtin functions that allocate
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// or free memory.
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)//===----------------------------------------------------------------------===//
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef LLVM_ANALYSIS_MEMORYBUILTINS_H
163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#define LLVM_ANALYSIS_MEMORYBUILTINS_H
173551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
183551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "llvm/ADT/DenseMap.h"
19b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "llvm/ADT/SmallPtrSet.h"
20c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "llvm/Operator.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "llvm/Support/DataTypes.h"
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "llvm/Support/InstVisitor.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "llvm/Support/IRBuilder.h"
2423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "llvm/Support/TargetFolder.h"
2523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
2623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)namespace llvm {
2723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)class CallInst;
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PointerType;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TargetData;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Type;
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Value;
32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)/// \brief Tests if a value is a call or invoke to a library function that
351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)/// allocates or reallocates memory (either malloc, calloc, realloc, or strdup
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// like).
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool isAllocationFn(const Value *V, bool LookThroughBitCast = false);
38d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
39d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)/// \brief Tests if a value is a call or invoke to a function that returns a
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// NoAlias pointer (including malloc/calloc/strdup-like functions).
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool isNoAliasFn(const Value *V, bool LookThroughBitCast = false);
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// \brief Tests if a value is a call or invoke to a library function that
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// allocates uninitialized memory (such as malloc).
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool isMallocLikeFn(const Value *V, bool LookThroughBitCast = false);
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// \brief Tests if a value is a call or invoke to a library function that
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// allocates zero-filled memory (such as calloc).
4923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)bool isCallocLikeFn(const Value *V, bool LookThroughBitCast = false);
5023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
5123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// \brief Tests if a value is a call or invoke to a library function that
5223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// allocates memory (either malloc, calloc, or strdup like).
5323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)bool isAllocLikeFn(const Value *V, bool LookThroughBitCast = false);
5423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
5523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// \brief Tests if a value is a call or invoke to a library function that
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// reallocates memory (such as realloc).
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool isReallocLikeFn(const Value *V, bool LookThroughBitCast = false);
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
59d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
60d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)//===----------------------------------------------------------------------===//
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//  malloc Call Utility Functions.
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// extractMallocCall - Returns the corresponding CallInst if the instruction
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// is a malloc call.  Since CallInst::CreateMalloc() only creates calls, we
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// ignore InvokeInst here.
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const CallInst *extractMallocCall(const Value *I);
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static inline CallInst *extractMallocCall(Value *I) {
6923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  return const_cast<CallInst*>(extractMallocCall((const Value*)I));
7023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)}
7123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// extractMallocCallFromBitCast - Returns the corresponding CallInst if the
7323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// instruction is a bitcast of the result of a malloc call.
7423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)const CallInst *extractMallocCallFromBitCast(const Value *I);
7523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)static inline CallInst *extractMallocCallFromBitCast(Value *I) {
7623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  return const_cast<CallInst*>(extractMallocCallFromBitCast((const Value*)I));
7723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)}
7823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
7923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// isArrayMalloc - Returns the corresponding CallInst if the instruction
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// is a call to malloc whose array size can be determined and the array size
8123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// is not constant 1.  Otherwise, return NULL.
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const CallInst *isArrayMalloc(const Value *I, const TargetData *TD);
832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// getMallocType - Returns the PointerType resulting from the malloc call.
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// The PointerType depends on the number of bitcast uses of the malloc call:
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///   0: PointerType is the malloc calls' return type.
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///   1: PointerType is the bitcast's result type.
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///  >1: Unique PointerType cannot be determined, return NULL.
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PointerType *getMallocType(const CallInst *CI);
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// getMallocAllocatedType - Returns the Type allocated by malloc call.
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// The Type depends on the number of bitcast uses of the malloc call:
931e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)///   0: PointerType is the malloc calls' return type.
94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)///   1: PointerType is the bitcast's result type.
951e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)///  >1: Unique PointerType cannot be determined, return NULL.
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)Type *getMallocAllocatedType(const CallInst *CI);
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/// getMallocArraySize - Returns the array size of a malloc call.  If the
995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/// argument passed to malloc is a multiple of the size of the malloced type,
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// then return that multiple.  For non-array mallocs, the multiple is
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// constant 1.  Otherwise, return NULL for mallocs whose array size cannot be
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// determined.
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)Value *getMallocArraySize(CallInst *CI, const TargetData *TD,
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                          bool LookThroughSExt = false);
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1061e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
1071e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)//===----------------------------------------------------------------------===//
1081e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)//  calloc Call Utility Functions.
1091e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)//
1101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
11123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)/// extractCallocCall - Returns the corresponding CallInst if the instruction
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// is a calloc call.
11323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)const CallInst *extractCallocCall(const Value *I);
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static inline CallInst *extractCallocCall(Value *I) {
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return const_cast<CallInst*>(extractCallocCall((const Value*)I));
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===----------------------------------------------------------------------===//
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//  free Call Utility Functions.
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// isFreeCall - Returns non-null if the value is a call to the builtin free()
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const CallInst *isFreeCall(const Value *I);
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static inline CallInst *isFreeCall(Value *I) {
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return const_cast<CallInst*>(isFreeCall((const Value*)I));
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===----------------------------------------------------------------------===//
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//  Utility functions to compute size of objects.
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
134c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// \brief Compute the size of the object pointed by Ptr. Returns true and the
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// object size in Size if successful, and false otherwise.
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// If RoundToAlign is true, then Size is rounded up to the aligment of allocas,
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// byval arguments, and global variables.
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool getObjectSize(const Value *Ptr, uint64_t &Size, const TargetData *TD,
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                   bool RoundToAlign = false);
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
143eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
144eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochtypedef std::pair<APInt, APInt> SizeOffsetType;
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// \brief Evaluate the size and offset of an object ponted by a Value*
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/// statically. Fails if size or offset are not known at compile time.
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ObjectSizeOffsetVisitor
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  : public InstVisitor<ObjectSizeOffsetVisitor, SizeOffsetType> {
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const TargetData *TD;
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool RoundToAlign;
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  unsigned IntTyBits;
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  APInt Zero;
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  APInt align(APInt Size, uint64_t Align);
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SizeOffsetType unknown() {
159c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    return std::make_pair(APInt(), APInt());
16090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)public:
1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ObjectSizeOffsetVisitor(const TargetData *TD, LLVMContext &Context,
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                          bool RoundToAlign = false);
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SizeOffsetType compute(Value *V);
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
168c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  bool knownSize(SizeOffsetType &SizeOffset) {
16990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return SizeOffset.first.getBitWidth() > 1;
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool knownOffset(SizeOffsetType &SizeOffset) {
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return SizeOffset.second.getBitWidth() > 1;
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
176  bool bothKnown(SizeOffsetType &SizeOffset) {
177    return knownSize(SizeOffset) && knownOffset(SizeOffset);
178  }
179
180  SizeOffsetType visitAllocaInst(AllocaInst &I);
181  SizeOffsetType visitArgument(Argument &A);
182  SizeOffsetType visitCallSite(CallSite CS);
183  SizeOffsetType visitConstantPointerNull(ConstantPointerNull&);
184  SizeOffsetType visitExtractValueInst(ExtractValueInst &I);
185  SizeOffsetType visitGEPOperator(GEPOperator &GEP);
186  SizeOffsetType visitGlobalVariable(GlobalVariable &GV);
187  SizeOffsetType visitIntToPtrInst(IntToPtrInst&);
188  SizeOffsetType visitLoadInst(LoadInst &I);
189  SizeOffsetType visitPHINode(PHINode&);
190  SizeOffsetType visitSelectInst(SelectInst &I);
191  SizeOffsetType visitUndefValue(UndefValue&);
192  SizeOffsetType visitInstruction(Instruction &I);
193};
194
195typedef std::pair<Value*, Value*> SizeOffsetEvalType;
196
197
198/// \brief Evaluate the size and offset of an object ponted by a Value*.
199/// May create code to compute the result at run-time.
200class ObjectSizeOffsetEvaluator
201  : public InstVisitor<ObjectSizeOffsetEvaluator, SizeOffsetEvalType> {
202
203  typedef IRBuilder<true, TargetFolder> BuilderTy;
204  typedef DenseMap<const Value*, SizeOffsetEvalType> CacheMapTy;
205  typedef SmallPtrSet<const Value*, 8> PtrSetTy;
206
207  const TargetData *TD;
208  LLVMContext &Context;
209  BuilderTy Builder;
210  ObjectSizeOffsetVisitor Visitor;
211  IntegerType *IntTy;
212  Value *Zero;
213  CacheMapTy CacheMap;
214  PtrSetTy SeenVals;
215
216  SizeOffsetEvalType unknown() {
217    return std::make_pair((Value*)0, (Value*)0);
218  }
219  SizeOffsetEvalType compute_(Value *V);
220
221public:
222  ObjectSizeOffsetEvaluator(const TargetData *TD, LLVMContext &Context);
223  SizeOffsetEvalType compute(Value *V);
224
225  bool knownSize(SizeOffsetEvalType &SizeOffset) {
226    return SizeOffset.first;
227  }
228
229  bool knownOffset(SizeOffsetEvalType &SizeOffset) {
230    return SizeOffset.second;
231  }
232
233  bool anyKnown(SizeOffsetEvalType &SizeOffset) {
234    return knownSize(SizeOffset) || knownOffset(SizeOffset);
235  }
236
237  bool bothKnown(SizeOffsetEvalType &SizeOffset) {
238    return knownSize(SizeOffset) && knownOffset(SizeOffset);
239  }
240
241  SizeOffsetEvalType visitAllocaInst(AllocaInst &I);
242  SizeOffsetEvalType visitCallSite(CallSite CS);
243  SizeOffsetEvalType visitGEPOperator(GEPOperator &GEP);
244  SizeOffsetEvalType visitIntToPtrInst(IntToPtrInst&);
245  SizeOffsetEvalType visitLoadInst(LoadInst &I);
246  SizeOffsetEvalType visitPHINode(PHINode &PHI);
247  SizeOffsetEvalType visitSelectInst(SelectInst &I);
248  SizeOffsetEvalType visitInstruction(Instruction &I);
249};
250
251} // End llvm namespace
252
253#endif
254