• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GET_REF函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GET_REF函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_REF函数的具体用法?C++ GET_REF怎么用?C++ GET_REF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GET_REF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: R_optimizeFunction

SEXP
R_optimizeFunction(SEXP r_func, SEXP r_passMgr)
{
  llvm::legacy::FunctionPassManager *mgr = GET_REF(r_passMgr, legacy::FunctionPassManager);
  llvm::Function *func = GET_REF(r_func, Function);
  return(ScalarLogical(mgr->run(*func)));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:7,代码来源:optimize.cpp


示例2: R_getPassManager

SEXP
R_getPassManager(SEXP r_module, SEXP r_ee)
{
  llvm::Module *TheModule = GET_REF(r_module, Module);
  llvm::ExecutionEngine *TheExecutionEngine = NULL;

  llvm::FunctionPassManager *mgr = new llvm::FunctionPassManager(TheModule);

  if(r_ee != R_NilValue) {
     TheExecutionEngine = GET_REF(r_ee, ExecutionEngine);
     // Set up the optimizer pipeline.  Start with registering info about how the
     // target lays out data structures.
     mgr->add(new llvm::TargetData(*TheExecutionEngine->getTargetData()));
  }

  // Promote allocas to registers.
  mgr->add(llvm::createPromoteMemoryToRegisterPass());
  // Do simple "peephole" optimizations and bit-twiddling optzns.
  mgr->add(llvm::createInstructionCombiningPass());
  // Reassociate expressions.
  mgr->add(llvm::createReassociatePass());
  // Eliminate Common SubExpressions.
  mgr->add(llvm::createGVNPass());
  // Simplify the control flow graph (deleting unreachable blocks, etc).
  mgr->add(llvm::createCFGSimplificationPass());

  mgr->doInitialization();

  return(R_createRef(mgr, "FunctionPassManager"));
}
开发者ID:vsbuffalo,项目名称:Rllvm,代码行数:30,代码来源:optimize.cpp


示例3: R_IRBuilder_createLocalVariable

SEXP
R_IRBuilder_createLocalVariable(SEXP r_builder, SEXP r_type, SEXP r_size, SEXP r_id, SEXP r_beforeTerminator)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);

    llvm::Type *type = GET_TYPE(r_type);
    llvm::AllocaInst *ans;
    
    if(Rf_length(r_size)) {
        llvm::Value *size = GET_REF(r_size, Value);
        ans = new llvm::AllocaInst(type, size, makeTwine(r_id));
    } else
        ans = new llvm::AllocaInst(type, makeTwine(r_id));            

    if(LOGICAL(r_beforeTerminator)[0]) {
        llvm::BasicBlock *block;
        block = builder->GetInsertBlock();
        llvm::TerminatorInst *inst = block->getTerminator();
        if(inst)
            block->getInstList().insert(inst, ans);
        else
            builder->Insert(ans);
    } else    
        ans = builder->Insert(ans);

    if(Rf_length(r_id))
        ans->setName(makeTwine(r_id));

    return(R_createRef(ans, "AllocaInst"));

}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:32,代码来源:IRBuilder.cpp


示例4: R_PassManager_run

