本文整理汇总了C++中GET_REF函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_REF函数的具体用法?C++ GET_REF怎么用?C++ GET_REF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_REF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)));
}
示例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"));
}
示例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"));
}
示例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)));
}
示例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"));
}
示例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");
}
示例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"));
}
示例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));
}
示例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);
}
示例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));
}
示例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"));
}
示例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"));
}
示例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);
}
示例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"));
}
示例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);
}