221
|
1 //===--- IncrementalExecutor.h - Incremental Execution ----------*- C++ -*-===//
|
|
2 //
|
|
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
4 // See https://llvm.org/LICENSE.txt for license information.
|
|
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
6 //
|
|
7 //===----------------------------------------------------------------------===//
|
|
8 //
|
|
9 // This file implements the class which performs incremental code execution.
|
|
10 //
|
|
11 //===----------------------------------------------------------------------===//
|
|
12
|
|
13 #ifndef LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
|
|
14 #define LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
|
|
15
|
236
|
16 #include "llvm/ADT/DenseMap.h"
|
221
|
17 #include "llvm/ADT/StringRef.h"
|
|
18 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
252
|
19 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
|
221
|
20
|
|
21 #include <memory>
|
|
22
|
|
23 namespace llvm {
|
|
24 class Error;
|
|
25 namespace orc {
|
|
26 class LLJIT;
|
|
27 class ThreadSafeContext;
|
|
28 } // namespace orc
|
|
29 } // namespace llvm
|
|
30
|
|
31 namespace clang {
|
236
|
32
|
|
33 struct PartialTranslationUnit;
|
|
34 class TargetInfo;
|
|
35
|
221
|
36 class IncrementalExecutor {
|
|
37 using CtorDtorIterator = llvm::orc::CtorDtorIterator;
|
|
38 std::unique_ptr<llvm::orc::LLJIT> Jit;
|
|
39 llvm::orc::ThreadSafeContext &TSCtx;
|
|
40
|
236
|
41 llvm::DenseMap<const PartialTranslationUnit *, llvm::orc::ResourceTrackerSP>
|
|
42 ResourceTrackers;
|
|
43
|
221
|
44 public:
|
236
|
45 enum SymbolNameKind { IRName, LinkerName };
|
|
46
|
221
|
47 IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC, llvm::Error &Err,
|
236
|
48 const clang::TargetInfo &TI);
|
221
|
49 ~IncrementalExecutor();
|
|
50
|
236
|
51 llvm::Error addModule(PartialTranslationUnit &PTU);
|
|
52 llvm::Error removeModule(PartialTranslationUnit &PTU);
|
221
|
53 llvm::Error runCtors() const;
|
236
|
54 llvm::Error cleanUp();
|
252
|
55 llvm::Expected<llvm::orc::ExecutorAddr>
|
236
|
56 getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
|
252
|
57
|
|
58 llvm::orc::LLJIT &GetExecutionEngine() { return *Jit; }
|
221
|
59 };
|
|
60
|
|
61 } // end namespace clang
|
|
62
|
|
63 #endif // LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
|