summaryrefslogtreecommitdiffstats
path: root/include/llvm/Transforms
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
committerdim <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
commit5d5cc59cc77afe655b3707cb0e69e0827b444cad (patch)
tree36453626c792cccd91f783a38a169d610a6b9db9 /include/llvm/Transforms
parent786a18553586229ad99ecb5ecde8a9d914c45e27 (diff)
downloadFreeBSD-src-5d5cc59cc77afe655b3707cb0e69e0827b444cad.zip
FreeBSD-src-5d5cc59cc77afe655b3707cb0e69e0827b444cad.tar.gz
Vendor import of llvm r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/llvm/branches/release_28@114020 Approved by: rpaulo (mentor)
Diffstat (limited to 'include/llvm/Transforms')
-rw-r--r--include/llvm/Transforms/IPO.h5
-rw-r--r--include/llvm/Transforms/IPO/InlinerPass.h4
-rw-r--r--include/llvm/Transforms/Scalar.h39
-rw-r--r--include/llvm/Transforms/Utils/Cloning.h15
-rw-r--r--include/llvm/Transforms/Utils/Local.h2
-rw-r--r--include/llvm/Transforms/Utils/SSAUpdater.h18
-rw-r--r--include/llvm/Transforms/Utils/SSI.h93
-rw-r--r--include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h2
-rw-r--r--include/llvm/Transforms/Utils/ValueMapper.h31
9 files changed, 78 insertions, 131 deletions
diff --git a/include/llvm/Transforms/IPO.h b/include/llvm/Transforms/IPO.h
index 8fb4b63..0de1003 100644
--- a/include/llvm/Transforms/IPO.h
+++ b/include/llvm/Transforms/IPO.h
@@ -93,8 +93,7 @@ ModulePass *createGlobalDCEPass();
/// possible, except for the global values specified.
///
ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
- deleteFn = false,
- bool relinkCallees = false);
+ deleteFn = false);
//===----------------------------------------------------------------------===//
/// createFunctionInliningPass - Return a new pass object that uses a heuristic
@@ -181,7 +180,7 @@ Pass *createSingleLoopExtractorPass();
/// createBlockExtractorPass - This pass extracts all blocks (except those
/// specified in the argument list) from the functions in the module.
///
-ModulePass *createBlockExtractorPass(const std::vector<BasicBlock*> &BTNE);
+ModulePass *createBlockExtractorPass();
/// createStripDeadPrototypesPass - This pass removes any function declarations
/// (prototypes) that are not used.
diff --git a/include/llvm/Transforms/IPO/InlinerPass.h b/include/llvm/Transforms/IPO/InlinerPass.h
index 6af7ed7..3ac4c59 100644
--- a/include/llvm/Transforms/IPO/InlinerPass.h
+++ b/include/llvm/Transforms/IPO/InlinerPass.h
@@ -30,8 +30,8 @@ namespace llvm {
/// perform the inlining operations that do not depend on the policy.
///
struct Inliner : public CallGraphSCCPass {
- explicit Inliner(void *ID);
- explicit Inliner(void *ID, int Threshold);
+ explicit Inliner(char &ID);
+ explicit Inliner(char &ID, int Threshold);
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index 0d338b5..0c35d7e 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -149,7 +149,6 @@ Pass *createLoopIndexSplitPass();
// ret i32 %Y
//
FunctionPass *createPromoteMemoryToRegisterPass();
-extern const PassInfo *const PromoteMemoryToRegisterID;
//===----------------------------------------------------------------------===//
//
@@ -158,7 +157,7 @@ extern const PassInfo *const PromoteMemoryToRegisterID;
// hacking easier.
//
FunctionPass *createDemoteRegisterToMemoryPass();
-extern const PassInfo *const DemoteRegisterToMemoryID;
+extern char &DemoteRegisterToMemoryID;
//===----------------------------------------------------------------------===//
//
@@ -202,7 +201,7 @@ FunctionPass *createCFGSimplificationPass();
// (set, immediate dominators, tree, and frontier) information.
//
FunctionPass *createBreakCriticalEdgesPass();
-extern const PassInfo *const BreakCriticalEdgesID;
+extern char &BreakCriticalEdgesID;
//===----------------------------------------------------------------------===//
//
@@ -213,7 +212,7 @@ extern const PassInfo *const BreakCriticalEdgesID;
// AU.addRequiredID(LoopSimplifyID);
//
Pass *createLoopSimplifyPass();
-extern const PassInfo *const LoopSimplifyID;
+extern char &LoopSimplifyID;
//===----------------------------------------------------------------------===//
//
@@ -228,7 +227,7 @@ FunctionPass *createTailCallEliminationPass();
// chained binary branch instructions.
//
FunctionPass *createLowerSwitchPass();
-extern const PassInfo *const LowerSwitchID;
+extern char &LowerSwitchID;
//===----------------------------------------------------------------------===//
//
@@ -243,7 +242,7 @@ extern const PassInfo *const LowerSwitchID;
FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0);
FunctionPass *createLowerInvokePass(const TargetLowering *TLI,
bool useExpensiveEHSupport);
-extern const PassInfo *const LowerInvokePassID;
+extern char &LowerInvokePassID;
//===----------------------------------------------------------------------===//
//
@@ -258,7 +257,7 @@ FunctionPass *createBlockPlacementPass();
// optimizations.
//
Pass *createLCSSAPass();
-extern const PassInfo *const LCSSAID;
+extern char &LCSSAID;
//===----------------------------------------------------------------------===//
//
@@ -304,39 +303,31 @@ FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0);
// InstructionNamer - Give any unnamed non-void instructions "tmp" names.
//
FunctionPass *createInstructionNamerPass();
-extern const PassInfo *const InstructionNamerID;
+extern char &InstructionNamerID;
//===----------------------------------------------------------------------===//
//
-// SSI - This pass converts instructions to Static Single Information form
-// on demand.
-//
-FunctionPass *createSSIPass();
-
-//===----------------------------------------------------------------------===//
-//
-// SSI - This pass converts every non-void instuction to Static Single
-// Information form.
+// GEPSplitter - Split complex GEPs into simple ones
//
-FunctionPass *createSSIEverythingPass();
+FunctionPass *createGEPSplitterPass();
//===----------------------------------------------------------------------===//
//
-// GEPSplitter - Split complex GEPs into simple ones
+// Sink - Code Sinking
//
-FunctionPass *createGEPSplitterPass();
+FunctionPass *createSinkingPass();
//===----------------------------------------------------------------------===//
//
-// ABCD - Elimination of Array Bounds Checks on Demand
+// LowerAtomic - Lower atomic intrinsics to non-atomic form
//
-FunctionPass *createABCDPass();
+Pass *createLowerAtomicPass();
//===----------------------------------------------------------------------===//
//
-// Sink - Code Sinking
+// ValuePropagation - Propagate CFG-derived value information
//
-FunctionPass *createSinkingPass();
+Pass *createCorrelatedValuePropagationPass();
} // End llvm namespace
diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h
index 1ca4981..62bf92a 100644
--- a/include/llvm/Transforms/Utils/Cloning.h
+++ b/include/llvm/Transforms/Utils/Cloning.h
@@ -121,8 +121,12 @@ Loop *CloneLoop(Loop *L, LPPassManager *LPM, LoopInfo *LI,
/// the function from their old to new values. The final argument captures
/// information about the cloned code if non-null.
///
+/// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue
+/// mappings.
+///
Function *CloneFunction(const Function *F,
ValueMap<const Value*, Value*> &VMap,
+ bool ModuleLevelChanges,
ClonedCodeInfo *CodeInfo = 0);
/// CloneFunction - Version of the function that doesn't need the VMap.
@@ -133,13 +137,17 @@ inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){
}
/// Clone OldFunc into NewFunc, transforming the old arguments into references
-/// to ArgMap values. Note that if NewFunc already has basic blocks, the ones
+/// to VMap values. Note that if NewFunc already has basic blocks, the ones
/// cloned into it will be added to the end of the function. This function
/// fills in a list of return instructions, and can optionally append the
/// specified suffix to all values cloned.
///
+/// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue
+/// mappings.
+///
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
ValueMap<const Value*, Value*> &VMap,
+ bool ModuleLevelChanges,
SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = 0);
@@ -151,8 +159,13 @@ void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
/// constant arguments cause a significant amount of code in the callee to be
/// dead. Since this doesn't produce an exactly copy of the input, it can't be
/// used for things like CloneFunction or CloneModule.
+///
+/// If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue
+/// mappings.
+///
void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
ValueMap<const Value*, Value*> &VMap,
+ bool ModuleLevelChanges,
SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = 0,
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index b277970..caae27f 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -118,8 +118,6 @@ bool EliminateDuplicatePHINodes(BasicBlock *BB);
/// of the CFG. It returns true if a modification was made, possibly deleting
/// the basic block that was pointed to.
///
-/// WARNING: The entry node of a method may not be simplified.
-///
bool SimplifyCFG(BasicBlock *BB, const TargetData *TD = 0);
/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch,
diff --git a/include/llvm/Transforms/Utils/SSAUpdater.h b/include/llvm/Transforms/Utils/SSAUpdater.h
index ca98466..e50a6b1 100644
--- a/include/llvm/Transforms/Utils/SSAUpdater.h
+++ b/include/llvm/Transforms/Utils/SSAUpdater.h
@@ -36,9 +36,11 @@ private:
//typedef DenseMap<BasicBlock*, Value*> AvailableValsTy;
void *AV;
- /// PrototypeValue is an arbitrary representative value, which we derive names
- /// and a type for PHI nodes.
- Value *PrototypeValue;
+ /// ProtoType holds the type of the values being rewritten.
+ const Type *ProtoType;
+
+ // PHI nodes are given a name based on ProtoName.
+ std::string ProtoName;
/// InsertedPHIs - If this is non-null, the SSAUpdater adds all PHI nodes that
/// it creates to the vector.
@@ -51,8 +53,8 @@ public:
~SSAUpdater();
/// Initialize - Reset this object to get ready for a new set of SSA
- /// updates. ProtoValue is the value used to name PHI nodes.
- void Initialize(Value *ProtoValue);
+ /// updates with type 'Ty'. PHI nodes get a name based on 'Name'.
+ void Initialize(const Type *Ty, StringRef Name);
/// AddAvailableValue - Indicate that a rewritten value is available at the
/// end of the specified block with the specified value.
@@ -94,6 +96,12 @@ public:
/// for the use's block will be considered to be below it.
void RewriteUse(Use &U);
+ /// RewriteUseAfterInsertions - Rewrite a use, just like RewriteUse. However,
+ /// this version of the method can rewrite uses in the same block as a
+ /// definition, because it assumes that all uses of a value are below any
+ /// inserted values.
+ void RewriteUseAfterInsertions(Use &U);
+
private:
Value *GetValueAtEndOfBlockInternal(BasicBlock *BB);
diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h
deleted file mode 100644
index 198fc82..0000000
--- a/include/llvm/Transforms/Utils/SSI.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//===------------------- SSI.h - Creates SSI Representation -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This pass converts a list of variables to the Static Single Information
-// form. This is a program representation described by Scott Ananian in his
-// Master Thesis: "The Static Single Information Form (1999)".
-// We are building an on-demand representation, that is, we do not convert
-// every single variable in the target function to SSI form. Rather, we receive
-// a list of target variables that must be converted. We also do not
-// completely convert a target variable to the SSI format. Instead, we only
-// change the variable in the points where new information can be attached
-// to its live range, that is, at branch points.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TRANSFORMS_UTILS_SSI_H
-#define LLVM_TRANSFORMS_UTILS_SSI_H
-
-#include "llvm/InstrTypes.h"
-#include "llvm/Pass.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/SmallVector.h"
-
-namespace llvm {
-
- class DominatorTree;
- class PHINode;
- class Instruction;
- class CmpInst;
-
- class SSI : public FunctionPass {
- public:
- static char ID; // Pass identification, replacement for typeid.
- SSI() :
- FunctionPass(&ID) {
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const;
-
- bool runOnFunction(Function&);
-
- void createSSI(SmallVectorImpl<Instruction *> &value);
-
- private:
- // Variables always live
- DominatorTree *DT_;
-
- // Stores variables created by SSI
- SmallPtrSet<Instruction *, 16> created;
-
- // Phis created by SSI
- DenseMap<PHINode *, Instruction*> phis;
-
- // Sigmas created by SSI
- DenseMap<PHINode *, Instruction*> sigmas;
-
- // Phi nodes that have a phi as operand and has to be fixed
- SmallPtrSet<PHINode *, 1> phisToFix;
-
- // List of definition points for every variable
- DenseMap<Instruction*, SmallVector<BasicBlock*, 4> > defsites;
-
- // Basic Block of the original definition of each variable
- DenseMap<Instruction*, BasicBlock*> value_original;
-
- // Stack of last seen definition of a variable
- DenseMap<Instruction*, SmallVector<Instruction *, 1> > value_stack;
-
- void insertSigmaFunctions(SmallPtrSet<Instruction*, 4> &value);
- void insertSigma(TerminatorInst *TI, Instruction *I);
- void insertPhiFunctions(SmallPtrSet<Instruction*, 4> &value);
- void renameInit(SmallPtrSet<Instruction*, 4> &value);
- void rename(BasicBlock *BB);
-
- void substituteUse(Instruction *I);
- bool dominateAny(BasicBlock *BB, Instruction *value);
- void fixPhis();
-
- Instruction* getPositionPhi(PHINode *PN);
- Instruction* getPositionSigma(PHINode *PN);
-
- void init(SmallVectorImpl<Instruction *> &value);
- void clean();
- };
-} // end namespace
-#endif
diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
index c2d0993..a5060e6 100644
--- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -26,7 +26,7 @@ struct UnifyFunctionExitNodes : public FunctionPass {
BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock;
public:
static char ID; // Pass identification, replacement for typeid
- UnifyFunctionExitNodes() : FunctionPass(&ID),
+ UnifyFunctionExitNodes() : FunctionPass(ID),
ReturnBlock(0), UnwindBlock(0) {}
// We can preserve non-critical-edgeness when we unify function exit nodes
diff --git a/include/llvm/Transforms/Utils/ValueMapper.h b/include/llvm/Transforms/Utils/ValueMapper.h
new file mode 100644
index 0000000..5274112
--- /dev/null
+++ b/include/llvm/Transforms/Utils/ValueMapper.h
@@ -0,0 +1,31 @@
+//===- ValueMapper.h - Remapping for constants and metadata -----*- 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 MapValue interface which is used by various parts of
+// the Transforms/Utils library to implement cloning and linking facilities.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
+#define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
+
+#include "llvm/ADT/ValueMap.h"
+
+namespace llvm {
+ class Value;
+ class Instruction;
+ typedef ValueMap<const Value *, Value *> ValueToValueMapTy;
+
+ Value *MapValue(const Value *V, ValueToValueMapTy &VM,
+ bool ModuleLevelChanges);
+ void RemapInstruction(Instruction *I, ValueToValueMapTy &VM,
+ bool ModuleLevelChanges);
+} // End llvm namespace
+
+#endif
OpenPOWER on IntegriCloud