return Type::getInt16Ty(Context);
}
- /// getInt32Ty - Fetch the type resepresenting a 32-bit integer.
+ /// getInt32Ty - Fetch the type representing a 32-bit integer.
IntegerType *getInt32Ty() {
return Type::getInt32Ty(Context);
}
LandingPadInst *CreateLandingPad(Type *Ty, Value *PersFn, unsigned NumClauses,
const Twine &Name = "") {
- return Insert(LandingPadInst::Create(Ty, PersFn, NumClauses, Name));
+ return Insert(LandingPadInst::Create(Ty, PersFn, NumClauses), Name);
}
//===--------------------------------------------------------------------===//
ConstantExpr::getSizeOf(ArgType->getElementType()),
Name);
}
+
+ /// CreateVectorSplat - Return a vector value that contains \arg V broadcasted
+ /// to \p NumElts elements.
+ Value *CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name = "") {
+ assert(NumElts > 0 && "Cannot splat to an empty vector!");
+
+ // First insert it into an undef vector so we can shuffle it.
+ Type *I32Ty = getInt32Ty();
+ Value *Undef = UndefValue::get(VectorType::get(V->getType(), NumElts));
+ V = CreateInsertElement(Undef, V, ConstantInt::get(I32Ty, 0),
+ Name + ".splatinsert");
+
+ // Shuffle the value across the desired number of elements.
+ Value *Zeros = ConstantAggregateZero::get(VectorType::get(I32Ty, NumElts));
+ return CreateShuffleVector(V, Undef, Zeros, Name + ".splat");
+ }
};
}