当前位置: 首页>>代码示例>>C++>>正文


C++ ExecutionEngine::runStaticConstructorsDestructors方法代码示例

本文整理汇总了C++中ExecutionEngine::runStaticConstructorsDestructors方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutionEngine::runStaticConstructorsDestructors方法的具体用法?C++ ExecutionEngine::runStaticConstructorsDestructors怎么用?C++ ExecutionEngine::runStaticConstructorsDestructors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExecutionEngine的用法示例。


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

示例1: run

int run(unique_ptr<Module> module, Chars_const fnName, const vector<string> args) {
  
  check(module, "no module");
  
  Function* entryFn = module->getFunction(fnName);
  check(entryFn, "Source file does not contain a function of the given name");
  
  // Use an EngineBuilder to configure and construct an MCJIT ExecutionEngine.
#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR <= 5
  EngineBuilder builder(module.release());
  builder.setUseMCJIT(true);
#else
  const EngineBuilder builder(move(module));
  const SectionMemoryManager mm;
  builder.setMCJITMemoryManager(&mm);
#endif
  string errorStr;
  builder.setErrorStr(&errorStr);
  builder.setEngineKind(EngineKind::JIT);
  builder.setOptLevel(CodeGenOpt::None);
  
  ExecutionEngine* engine = builder.create();
  
  // Call 'finalizeObject' to notify the JIT that we're ready to execute the jitted code,
  // then run the static constructors.
  engine->finalizeObject();
  engine->runStaticConstructorsDestructors(false);
  
  // Pass the args to the jitted function, and capture the result.
  const int result = engine->runFunctionAsMain(entryFn, args, nullptr);
  engine->runStaticConstructorsDestructors(true); // Run the static destructors.
  return result;
}
开发者ID:gwk,项目名称:llvm-toys,代码行数:33,代码来源:cjit.cpp


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