summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ConstantFolding.h
blob: 4e996f9d089525b367e5c8e2d9b466d3ce5cd0fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
}