summaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/CFGPrinter.h12
-rw-r--r--include/llvm/Analysis/ConstantFolding.h14
-rw-r--r--include/llvm/Analysis/DebugInfo.h93
-rw-r--r--include/llvm/Analysis/Dominators.h1
-rw-r--r--include/llvm/Analysis/IVUsers.h7
-rw-r--r--include/llvm/Analysis/InstructionSimplify.h74
-rw-r--r--include/llvm/Analysis/LazyValueInfo.h73
-rw-r--r--include/llvm/Analysis/LiveValues.h6
-rw-r--r--include/llvm/Analysis/LoopInfo.h8
-rw-r--r--include/llvm/Analysis/MemoryBuiltins.h25
-rw-r--r--include/llvm/Analysis/Passes.h6
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpander.h3
-rw-r--r--include/llvm/Analysis/SparsePropagation.h2
-rw-r--r--include/llvm/Analysis/ValueTracking.h9
14 files changed, 233 insertions, 100 deletions
diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h
index 435f8ea..440d182 100644
--- a/include/llvm/Analysis/CFGPrinter.h
+++ b/include/llvm/Analysis/CFGPrinter.h
@@ -71,6 +71,18 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
if (const BranchInst *BI = dyn_cast<BranchInst>(Node->getTerminator()))
if (BI->isConditional())
return (I == succ_begin(Node)) ? "T" : "F";
+
+ // Label source of switch edges with the associated value.
+ if (const SwitchInst *SI = dyn_cast<SwitchInst>(Node->getTerminator())) {
+ unsigned SuccNo = I.getSuccessorIndex();
+
+ if (SuccNo == 0) return "def";
+
+ std::string Str;
+ raw_string_ostream OS(Str);
+ OS << SI->getCaseValue(SuccNo)->getValue();
+ return OS.str();
+ }
return "";
}
};
diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h
index 78a16da..06951c7 100644
--- a/include/llvm/Analysis/ConstantFolding.h
+++ b/include/llvm/Analysis/ConstantFolding.h
@@ -26,20 +26,18 @@ namespace llvm {
class TargetData;
class Function;
class Type;
- class LLVMContext;
/// ConstantFoldInstruction - Attempt to constant fold the specified
/// instruction. If successful, the constant result is returned, if not, null
/// is returned. Note that this function can only fail when attempting to fold
/// instructions like loads and stores, which have no constant expression form.
///
-Constant *ConstantFoldInstruction(Instruction *I, LLVMContext &Context,
- const TargetData *TD = 0);
+Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
/// using the specified TargetData. If successful, the constant result is
/// result is returned, if not, null is returned.
-Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
+Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
const TargetData *TD = 0);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
@@ -49,8 +47,7 @@ Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
/// form.
///
Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
- Constant*const * Ops, unsigned NumOps,
- LLVMContext &Context,
+ Constant *const *Ops, unsigned NumOps,
const TargetData *TD = 0);
/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare
@@ -58,8 +55,7 @@ Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
/// returns a constant expression of the specified operands.
///
Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
- Constant*const * Ops, unsigned NumOps,
- LLVMContext &Context,
+ Constant *LHS, Constant *RHS,
const TargetData *TD = 0);
/// ConstantFoldLoadFromConstPtr - Return the value that a load from C would
@@ -79,7 +75,7 @@ bool canConstantFoldCallTo(const Function *F);
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
/// with the specified arguments, returning null if unsuccessful.
Constant *
-ConstantFoldCall(Function *F, Constant* const* Operands, unsigned NumOperands);
+ConstantFoldCall(Function *F, Constant *const *Operands, unsigned NumOperands);
}
#endif
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index cfe3632..3c40d65 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -26,8 +26,6 @@
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ValueHandle.h"
-#define ATTACH_DEBUG_INFO_TO_AN_INSN 1
-
namespace llvm {
class BasicBlock;
class Constant;
@@ -46,9 +44,11 @@ namespace llvm {
class Instruction;
class LLVMContext;
+ /// DIDescriptor - A thin wraper around MDNode to access encoded debug info. This should not
+ /// be stored in a container, because underly MDNode may change in certain situations.
class DIDescriptor {
protected:
- TrackingVH<MDNode> DbgNode;
+ MDNode *DbgNode;
/// DIDescriptor constructor. If the specified node is non-null, check
/// to make sure that the tag in the descriptor matches 'RequiredTag'. If
@@ -468,15 +468,8 @@ namespace llvm {
Module &M;
LLVMContext& VMContext;
- // Cached values for uniquing and faster lookups.
const Type *EmptyStructPtr; // "{}*".
- Function *StopPointFn; // llvm.dbg.stoppoint
- Function *FuncStartFn; // llvm.dbg.func.start
- Function *RegionStartFn; // llvm.dbg.region.start
- Function *RegionEndFn; // llvm.dbg.region.end
Function *DeclareFn; // llvm.dbg.declare
- StringMap<Constant*> StringCache;
- DenseMap<Constant*, DIDescriptor> SimpleConstantCache;
DIFactory(const DIFactory &); // DO NOT IMPLEMENT
void operator=(const DIFactory&); // DO NOT IMPLEMENT
@@ -496,26 +489,26 @@ namespace llvm {
/// CreateCompileUnit - Create a new descriptor for the specified compile
/// unit.
DICompileUnit CreateCompileUnit(unsigned LangID,
- StringRef Filenae,
- StringRef Directory,
- StringRef Producer,
+ const char * Filename,
+ const char * Directory,
+ const char * Producer,
bool isMain = false,
bool isOptimized = false,
const char *Flags = "",
unsigned RunTimeVer = 0);
/// CreateEnumerator - Create a single enumerator value.
- DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
+ DIEnumerator CreateEnumerator(const char * Name, uint64_t Val);
/// CreateBasicType - Create a basic type like int, float, etc.
- DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
+ DIBasicType CreateBasicType(DIDescriptor Context, const char * Name,
DICompileUnit CompileUnit, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
unsigned Encoding);
/// CreateBasicType - Create a basic type like int, float, etc.
- DIBasicType CreateBasicTypeEx(DIDescriptor Context, StringRef Name,
+ DIBasicType CreateBasicTypeEx(DIDescriptor Context, const char * Name,
DICompileUnit CompileUnit, unsigned LineNumber,
Constant *SizeInBits, Constant *AlignInBits,
Constant *OffsetInBits, unsigned Flags,
@@ -524,7 +517,7 @@ namespace llvm {
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
@@ -534,7 +527,7 @@ namespace llvm {
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedTypeEx(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
Constant *SizeInBits, Constant *AlignInBits,
@@ -543,7 +536,7 @@ namespace llvm {
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
uint64_t SizeInBits,
@@ -555,7 +548,7 @@ namespace llvm {
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit,
unsigned LineNumber,
Constant *SizeInBits,
@@ -567,25 +560,25 @@ namespace llvm {
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
- DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
- StringRef DisplayName,
- StringRef LinkageName,
+ DISubprogram CreateSubprogram(DIDescriptor Context, const char * Name,
+ const char * DisplayName,
+ const char * LinkageName,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type, bool isLocalToUnit,
bool isDefinition);
/// CreateGlobalVariable - Create a new descriptor for the specified global.
DIGlobalVariable
- CreateGlobalVariable(DIDescriptor Context, StringRef Name,
- StringRef DisplayName,
- StringRef LinkageName,
+ CreateGlobalVariable(DIDescriptor Context, const char * Name,
+ const char * DisplayName,
+ const char * LinkageName,
DICompileUnit CompileUnit,
unsigned LineNo, DIType Type, bool isLocalToUnit,
bool isDefinition, llvm::GlobalVariable *GV);
/// CreateVariable - Create a new descriptor for the specified variable.
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
- StringRef Name,
+ const char * Name,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type);
@@ -605,30 +598,13 @@ namespace llvm {
DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
DIScope S, DILocation OrigLoc);
- /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
- /// inserting it at the end of the specified basic block.
- void InsertStopPoint(DICompileUnit CU, unsigned LineNo, unsigned ColNo,
- BasicBlock *BB);
-
- /// InsertSubprogramStart - Create a new llvm.dbg.func.start intrinsic to
- /// mark the start of the specified subprogram.
- void InsertSubprogramStart(DISubprogram SP, BasicBlock *BB);
-
- /// InsertRegionStart - Insert a new llvm.dbg.region.start intrinsic call to
- /// mark the start of a region for the specified scoping descriptor.
- void InsertRegionStart(DIDescriptor D, BasicBlock *BB);
-
- /// InsertRegionEnd - Insert a new llvm.dbg.region.end intrinsic call to
- /// mark the end of a region for the specified scoping descriptor.
- void InsertRegionEnd(DIDescriptor D, BasicBlock *BB);
-
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
- void InsertDeclare(llvm::Value *Storage, DIVariable D,
- BasicBlock *InsertAtEnd);
+ Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
+ BasicBlock *InsertAtEnd);
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
- void InsertDeclare(llvm::Value *Storage, DIVariable D,
- Instruction *InsertBefore);
+ Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
+ Instruction *InsertBefore);
private:
Constant *GetTagConstant(unsigned TAG);
@@ -693,12 +669,6 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
DebugLocTracker &DebugLocInfo);
- /// isInlinedFnStart - Return true if FSI is starting an inlined function.
- bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn);
-
- /// isInlinedFnEnd - Return true if REI is ending an inlined function.
- bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn);
- /// DebugInfoFinder - This object collects DebugInfo from a module.
class DebugInfoFinder {
public:
@@ -716,21 +686,12 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
/// processSubprogram - Process DISubprogram.
void processSubprogram(DISubprogram SP);
- /// processStopPoint - Process DbgStopPointInst.
- void processStopPoint(DbgStopPointInst *SPI);
-
- /// processFuncStart - Process DbgFuncStartInst.
- void processFuncStart(DbgFuncStartInst *FSI);
-
- /// processRegionStart - Process DbgRegionStart.
- void processRegionStart(DbgRegionStartInst *DRS);
-
- /// processRegionEnd - Process DbgRegionEnd.
- void processRegionEnd(DbgRegionEndInst *DRE);
-
/// processDeclare - Process DbgDeclareInst.
void processDeclare(DbgDeclareInst *DDI);
+ /// processLocation - Process DILocation.
+ void processLocation(DILocation Loc);
+
/// addCompileUnit - Add compile unit into CUs.
bool addCompileUnit(DICompileUnit CU);
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 17aaf95..2e149d5 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -310,7 +310,6 @@ public:
if (DomTreeNodes.size() != OtherDomTreeNodes.size())
return true;
- SmallPtrSet<const NodeT *,4> MyBBs;
for (typename DomTreeNodeMapType::const_iterator
I = this->DomTreeNodes.begin(),
E = this->DomTreeNodes.end(); I != E; ++I) {
diff --git a/include/llvm/Analysis/IVUsers.h b/include/llvm/Analysis/IVUsers.h
index 948c675..22fbb35 100644
--- a/include/llvm/Analysis/IVUsers.h
+++ b/include/llvm/Analysis/IVUsers.h
@@ -161,6 +161,10 @@ public:
void addUser(const SCEV *Offset, Instruction *User, Value *Operand) {
Users.push_back(new IVStrideUse(this, Offset, User, Operand));
}
+
+ void removeUser(IVStrideUse *User) {
+ Users.erase(User);
+ }
};
class IVUsers : public LoopPass {
@@ -201,6 +205,9 @@ public:
/// return true. Otherwise, return false.
bool AddUsersIfInteresting(Instruction *I);
+ void AddUser(const SCEV *Stride, const SCEV *Offset,
+ Instruction *User, Value *Operand);
+
/// getReplacementExpr - Return a SCEV expression which computes the
/// value of the OperandValToReplace of the given IVStrideUse.
const SCEV *getReplacementExpr(const IVStrideUse &U) const;
diff --git a/include/llvm/Analysis/InstructionSimplify.h b/include/llvm/Analysis/InstructionSimplify.h
new file mode 100644
index 0000000..aa5c0f5
--- /dev/null
+++ b/include/llvm/Analysis/InstructionSimplify.h
@@ -0,0 +1,74 @@
+//===-- InstructionSimplify.h - Fold instructions into simpler forms ------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares routines for folding instructions into simpler forms that
+// do not require creating new instructions. For example, this does constant
+// folding, and can handle identities like (X&0)->0.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
+#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
+
+namespace llvm {
+ class Instruction;
+ class Value;
+ class TargetData;
+
+ /// SimplifyAndInst - Given operands for an And, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyAndInst(Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyOrInst - Given operands for an Or, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyOrInst(Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyICmpInst - Given operands for an ICmpInst, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyFCmpInst - Given operands for an FCmpInst, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+
+ //=== Helper functions for higher up the class hierarchy.
+
+
+ /// SimplifyCmpInst - Given operands for a CmpInst, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyBinOp - Given operands for a BinaryOperator, see if we can
+ /// fold the result. If not, this returns null.
+ Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
+ const TargetData *TD = 0);
+
+ /// SimplifyInstruction - See if we can compute a simplified version of this
+ /// instruction. If not, this returns null.
+ Value *SimplifyInstruction(Instruction *I, const TargetData *TD = 0);
+
+
+ /// ReplaceAndSimplifyAllUses - Perform From->replaceAllUsesWith(To) and then
+ /// delete the From instruction. In addition to a basic RAUW, this does a
+ /// recursive simplification of the updated instructions. This catches
+ /// things where one simplification exposes other opportunities. This only
+ /// simplifies and deletes scalar operations, it does not change the CFG.
+ ///
+ void ReplaceAndSimplifyAllUses(Instruction *From, Value *To,
+ const TargetData *TD = 0);
+} // end namespace llvm
+
+#endif
+
diff --git a/include/llvm/Analysis/LazyValueInfo.h b/include/llvm/Analysis/LazyValueInfo.h
new file mode 100644
index 0000000..566788d
--- /dev/null
+++ b/include/llvm/Analysis/LazyValueInfo.h
@@ -0,0 +1,73 @@
+//===- LazyValueInfo.h - Value constraint analysis --------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the interface for lazy computation of value constraint
+// information.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_LIVEVALUES_H
+#define LLVM_ANALYSIS_LIVEVALUES_H
+
+#include "llvm/Pass.h"
+
+namespace llvm {
+ class Constant;
+ class TargetData;
+ class Value;
+
+/// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
+/// information.
+class LazyValueInfo : public FunctionPass {
+ class TargetData *TD;
+ void *PImpl;
+ LazyValueInfo(const LazyValueInfo&); // DO NOT IMPLEMENT.
+ void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT.
+public:
+ static char ID;
+ LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
+ ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
+
+ /// Tristate - This is used to return true/false/dunno results.
+ enum Tristate {
+ Unknown = -1, False = 0, True = 1
+ };
+
+
+ // Public query interface.
+
+ /// getPredicateOnEdge - Determine whether the specified value comparison
+ /// with a constant is known to be true or false on the specified CFG edge.
+ /// Pred is a CmpInst predicate.
+ Tristate getPredicateOnEdge(unsigned Pred, Value *V, Constant *C,
+ BasicBlock *FromBB, BasicBlock *ToBB);
+
+
+ /// getConstant - Determine whether the specified value is known to be a
+ /// constant at the end of the specified block. Return null if not.
+ Constant *getConstant(Value *V, BasicBlock *BB);
+
+ /// getConstantOnEdge - Determine whether the specified value is known to be a
+ /// constant on the specified edge. Return null if not.
+ Constant *getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB);
+
+
+ // Implementation boilerplate.
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+ virtual void releaseMemory();
+ virtual bool runOnFunction(Function &F);
+};
+
+} // end namespace llvm
+
+#endif
+
diff --git a/include/llvm/Analysis/LiveValues.h b/include/llvm/Analysis/LiveValues.h
index 31b00d7..b92cb78 100644
--- a/include/llvm/Analysis/LiveValues.h
+++ b/include/llvm/Analysis/LiveValues.h
@@ -94,10 +94,6 @@ public:
bool isKilledInBlock(const Value *V, const BasicBlock *BB);
};
-/// createLiveValuesPass - This creates an instance of the LiveValues pass.
-///
-FunctionPass *createLiveValuesPass();
-
-}
+} // end namespace llvm
#endif
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index bc87adb..6504bdc 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -114,8 +114,8 @@ public:
block_iterator block_begin() const { return Blocks.begin(); }
block_iterator block_end() const { return Blocks.end(); }
- /// isLoopExiting - True if terminator in the block can branch to another block
- /// that is outside of the current loop.
+ /// isLoopExiting - True if terminator in the block can branch to another
+ /// block that is outside of the current loop.
///
bool isLoopExiting(const BlockT *BB) const {
typedef GraphTraits<BlockT*> BlockTraits;
@@ -572,6 +572,10 @@ public:
/// normal form.
bool isLoopSimplifyForm() const;
+ /// hasDedicatedExits - Return true if no exit block for the loop
+ /// has a predecessor that is outside the loop.
+ bool hasDedicatedExits() const;
+
/// getUniqueExitBlocks - Return all unique successor blocks of this loop.
/// These are the blocks _outside of the current loop_ which are branched to.
/// This assumes that loop is in canonical form.
diff --git a/include/llvm/Analysis/MemoryBuiltins.h b/include/llvm/Analysis/MemoryBuiltins.h
index fde7dc6..f6fa0c8 100644
--- a/include/llvm/Analysis/MemoryBuiltins.h
+++ b/include/llvm/Analysis/MemoryBuiltins.h
@@ -17,7 +17,6 @@
namespace llvm {
class CallInst;
-class LLVMContext;
class PointerType;
class TargetData;
class Type;
@@ -29,54 +28,52 @@ class Value;
/// isMalloc - Returns true if the value is either a malloc call or a bitcast of
/// the result of a malloc call
-bool isMalloc(const Value* I);
+bool isMalloc(const Value *I);
/// extractMallocCall - Returns the corresponding CallInst if the instruction
/// is a malloc call. Since CallInst::CreateMalloc() only creates calls, we
/// ignore InvokeInst here.
-const CallInst* extractMallocCall(const Value* I);
-CallInst* extractMallocCall(Value* I);
+const CallInst *extractMallocCall(const Value *I);
+CallInst *extractMallocCall(Value *I);
/// extractMallocCallFromBitCast - Returns the corresponding CallInst if the
/// instruction is a bitcast of the result of a malloc call.
-const CallInst* extractMallocCallFromBitCast(const Value* I);
-CallInst* extractMallocCallFromBitCast(Value* I);
+const CallInst *extractMallocCallFromBitCast(const Value *I);
+CallInst *extractMallocCallFromBitCast(Value *I);
/// isArrayMalloc - Returns the corresponding CallInst if the instruction
/// is a call to malloc whose array size can be determined and the array size
/// is not constant 1. Otherwise, return NULL.
-CallInst* isArrayMalloc(Value* I, LLVMContext &Context, const TargetData* TD);
-const CallInst* isArrayMalloc(const Value* I, LLVMContext &Context,
- const TargetData* TD);
+const CallInst *isArrayMalloc(const Value *I, const TargetData *TD);
/// getMallocType - Returns the PointerType resulting from the malloc call.
/// The PointerType depends on the number of bitcast uses of the malloc call:
/// 0: PointerType is the malloc calls' return type.
/// 1: PointerType is the bitcast's result type.
/// >1: Unique PointerType cannot be determined, return NULL.
-const PointerType* getMallocType(const CallInst* CI);
+const PointerType *getMallocType(const CallInst *CI);
/// getMallocAllocatedType - Returns the Type allocated by malloc call.
/// The Type depends on the number of bitcast uses of the malloc call:
/// 0: PointerType is the malloc calls' return type.
/// 1: PointerType is the bitcast's result type.
/// >1: Unique PointerType cannot be determined, return NULL.
-const Type* getMallocAllocatedType(const CallInst* CI);
+const Type *getMallocAllocatedType(const CallInst *CI);
/// getMallocArraySize - Returns the array size of a malloc call. If the
/// argument passed to malloc is a multiple of the size of the malloced type,
/// then return that multiple. For non-array mallocs, the multiple is
/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be
/// determined.
-Value* getMallocArraySize(CallInst* CI, LLVMContext &Context,
- const TargetData* TD);
+Value *getMallocArraySize(CallInst *CI, const TargetData *TD,
+ bool LookThroughSExt = false);
//===----------------------------------------------------------------------===//
// free Call Utility Functions.
//
/// isFreeCall - Returns true if the the value is a call to the builtin free()
-bool isFreeCall(const Value* I);
+bool isFreeCall(const Value *I);
} // End llvm namespace
diff --git a/include/llvm/Analysis/Passes.h b/include/llvm/Analysis/Passes.h
index 66ab3ea..b222321 100644
--- a/include/llvm/Analysis/Passes.h
+++ b/include/llvm/Analysis/Passes.h
@@ -139,6 +139,12 @@ namespace llvm {
// createLiveValuesPass - This creates an instance of the LiveValues pass.
//
FunctionPass *createLiveValuesPass();
+
+ //===--------------------------------------------------------------------===//
+ //
+ /// createLazyValueInfoPass - This creates an instance of the LazyValueInfo
+ /// pass.
+ FunctionPass *createLazyValueInfoPass();
//===--------------------------------------------------------------------===//
//
diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h
index 915227d..bbdd043 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpander.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpander.h
@@ -38,8 +38,7 @@ namespace llvm {
friend struct SCEVVisitor<SCEVExpander, Value*>;
public:
explicit SCEVExpander(ScalarEvolution &se)
- : SE(se), Builder(se.getContext(),
- TargetFolder(se.TD, se.getContext())) {}
+ : SE(se), Builder(se.getContext(), TargetFolder(se.TD)) {}
/// clear - Erase the contents of the InsertedExpressions map so that users
/// trying to expand the same expression into multiple BasicBlocks or
diff --git a/include/llvm/Analysis/SparsePropagation.h b/include/llvm/Analysis/SparsePropagation.h
index 820e1bd1..677d41d 100644
--- a/include/llvm/Analysis/SparsePropagation.h
+++ b/include/llvm/Analysis/SparsePropagation.h
@@ -153,7 +153,7 @@ public:
/// value. If an value is not in the map, it is returned as untracked,
/// unlike the getOrInitValueState method.
LatticeVal getLatticeState(Value *V) const {
- DenseMap<Value*, LatticeVal>::iterator I = ValueState.find(V);
+ DenseMap<Value*, LatticeVal>::const_iterator I = ValueState.find(V);
return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
}
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index f233608..038d442 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -63,6 +63,15 @@ namespace llvm {
unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0,
unsigned Depth = 0);
+ /// ComputeMultiple - This function computes the integer multiple of Base that
+ /// equals V. If successful, it returns true and returns the multiple in
+ /// Multiple. If unsuccessful, it returns false. Also, if V can be
+ /// simplified to an integer, then the simplified V is returned in Val. Look
+ /// through sext only if LookThroughSExt=true.
+ bool ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,
+ bool LookThroughSExt = false,
+ unsigned Depth = 0);
+
/// CannotBeNegativeZero - Return true if we can prove that the specified FP
/// value is never equal to -0.0.
///
OpenPOWER on IntegriCloud