clang: include/clang/Interpreter/Interpreter.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_INTERPRETER_INTERPRETER_H
15#define LLVM_CLANG_INTERPRETER_INTERPRETER_H
16
20
21#include "llvm/ADT/DenseMap.h"
22#include "llvm/ExecutionEngine/JITSymbol.h"
23#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
24#include "llvm/Support/Error.h"
25#include
26#include
27
28namespace llvm {
29namespace orc {
30class LLJIT;
31class LLJITBuilder;
32class ThreadSafeContext;
33}
34}
35
37
38class CompilerInstance;
39class CodeGenerator;
40class CXXRecordDecl;
41class Decl;
42class IncrementalExecutor;
43class IncrementalParser;
44
45
47public:
49
51 UserArgs = Args;
52 }
53
55
56
58
59
61
62
63 void SetCudaSDK(llvm::StringRef path) { CudaSDKPath = path; };
64
67
68private:
70 create(std::string TT, std::vector<const char *> &ClangArgv);
71
73
74 std::vector<const char *> UserArgs;
75 std::optionalstd::string TargetTriple;
76
78 llvm::StringRef CudaSDKPath;
79};
80
81class IncrementalAction;
82class InProcessPrintingASTConsumer;
83
84
88
89 std::unique_ptrllvm::orc::ThreadSafeContext TSCtx;
90
91 std::unique_ptr Act;
92 std::unique_ptr IncrParser;
93 std::unique_ptr IncrExecutor;
94
95
96 std::unique_ptr DeviceParser;
97
98
99 std::list PTUs;
100
101 unsigned InitPTUSize = 0;
102
103
104
105
107
108
109
110 std::unique_ptrllvm::Module CachedInCodeGenModule;
111
112
113 std::unique_ptr CI;
114
115protected:
116
117 Interpreter(std::unique_ptr Instance, llvm::Error &Err,
118 std::unique_ptrllvm::orc::LLJITBuilder JITBuilder = nullptr,
119 std::unique_ptrclang::ASTConsumer Consumer = nullptr);
120
121
122
124
125
126
128
129public:
132 create(std::unique_ptr CI);
135 std::unique_ptr DCI);
141
145
146
147 llvm::Error Undo(unsigned N = 1);
148
149
151
152
153
154
156
157
160
161
162
165
167 return ValuePrintingInfo;
168 }
169
171
172private:
173 size_t getEffectivePTUSize() const;
174 void markUserCodeStart();
177
179 std::unique_ptrllvm::Module GenModule();
181 std::unique_ptrllvm::Module M = {});
182
183
184
185 llvm::DenseMap<CXXRecordDecl *, llvm::orc::ExecutorAddr> Dtors;
186
188
189 std::unique_ptrllvm::orc::LLJITBuilder JITBuilder;
190};
191}
192
193#endif
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a C++ struct/union/class.
The primary public interface to the Clang code generator.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
This represents one expression.
GlobalDecl - represents a global declaration.
Create a pre-configured CompilerInstance for incremental processing.
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCudaHost()
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCudaDevice()
void SetCompilerArgs(const std::vector< const char * > &Args)
void SetTargetTriple(std::string TT)
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCpp()
IncrementalCompilerBuilder()
void SetCudaSDK(llvm::StringRef path)
void SetOffloadArch(llvm::StringRef Arch)
Provides top-level interfaces for incremental compilation and execution.
llvm::Error ParseAndExecute(llvm::StringRef Code, Value *V=nullptr)
llvm::Error CreateExecutor()
static llvm::Expected< std::unique_ptr< Interpreter > > create(std::unique_ptr< CompilerInstance > CI)
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress(GlobalDecl GD) const
llvm::Error LoadDynamicLibrary(const char *name)
Link a dynamic library.
static llvm::Expected< std::unique_ptr< Interpreter > > createWithCUDA(std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI)
llvm::Expected< PartialTranslationUnit & > Parse(llvm::StringRef Code)
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddressFromLinkerName(llvm::StringRef LinkerName) const
llvm::Error Undo(unsigned N=1)
Undo N previous incremental inputs.
const llvm::SmallVectorImpl< Expr * > & getValuePrintingInfo() const
const CompilerInstance * getCompilerInstance() const
Expr * SynthesizeExpr(Expr *E)
const ASTContext & getASTContext() const
llvm::Expected< llvm::orc::LLJIT & > getExecutionEngine()
llvm::Error Execute(PartialTranslationUnit &T)
The top declaration context.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
The class keeps track of various objects created as part of processing incremental inputs.