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


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

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


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

示例1: addCygMingExtraModule

// On Mingw and Cygwin, an external symbol named '__main' is called from the
// generated 'main' function to allow static intialization.  To avoid linking
// problems with remote targets (because lli's remote target support does not
// currently handle external linking) we add a secondary module which defines
// an empty '__main' function.
static void addCygMingExtraModule(ExecutionEngine &EE, LLVMContext &Context,
                                  StringRef TargetTripleStr) {
  IRBuilder<> Builder(Context);
  Triple TargetTriple(TargetTripleStr);

  // Create a new module.
  std::unique_ptr<Module> M = make_unique<Module>("CygMingHelper", Context);
  M->setTargetTriple(TargetTripleStr);

  // Create an empty function named "__main".
  Function *Result;
  if (TargetTriple.isArch64Bit()) {
    Result = Function::Create(
      TypeBuilder<int64_t(void), false>::get(Context),
      GlobalValue::ExternalLinkage, "__main", M.get());
  } else {
    Result = Function::Create(
      TypeBuilder<int32_t(void), false>::get(Context),
      GlobalValue::ExternalLinkage, "__main", M.get());
  }
  BasicBlock *BB = BasicBlock::Create(Context, "__main", Result);
  Builder.SetInsertPoint(BB);
  Value *ReturnVal;
  if (TargetTriple.isArch64Bit())
    ReturnVal = ConstantInt::get(Context, APInt(64, 0));
  else
    ReturnVal = ConstantInt::get(Context, APInt(32, 0));
  Builder.CreateRet(ReturnVal);

  // Add this new module to the ExecutionEngine.
  EE.addModule(std::move(M));
}
开发者ID:OpenKimono,项目名称:llvm,代码行数:37,代码来源:lli.cpp

示例2: initEE

	void initEE(std::unique_ptr<Module> Owner) {
		string ErrStr;
		if (EE == NULL) {
			RTDyldMM = new SectionMemoryManager();
			EE = EngineBuilder(std::move(Owner))
				.setEngineKind(EngineKind::JIT)
				.setErrorStr(&ErrStr)
				.setVerifyModules(true)
				.setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager>(RTDyldMM))
				.setOptLevel(CodeGenOpt::Default)
				.create();

		} else
			EE->addModule(std::move(Owner));
		if (ErrStr.length() != 0)
			cerr << "Create Engine Error" << endl << ErrStr << endl;
		EE->finalizeObject();
	}
开发者ID:elite-lang,项目名称:Elite,代码行数:18,代码来源:PackageJIT.cpp

示例3: initEE

	void initEE(std::unique_ptr<Module> Owner) {
		if (EE == NULL) 
			EE = EngineBuilder(std::move(Owner)).create();
		else 
			EE->addModule(std::move(Owner));
	}
开发者ID:qioixiy,项目名称:Elite,代码行数:6,代码来源:PackageJIT.cpp


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