diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-13 23:50:59 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-13 23:50:59 +0000 |
commit | 385396221bc244d6592a60133c55874ff57571ac (patch) | |
tree | 5c41e721e23dbe0259457b526c82a3f74be127a6 | |
parent | 47728a2819b9d0d57b41898d086a1141e54a4c72 (diff) | |
download | external_llvm-385396221bc244d6592a60133c55874ff57571ac.zip external_llvm-385396221bc244d6592a60133c55874ff57571ac.tar.gz external_llvm-385396221bc244d6592a60133c55874ff57571ac.tar.bz2 |
Move more functionality over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75559 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Constants.h | 18 | ||||
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 54 | ||||
-rw-r--r-- | lib/VMCore/LLVMContext.cpp | 36 |
4 files changed, 19 insertions, 91 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 4590528..448a87e 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -692,26 +692,8 @@ public: /// ConstantExpr::get* - Return some common constants without having to /// specify the full Instruction::OPCODE identifier. /// - static Constant *getAdd(Constant *C1, Constant *C2); - static Constant *getFAdd(Constant *C1, Constant *C2); - static Constant *getSub(Constant *C1, Constant *C2); - static Constant *getFSub(Constant *C1, Constant *C2); - static Constant *getMul(Constant *C1, Constant *C2); - static Constant *getFMul(Constant *C1, Constant *C2); - static Constant *getUDiv(Constant *C1, Constant *C2); - static Constant *getSDiv(Constant *C1, Constant *C2); - static Constant *getFDiv(Constant *C1, Constant *C2); - static Constant *getURem(Constant *C1, Constant *C2); // unsigned rem - static Constant *getSRem(Constant *C1, Constant *C2); // signed rem - static Constant *getFRem(Constant *C1, Constant *C2); - static Constant *getAnd(Constant *C1, Constant *C2); - static Constant *getOr(Constant *C1, Constant *C2); - static Constant *getXor(Constant *C1, Constant *C2); static Constant *getICmp(unsigned short pred, Constant *LHS, Constant *RHS); static Constant *getFCmp(unsigned short pred, Constant *LHS, Constant *RHS); - static Constant *getShl(Constant *C1, Constant *C2); - static Constant *getLShr(Constant *C1, Constant *C2); - static Constant *getAShr(Constant *C1, Constant *C2); /// Getelementptr form. std::vector<Value*> is only accepted for convenience: /// all elements must be Constant's. diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 7c3246d..0152a9f 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1722,7 +1722,7 @@ const SCEV *ScalarEvolution::getUDivExpr(const SCEV *LHS, if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) { Constant *LHSCV = LHSC->getValue(); Constant *RHSCV = RHSC->getValue(); - return getConstant(cast<ConstantInt>(ConstantExpr::getUDiv(LHSCV, + return getConstant(cast<ConstantInt>(Context->getConstantExprUDiv(LHSCV, RHSCV))); } } diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 8b71956..390cb7b 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -754,65 +754,11 @@ const SmallVector<unsigned, 4> &ConstantExpr::getIndices() const { return cast<InsertValueConstantExpr>(this)->Indices; } -Constant *ConstantExpr::getAdd(Constant *C1, Constant *C2) { - return get(Instruction::Add, C1, C2); -} -Constant *ConstantExpr::getFAdd(Constant *C1, Constant *C2) { - return get(Instruction::FAdd, C1, C2); -} -Constant *ConstantExpr::getSub(Constant *C1, Constant *C2) { - return get(Instruction::Sub, C1, C2); -} -Constant *ConstantExpr::getFSub(Constant *C1, Constant *C2) { - return get(Instruction::FSub, C1, C2); -} -Constant *ConstantExpr::getMul(Constant *C1, Constant *C2) { - return get(Instruction::Mul, C1, C2); -} -Constant *ConstantExpr::getFMul(Constant *C1, Constant *C2) { - return get(Instruction::FMul, C1, C2); -} -Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2) { - return get(Instruction::UDiv, C1, C2); -} -Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) { - return get(Instruction::SDiv, C1, C2); -} -Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { - return get(Instruction::FDiv, C1, C2); -} -Constant *ConstantExpr::getURem(Constant *C1, Constant *C2) { - return get(Instruction::URem, C1, C2); -} -Constant *ConstantExpr::getSRem(Constant *C1, Constant *C2) { - return get(Instruction::SRem, C1, C2); -} -Constant *ConstantExpr::getFRem(Constant *C1, Constant *C2) { - return get(Instruction::FRem, C1, C2); -} -Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) { - return get(Instruction::And, C1, C2); -} -Constant *ConstantExpr::getOr(Constant *C1, Constant *C2) { - return get(Instruction::Or, C1, C2); -} -Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) { - return get(Instruction::Xor, C1, C2); -} unsigned ConstantExpr::getPredicate() const { assert(getOpcode() == Instruction::FCmp || getOpcode() == Instruction::ICmp); return ((const CompareConstantExpr*)this)->predicate; } -Constant *ConstantExpr::getShl(Constant *C1, Constant *C2) { - return get(Instruction::Shl, C1, C2); -} -Constant *ConstantExpr::getLShr(Constant *C1, Constant *C2) { - return get(Instruction::LShr, C1, C2); -} -Constant *ConstantExpr::getAShr(Constant *C1, Constant *C2) { - return get(Instruction::AShr, C1, C2); -} /// getWithOperandReplaced - Return a constant expression identical to this /// one, but with the specified operand set to the specified value. diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index 8d57d2c..7e43692 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/lib/VMCore/LLVMContext.cpp @@ -293,63 +293,63 @@ Constant* LLVMContext::getConstantExprNot(Constant* C) { } Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) { - return ConstantExpr::getAdd(C1, C2); + return getConstantExpr(Instruction::Add, C1, C2); } Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) { - return ConstantExpr::getFAdd(C1, C2); + return getConstantExpr(Instruction::FAdd, C1, C2); } Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) { - return ConstantExpr::getSub(C1, C2); + return getConstantExpr(Instruction::Sub, C1, C2); } Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) { - return ConstantExpr::getFSub(C1, C2); + return getConstantExpr(Instruction::FSub, C1, C2); } Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) { - return ConstantExpr::getMul(C1, C2); + return getConstantExpr(Instruction::Mul, C1, C2); } Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) { - return ConstantExpr::getFMul(C1, C2); + return getConstantExpr(Instruction::FMul, C1, C2); } Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) { - return ConstantExpr::getUDiv(C1, C2); + return getConstantExpr(Instruction::UDiv, C1, C2); } Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) { - return ConstantExpr::getSDiv(C1, C2); + return getConstantExpr(Instruction::SDiv, C1, C2); } Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) { - return ConstantExpr::getFDiv(C1, C2); + return getConstantExpr(Instruction::FDiv, C1, C2); } Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) { - return ConstantExpr::getURem(C1, C2); + return getConstantExpr(Instruction::URem, C1, C2); } Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) { - return ConstantExpr::getSRem(C1, C2); + return getConstantExpr(Instruction::SRem, C1, C2); } Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) { - return ConstantExpr::getFRem(C1, C2); + return getConstantExpr(Instruction::FRem, C1, C2); } Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) { - return ConstantExpr::getAnd(C1, C2); + return getConstantExpr(Instruction::And, C1, C2); } Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) { - return ConstantExpr::getOr(C1, C2); + return getConstantExpr(Instruction::Or, C1, C2); } Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) { - return ConstantExpr::getXor(C1, C2); + return getConstantExpr(Instruction::Xor, C1, C2); } Constant* LLVMContext::getConstantExprICmp(unsigned short pred, Constant* LHS, @@ -363,15 +363,15 @@ Constant* LLVMContext::getConstantExprFCmp(unsigned short pred, Constant* LHS, } Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) { - return ConstantExpr::getShl(C1, C2); + return getConstantExpr(Instruction::Shl, C1, C2); } Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) { - return ConstantExpr::getLShr(C1, C2); + return getConstantExpr(Instruction::LShr, C1, C2); } Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) { - return ConstantExpr::getAShr(C1, C2); + return getConstantExpr(Instruction::AShr, C1, C2); } Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, |