本文整理汇总了C++中IRBuilder::CreateCall4方法的典型用法代码示例。如果您正苦于以下问题:C++ IRBuilder::CreateCall4方法的具体用法?C++ IRBuilder::CreateCall4怎么用?C++ IRBuilder::CreateCall4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRBuilder
的用法示例。
在下文中一共展示了IRBuilder::CreateCall4方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmitFWrite
/// EmitFWrite - Emit a call to the fwrite function. This assumes that Ptr is
/// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
void llvm::EmitFWrite(Value *Ptr, Value *Size, Value *File,
IRBuilder<> &B, const TargetData *TD) {
Module *M = B.GetInsertBlock()->getParent()->getParent();
AttributeWithIndex AWI[3];
AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
AWI[1] = AttributeWithIndex::get(4, Attribute::NoCapture);
AWI[2] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
LLVMContext &Context = B.GetInsertBlock()->getContext();
Constant *F;
if (File->getType()->isPointerTy())
F = M->getOrInsertFunction("fwrite", AttrListPtr::get(AWI, 3),
TD->getIntPtrType(Context),
B.getInt8PtrTy(),
TD->getIntPtrType(Context),
TD->getIntPtrType(Context),
File->getType(), NULL);
else
F = M->getOrInsertFunction("fwrite", TD->getIntPtrType(Context),
B.getInt8PtrTy(),
TD->getIntPtrType(Context),
TD->getIntPtrType(Context),
File->getType(), NULL);
CallInst *CI = B.CreateCall4(F, CastToCStr(Ptr, B), Size,
ConstantInt::get(TD->getIntPtrType(Context), 1), File);
if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
CI->setCallingConv(Fn->getCallingConv());
}
示例2:
void
code_emitter::setup_xy_vars_from_closure ()
{
Value *t_var = lookup_internal(::lookup_internal(filter->v.mathmap.internals, "t", true));
Value *xy_vars_untyped = builder->CreateCall4(module->getFunction(string("calc_closure_xy_vars")),
invocation_arg, closure_arg, t_var, init_frame_function);
xy_vars_var = builder->CreateBitCast(xy_vars_untyped, PointerType::getUnqual(xy_vars_type));
}
示例3: make_int_const
Value*
code_emitter::emit_primary (primary_t *primary, bool need_float)
{
switch (primary->kind)
{
case PRIMARY_VALUE :
if (primary->v.value->index < 0)
{
switch (primary->v.value->compvar->type)
{
case TYPE_INT :
return make_int_const(0);
case TYPE_FLOAT :
return make_float_const(0.0);
case TYPE_IMAGE :
return builder->CreateCall(module->getFunction(string("get_uninited_image")));
default :
g_assert_not_reached();
}
}
else
{
Value *val = lookup_value(primary->v.value);
if (need_float)
val = promote(val, TYPE_FLOAT);
return val;
}
case PRIMARY_CONST :
switch (primary->const_type) {
case TYPE_INT :
if (need_float)
return make_float_const((float)primary->v.constant.int_value);
else
return make_int_const(primary->v.constant.int_value);
case TYPE_FLOAT :
return make_float_const(primary->v.constant.float_value);
case TYPE_COMPLEX :
{
assert(!need_float);
Value *val = builder->CreateCall2(module->getFunction(string("make_complex")),
make_float_const(__real__ primary->v.constant.complex_value),
make_float_const(__imag__ primary->v.constant.complex_value));
return convert_complex_return_value(val);
}
case TYPE_COLOR :
assert(!need_float);
return builder->CreateCall4(module->getFunction(string("make_color")),
make_int_const(RED(primary->v.constant.color_value)),
make_int_const(GREEN(primary->v.constant.color_value)),
make_int_const(BLUE(primary->v.constant.color_value)),
make_int_const(ALPHA(primary->v.constant.color_value)));
default :
g_assert_not_reached();
}
default:
g_assert_not_reached();
}
}