-Constant *ConstantVector::get(const std::vector<Constant*>& V) {
- assert(!V.empty() && "Cannot infer type if V is empty");
- return get(VectorType::get(V.front()->getType(),V.size()), V);
-}
-
-Constant *ConstantVector::get(Constant *const* Vals, unsigned NumVals) {
- // FIXME: make this the primary ctor method.
- return get(std::vector<Constant*>(Vals, Vals+NumVals));
-}
-
-Constant *ConstantExpr::getNSWNeg(Constant *C) {
- assert(C->getType()->isIntOrIntVectorTy() &&
- "Cannot NEG a nonintegral value!");
- return getNSWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
-}
-
-Constant *ConstantExpr::getNUWNeg(Constant *C) {
- assert(C->getType()->isIntOrIntVectorTy() &&
- "Cannot NEG a nonintegral value!");
- return getNUWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
-}
-
-Constant *ConstantExpr::getNSWAdd(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Add, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant *ConstantExpr::getNUWAdd(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Add, C1, C2,
- OverflowingBinaryOperator::NoUnsignedWrap);
-}
-
-Constant *ConstantExpr::getNSWSub(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Sub, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant *ConstantExpr::getNUWSub(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Sub, C1, C2,
- OverflowingBinaryOperator::NoUnsignedWrap);
-}
-
-Constant *ConstantExpr::getNSWMul(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Mul, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant *ConstantExpr::getNUWMul(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Mul, C1, C2,
- OverflowingBinaryOperator::NoUnsignedWrap);
-}
-
-Constant *ConstantExpr::getNSWShl(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Shl, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant *ConstantExpr::getNUWShl(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::Shl, C1, C2,
- OverflowingBinaryOperator::NoUnsignedWrap);
-}
-
-Constant *ConstantExpr::getExactSDiv(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::SDiv, C1, C2,
- PossiblyExactOperator::IsExact);
-}
-
-Constant *ConstantExpr::getExactUDiv(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::UDiv, C1, C2,
- PossiblyExactOperator::IsExact);
-}
-
-Constant *ConstantExpr::getExactAShr(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::AShr, C1, C2,
- PossiblyExactOperator::IsExact);
-}
-
-Constant *ConstantExpr::getExactLShr(Constant *C1, Constant *C2) {
- return getTy(C1->getType(), Instruction::LShr, C1, C2,
- PossiblyExactOperator::IsExact);
-}
-
-