45 assert(F &&
"Illegal to upgrade a non-existent Function.");
111 Name ==
"x86.avx.movnt.dq.256" ||
112 Name ==
"x86.avx.movnt.pd.256" ||
113 Name ==
"x86.avx.movnt.ps.256" ||
114 Name ==
"x86.sse42.crc32.64.8" ||
121 if (Name ==
"x86.sse41.ptestc")
123 if (Name ==
"x86.sse41.ptestz")
125 if (Name ==
"x86.sse41.ptestnzc")
185 assert(F &&
"Intrinsic call is not direct?");
193 if (Name.
startswith(
"llvm.x86.sse2.pcmpeq.") ||
199 }
else if (Name.
startswith(
"llvm.x86.sse2.pcmpgt.") ||
205 }
else if (Name ==
"llvm.x86.avx.movnt.dq.256" ||
206 Name ==
"llvm.x86.avx.movnt.ps.256" ||
207 Name ==
"llvm.x86.avx.movnt.pd.256") {
230 }
else if (Name.
startswith(
"llvm.x86.xop.vpcom")) {
275 }
else if (Name ==
"llvm.x86.sse42.crc32.64.8") {
282 bool PD128 =
false, PD256 =
false, PS128 =
false, PS256 =
false;
283 if (Name ==
"llvm.x86.avx.vpermil.pd.256")
285 else if (Name ==
"llvm.x86.avx.vpermil.pd")
287 else if (Name ==
"llvm.x86.avx.vpermil.ps.256")
289 else if (Name ==
"llvm.x86.avx.vpermil.ps")
292 if (PD256 || PD128 || PS256 || PS128) {
294 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
298 for (
unsigned i = 0; i != 2; ++i)
301 for (
unsigned l = 0; l != 4; l+=2)
302 for (
unsigned i = 0; i != 2; ++i)
305 for (
unsigned i = 0; i != 4; ++i)
308 for (
unsigned l = 0; l != 8; l+=4)
309 for (
unsigned i = 0; i != 4; ++i)
335 "Mismatch between function args and call args");
353 "llvm.ctlz." + Name.substr(14)));
405 assert(F &&
"Illegal attempt to upgrade a non-existent intrinsic.");
414 if (
CallInst *CI = dyn_cast<CallInst>(*UI++))
425 assert(MD &&
"UpgradeInstWithTBAATag should have a TBAA tag");
438 ScalarType, ScalarType,
445 Value *Elts[] = {MD, MD,
453 if (Opc != Instruction::BitCast)
474 if (Opc != Instruction::BitCast)
static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn)
void push_back(const T &Elt)
LinkageTypes getLinkage() const
static IntegerType * getInt1Ty(LLVMContext &C)
LLVMContext & getContext() const
size_t size() const
size - Get the string size.
The main container class for the LLVM Intermediate Representation.
unsigned getNumOperands() const
getNumOperands - Return number of MDNode operands.
bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
StringRef substr(size_t Start, size_t N=npos) const
std::string str() const
str - Get the contents as an std::string.
bool isPtrOrPtrVectorTy() const
Type * getReturnType() const
MDNode - a tuple of other values.
static IntegerType * getInt64Ty(LLVMContext &C)
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
void UpgradeIntrinsicCall(CallInst *CI, Function *NewFn)
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
static MDNode * get(LLVMContext &Context, ArrayRef< Value * > Vals)
static Constant * getNullValue(Type *Ty)
StringRef getName() const
Value * getOperand(unsigned i) const LLVM_READONLY
getOperand - Return specified operand.
void UpgradeCallsToIntrinsic(Function *F)
static Type * getFloatTy(LLVMContext &C)
#define llvm_unreachable(msg)
unsigned getNumArgOperands() const
static Constant * get(ArrayRef< Constant * > V)
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
void setName(const Twine &Name)
Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")
static Constant * getPtrToInt(Constant *C, Type *Ty)
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn)
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
void replaceAllUsesWith(Value *V)
static Constant * getIntToPtr(Constant *C, Type *Ty)
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block...
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=0)
Construct any of the CastInst subclasses.
Type * getParamType(unsigned i) const
Parameter type accessors.
unsigned getIntrinsicID() const LLVM_READONLY
LLVM Constant Representation.
LLVMContext & getContext() const
All values hold a context through their type.
void setMetadata(unsigned KindID, MDNode *Node)
static bool UpgradeSSE41Function(Function *F, Intrinsic::ID IID, Function *&NewFn)
Instruction * UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy, Instruction *&Temp)
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
static PointerType * getUnqual(Type *ElementType)
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
bool UpgradeGlobalVariable(GlobalVariable *GV)
MDNode * getMetadata(unsigned KindID) const
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
Function * getCalledFunction() const
Value * getArgOperand(unsigned i) const
ConstantInt * getFalse()
Get the constant value for i1 false.
std::string getName(ID id, ArrayRef< Type * > Tys=None)
static IntegerType * getInt32Ty(LLVMContext &C)
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
FunctionType * getFunctionType() const
virtual void eraseFromParent()
AttributeSet getAttributes(LLVMContext &C, ID id)
void setAttributes(AttributeSet attrs)
Set the attribute list for this Function.
CallInst * CreateCall2(Value *Callee, Value *Arg1, Value *Arg2, const Twine &Name="")
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
LLVM Value Representation.
void setAlignment(unsigned Align)
CallInst * CreateCall(Value *Callee, const Twine &Name="")
static VectorType * get(Type *ElementType, unsigned NumElements)
void UpgradeInstWithTBAATag(Instruction *I)
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
Value * UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy)
unsigned getMDKindID(StringRef Name) const
const BasicBlock * getParent() const
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=0)
CallInst * CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, const Twine &Name="")