Lang Hames 0d40b2b30f [Orc] Update the Orc indirection utils and refactor the CompileOnDemand layer.
This patch replaces most of the Orc indirection utils API with a new class:
JITCompileCallbackManager, which creates and manages JIT callbacks.
Exposing this functionality directly allows the user to create callbacks that
are associated with user supplied compilation actions. For example, you can
create a callback to lazyily IR-gen something from an AST. (A kaleidoscope
example demonstrating this will be committed shortly).

This patch also refactors the CompileOnDemand layer to use the
JITCompileCallbackManager API.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17 01:18:38 +00:00

46 lines
1.5 KiB
C++

//===-- CloneSubModule.h - Utilities for extracting sub-modules -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Contains utilities for extracting sub-modules. Useful for breaking up modules
// for lazy jitting.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
#define LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
#include "llvm/ADT/DenseSet.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <functional>
namespace llvm {
class Function;
class GlobalVariable;
class Module;
typedef std::function<void(GlobalVariable &, const GlobalVariable &,
ValueToValueMapTy &)> HandleGlobalVariableFtor;
typedef std::function<void(Function &, const Function &, ValueToValueMapTy &)>
HandleFunctionFtor;
void copyGVInitializer(GlobalVariable &New, const GlobalVariable &Orig,
ValueToValueMapTy &VMap);
void copyFunctionBody(Function &New, const Function &Orig,
ValueToValueMapTy &VMap);
void CloneSubModule(Module &Dst, const Module &Src,
HandleGlobalVariableFtor HandleGlobalVariable,
HandleFunctionFtor HandleFunction, bool KeepInlineAsm);
}
#endif // LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H