}
Constant* LLVMContext::getAllOnesValue(const Type* Ty) {
- return Constant::getAllOnesValue(Ty);
+ if (const IntegerType* ITy = dyn_cast<IntegerType>(Ty))
+ return getConstantInt(APInt::getAllOnesValue(ITy->getBitWidth()));
+
+ std::vector<Constant*> Elts;
+ const VectorType* VTy = cast<VectorType>(Ty);
+ Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType()));
+ assert(Elts[0] && "Not a vector integer type!");
+ return cast<ConstantVector>(getConstantVector(Elts));
}
// UndefValue accessors.
return ConstantInt::get(Ty, V);
}
-ConstantInt* LLVMContext::getConstantIntAllOnesValue(const Type* Ty) {
- return ConstantInt::getAllOnesValue(Ty);
-}
-
-
// ConstantPointerNull accessors.
ConstantPointerNull* LLVMContext::getConstantPointerNull(const PointerType* T) {
return ConstantPointerNull::get(T);
}
Constant* LLVMContext::getConstantExprNot(Constant* C) {
- return ConstantExpr::getNot(C);
+ assert(C->getType()->isIntOrIntVector() &&
+ "Cannot NOT a nonintegral value!");
+ return getConstantExpr(Instruction::Xor, C, getAllOnesValue(C->getType()));
}
Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) {
return ConstantVector::get(Vals, NumVals);
}
-ConstantVector* LLVMContext::getConstantVectorAllOnesValue(
- const VectorType* Ty) {
- return ConstantVector::getAllOnesValue(Ty);
-}
-
// MDNode accessors
MDNode* LLVMContext::getMDNode(Value* const* Vals, unsigned NumVals) {
return MDNode::get(Vals, NumVals);