SEXP
R_PassManager_run(SEXP r_passMgr, SEXP r_module)
{
  llvm::legacy::PassManager *mgr = GET_REF(r_passMgr, legacy::PassManager);
  llvm::Module *module = GET_REF(r_module, Module);
  return(ScalarLogical(mgr->run(*module)));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:7,代码来源:optimize.cpp


示例5: R_new_DIBuilder_Function

SEXP
R_new_DIBuilder_Function(SEXP r_dibuilder, SEXP r_cu, SEXP r_func, SEXP r_type, SEXP r_lineno)
{
    llvm::DIBuilder *builder;
    builder = GET_REF(r_dibuilder, DIBuilder); 

    llvm::Function *func = GET_REF(r_func, Function); 

    llvm::DICompileUnit *cu;
    cu = GET_REF(r_cu, DICompileUnit); 
    llvm::DIFile* Unit = builder->createFile(cu->getFilename(), cu->getDirectory());

    llvm::DISubroutineType *type;
    type = GET_REF(r_type, DISubroutineType); 

    int lineNo = asInteger(r_lineno);
	
    llvm::DISubprogram* SP = builder->createFunction(
                                       Unit, func->getName(), llvm::StringRef(), Unit, lineNo,
                                       type, false /* internal linkage */,
                                       true /* definition */, lineNo, llvm::DINode::FlagPrototyped, false
#if LLVM_VERSION == 3 && LLVM_MINOR_VERSION < 8
                                   , func
#endif
                               );

    return(R_createRef(SP, "DISubprogram"));
}
开发者ID:duncantl,项目名称:Rllvm,代码行数:28,代码来源:DIBuilder.cpp


示例6: R_DIBuilder_CreateFunctionType

SEXP
R_DIBuilder_CreateFunctionType(SEXP r_builder, SEXP args, SEXP r_cu) 
{
    llvm::SmallVector<llvm::Metadata *, 8>  EltTys;

    llvm::DIBuilder *builder = GET_REF(r_builder, DIBuilder);

    for(R_len_t i = 0; i < Rf_length(args); ++i) {
        llvm::DIType *element=GET_REF(VECTOR_ELT(args,i), DIType);
		//llvm::DITypeRef *element2 = llvm::cast<llvm::DITypeRef >(element);
		//llvm::Value *element3 = llvm::cast<llvm::Value>(element2);
        EltTys.push_back(element);
		//EltTys.push_back(const_cast<llvm::Value*>( (llvm::MDNodeContext, MDs *)element));
    }

    llvm::DITypeRefArray EltTypeArray = builder->getOrCreateTypeArray(EltTys);

#if LLVM_VERSION == 3 && LLVM_MINOR_VERSION < 8
    llvm::DICompileUnit* cu = GET_REF(r_cu, DICompileUnit); 
    llvm::DIFile* file = builder->createFile(cu->getFilename(), cu->getDirectory());
    llvm::DISubroutineType* ans = builder->createSubroutineType(file, EltTypeArray);
#else
    llvm::DISubroutineType* ans = builder->createSubroutineType(EltTypeArray);
#endif

    return R_createRef(ans,"DISubroutineType");
}
开发者ID:duncantl,项目名称:Rllvm,代码行数:27,代码来源:DIBuilder.cpp


示例7: R_ParseAssemblyString

SEXP
R_ParseAssemblyString(SEXP r_str, SEXP r_module, SEXP r_context)
{
    llvm::Module *module;
    llvm::SMDiagnostic err;

    llvm::LLVMContext *context;
    if(Rf_length(r_context))
        context = (GET_REF(r_context, LLVMContext)); // llvm::cast<llvm::LLVMContext> 
    else
        context = & llvm::getGlobalContext();

    if(length(r_module))
        module = GET_REF(r_module, Module); 
    else
        module = NULL;

    const char *text = CHAR(STRING_ELT(r_str, 0));
#if LLVM_VERSION ==3 && LLVM_MINOR_VERSION >= 6
    module = llvm::parseAssemblyString(text, /* module, */ err, *context).release();
#else
    module = llvm::ParseAssemblyString(text, module, err, *context);
#endif
    if(!module) {
	Rprintf("%s\n", err.getLineContents());
	Rprintf("%s\n", err.getMessage());
	PROBLEM  "problem reading assembler code"
            ERROR;
    }
    return(R_createRef(module, "Module"));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:31,代码来源:Module.cpp


示例8: R_PassManagerBase_Add

SEXP
R_PassManagerBase_Add(SEXP r_mgr, SEXP r_pass)
{
    llvm::legacy::PassManagerBase *mgr = GET_REF(r_mgr, legacy::PassManagerBase);
    llvm::Pass *pass = GET_REF(r_pass, Pass);
    mgr->add(pass);
    return(ScalarLogical(TRUE));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:8,代码来源:optimize.cpp


示例9: R_Value_replaceAllUsesWith

SEXP
R_Value_replaceAllUsesWith(SEXP r_val, SEXP r_other)
{
    llvm::Value *val = GET_REF(r_val, Value);
    llvm::Value *other = GET_REF(r_other, Value);
    val->replaceAllUsesWith(other);
    return(R_NilValue);
}
开发者ID:dsidavis,项目名称:Rllvm,代码行数:8,代码来源:Value.cpp


示例10: R_GlobalVariable_setInitializer

SEXP
R_GlobalVariable_setInitializer(SEXP r_var, SEXP r_val)
{
    llvm::GlobalVariable *ans = GET_REF(r_var, GlobalVariable);
    llvm::Constant *val = GET_REF(r_val, Constant);

    ans->setInitializer(val);
    return(ScalarLogical(TRUE));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:9,代码来源:globalVar.cpp


示例11: R_IRBuilder_CreateFNeg

SEXP
R_IRBuilder_CreateFNeg(SEXP r_builder, SEXP r_val)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::Value *val = GET_REF(r_val, Value);
    llvm::Value * ans = builder->CreateFNeg(val);
    return(R_createRef(ans, "Value"));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:9,代码来源:IRBuilder.cpp


示例12: R_IRBuilder_CreateRet

SEXP
R_IRBuilder_CreateRet(SEXP r_builder, SEXP r_val)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::Value *val = GET_REF(r_val, Value);
    llvm::ReturnInst *ret = builder->CreateRet(val);
    return(R_createRef(ret, "ReturnInst"));
} 
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:9,代码来源:IRBuilder.cpp


示例13: R_IRBuilder_SetInsertPoint

SEXP
R_IRBuilder_SetInsertPoint(SEXP r_builder, SEXP r_block)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::BasicBlock *block = GET_REF(r_block, BasicBlock);
    builder->SetInsertPoint(block);

    return(R_NilValue);
} 
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:10,代码来源:IRBuilder.cpp


示例14: R_IRBuilder_CreateBr

SEXP
R_IRBuilder_CreateBr(SEXP r_builder, SEXP r_block)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::BasicBlock *block = GET_REF(r_block, BasicBlock);

    llvm::BranchInst *ans = builder->CreateBr(block);
    return(R_createRef(ans, "BranchInst"));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:10,代码来源:IRBuilder.cpp


示例15: R_IRBuilder_SetInsertPointInstruction

SEXP
R_IRBuilder_SetInsertPointInstruction(SEXP r_builder, SEXP r_block)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::Instruction *ins = GET_REF(r_block, Instruction);
    builder->SetInsertPoint(ins);

    return(R_NilValue);
} 
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:10,代码来源:IRBuilder.cpp


示例16: R_IRBuilder_CreateExtractElement

SEXP
R_IRBuilder_CreateExtractElement(SEXP r_builder, SEXP r_vec, SEXP r_idx)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::Value *val = GET_REF(r_vec, Value);
    llvm::Value *idx = GET_REF(r_idx, Value);
    llvm::Value *ret = builder->CreateExtractElement(val, idx);
    return(R_createRef(ret, "Value"));
} 
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:10,代码来源:IRBuilder.cpp


