summaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-30 23:15:43 +0000
committerChris Lattner <sabre@nondot.org>2007-01-30 23:15:43 +0000
commit72d88ae5447a3929c97e88f4c806213847b5d988 (patch)
treee18d963d1439d3d4791d4e42149844a331d306b8 /lib/Analysis/ConstantFolding.cpp
parentcd2492e6ff67d51bafe20412fdb91cb8bcc22095 (diff)
downloadexternal_llvm-72d88ae5447a3929c97e88f4c806213847b5d988.zip
external_llvm-72d88ae5447a3929c97e88f4c806213847b5d988.tar.gz
external_llvm-72d88ae5447a3929c97e88f4c806213847b5d988.tar.bz2
adjust to constant folding api changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33673 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 46f9c57..ef70ece 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -85,23 +85,24 @@ llvm::canConstantFoldCallTo(Function *F) {
}
}
-Constant *
-llvm::ConstantFoldFP(double (*NativeFP)(double), double V, const Type *Ty) {
+static Constant *ConstantFoldFP(double (*NativeFP)(double), double V,
+ const Type *Ty) {
errno = 0;
V = NativeFP(V);
if (errno == 0)
return ConstantFP::get(Ty, V);
+ errno = 0;
return 0;
}
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
/// with the specified arguments, returning null if unsuccessful.
Constant *
-llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
+llvm::ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands) {
const std::string &Name = F->getName();
const Type *Ty = F->getReturnType();
- if (Operands.size() == 1) {
+ if (NumOperands == 1) {
if (ConstantFP *Op = dyn_cast<ConstantFP>(Operands[0])) {
double V = Op->getValue();
switch (Name[0])
@@ -172,7 +173,7 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
else if (Name == "llvm.bswap.i64")
return ConstantInt::get(Ty, ByteSwap_64(V));
}
- } else if (Operands.size() == 2) {
+ } else if (NumOperands == 2) {
if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {
double Op1V = Op1->getValue();
if (ConstantFP *Op2 = dyn_cast<ConstantFP>(Operands[1])) {