-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()->isIntOrIntVector() &&
- "Cannot NEG a nonintegral value!");
- return getNSWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
-}
-
-Constant* ConstantExpr::getNSWAdd(Constant* C1, Constant* C2) {
- return getTy(C1->getType(), Instruction::Add, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant* ConstantExpr::getNSWSub(Constant* C1, Constant* C2) {
- return getTy(C1->getType(), Instruction::Sub, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant* ConstantExpr::getNSWMul(Constant* C1, Constant* C2) {
- return getTy(C1->getType(), Instruction::Mul, C1, C2,
- OverflowingBinaryOperator::NoSignedWrap);
-}
-
-Constant* ConstantExpr::getExactSDiv(Constant* C1, Constant* C2) {
- return getTy(C1->getType(), Instruction::SDiv, C1, C2,
- SDivOperator::IsExact);
-}
-