diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/ConstantFolding.h | 36 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/Local.h | 9 |
2 files changed, 37 insertions, 8 deletions
diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h new file mode 100644 index 0000000..4e996f9 --- /dev/null +++ b/include/llvm/Analysis/ConstantFolding.h @@ -0,0 +1,36 @@ +//===-- ConstantFolding.h - Analyze constant folding possibilities --------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This family of functions determines the possibility of performing constant +// folding. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Constants.h" +#include "llvm/Function.h" +using namespace llvm; + +namespace llvm { + +/// canConstantFoldCallTo - Return true if its even possible to fold a call to +/// the specified function. +extern +bool canConstantFoldCallTo(Function *F); + +/// ConstantFoldFP - Given a function that evaluates the constant, return an +/// LLVM Constant that represents the evaluated constant +extern Constant * +ConstantFoldFP(double (*NativeFP)(double), double V, const Type *Ty); + +/// ConstantFoldCall - Attempt to constant fold a call to the specified function +/// with the specified arguments, returning null if unsuccessful. +extern Constant * +ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands); +} + diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h index 2518315..da1ce25 100644 --- a/include/llvm/Transforms/Utils/Local.h +++ b/include/llvm/Transforms/Utils/Local.h @@ -16,6 +16,7 @@ #define LLVM_TRANSFORMS_UTILS_LOCAL_H #include "llvm/Function.h" +#include "llvm/Analysis/ConstantFolding.h" namespace llvm { @@ -48,14 +49,6 @@ bool ConstantFoldTerminator(BasicBlock *BB); Constant *ConstantFoldInstruction(Instruction *I); -/// canConstantFoldCallTo - Return true if its even possible to fold a call to -/// the specified function. -bool canConstantFoldCallTo(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, const std::vector<Constant*> &Operands); - /// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a /// getelementptr constantexpr, return the constant value being addressed by the /// constant expression, or null if something is funny and we can't decide. |