14#ifndef LLVM_CLANG_INTERPRETER_INTERPRETER_H
15#define LLVM_CLANG_INTERPRETER_INTERPRETER_H
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"
32class ThreadSafeContext;
38class CompilerInstance;
42class IncrementalExecutor;
43class IncrementalParser;
63 void SetCudaSDK(llvm::StringRef path) { CudaSDKPath = path; };
70 create(std::string TT, std::vector<const char *> &ClangArgv);
74 std::vector<const char *> UserArgs;
75 std::optional<std::string> TargetTriple;
78 llvm::StringRef CudaSDKPath;
81class IncrementalAction;
82class InProcessPrintingASTConsumer;
89 std::unique_ptr<llvm::orc::ThreadSafeContext> TSCtx;
91 std::unique_ptr<IncrementalAction> Act;
92 std::unique_ptr<IncrementalParser> IncrParser;
93 std::unique_ptr<IncrementalExecutor> IncrExecutor;
96 std::unique_ptr<IncrementalParser> DeviceParser;
99 std::list<PartialTranslationUnit> PTUs;
101 unsigned InitPTUSize = 0;
110 std::unique_ptr<llvm::Module> CachedInCodeGenModule;
113 std::unique_ptr<CompilerInstance> CI;
117 Interpreter(std::unique_ptr<CompilerInstance> Instance, llvm::Error &Err,
118 std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder =
nullptr,
119 std::unique_ptr<clang::ASTConsumer> Consumer =
nullptr);
132 create(std::unique_ptr<CompilerInstance> CI);
135 std::unique_ptr<CompilerInstance> DCI);
147 llvm::Error
Undo(
unsigned N = 1);
167 return ValuePrintingInfo;
173 size_t getEffectivePTUSize()
const;
174 void markUserCodeStart();
179 std::unique_ptr<llvm::Module> GenModule();
181 std::unique_ptr<llvm::Module> M = {});
185 llvm::DenseMap<CXXRecordDecl *, llvm::orc::ExecutorAddr> Dtors;
189 std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder;
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.