示例17: R_DIBuilder_CreatePointerType

SEXP
R_DIBuilder_CreatePointerType(SEXP r_builder, SEXP r_type, SEXP r_name) {

    llvm::DIBuilder *builder = GET_REF(r_builder, DIBuilder);
    llvm::DIType *baseType = GET_REF(r_type, DIType);
    const char * name = CHAR(STRING_ELT(r_name, 0));

    llvm::DIType* ans = builder->createPointerType(baseType,sizeof(void*),0,llvm::StringRef(name));

    return(R_createRef(ans,"DIType"));
}
开发者ID:duncantl,项目名称:Rllvm,代码行数:11,代码来源:DIBuilder.cpp


示例18: R_IRBuilder_CreateSwitch

SEXP
R_IRBuilder_CreateSwitch(SEXP r_builder, SEXP r_val, SEXP r_dest, SEXP numCases, SEXP r_id)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::Value *val = GET_REF(r_val, Value);
    llvm::BasicBlock *dest = GET_REF(r_dest, BasicBlock);
    llvm::SwitchInst *ans = builder->CreateSwitch(val, dest, INTEGER(numCases)[0]);

    return(R_createRef(ans, "SwitchInst"));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:11,代码来源:IRBuilder.cpp


示例19: R_SwitchInst_addCases

SEXP
R_SwitchInst_addCases(SEXP r_inst, SEXP r_vals, SEXP r_block)
{
    llvm::SwitchInst *sw = GET_REF(r_inst, SwitchInst);
    for(int i = 0 ; i < Rf_length(r_vals) ; i++) {
        llvm::ConstantInt *val = GET_REF(VECTOR_ELT(r_vals, i), ConstantInt);
        llvm::BasicBlock *block = GET_REF(VECTOR_ELT(r_block, i), BasicBlock);
        sw->addCase(val, block);
    }
    return(ScalarLogical(TRUE));
}
开发者ID:dsidavis,项目名称:Rllvm,代码行数:11,代码来源:Inst.cpp


示例20: R_IRBuilder_CreateSIToFP

SEXP
R_IRBuilder_CreateSIToFP(SEXP r_builder, SEXP r_val, SEXP r_type)
{
    llvm::IRBuilder<> *builder;
    builder = GET_REF(r_builder, IRBuilder<>);
    llvm::Value *val = GET_REF(r_val, Value);
    llvm::Type *type = GET_REF(r_type, Type);

    llvm::Value * ans = builder->CreateSIToFP(val, type);

    return(R_createRef(ans, "Value"));
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:12,代码来源:IRBuilder.cpp



注:本文中的GET_REF函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GET_REG函数代码示例发布时间:2022-05-30
下一篇:
C++ GET_PYCOM_CTOR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap