14#ifndef LLVM_CLANG_INTERPRETER_INTERPRETER_H
15#define LLVM_CLANG_INTERPRETER_INTERPRETER_H
23#include "llvm/ADT/DenseMap.h"
24#include "llvm/ExecutionEngine/JITSymbol.h"
25#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
26#include "llvm/Support/Error.h"
34class ThreadSafeContext;
40class CompilerInstance;
41class IncrementalExecutor;
42class IncrementalParser;
62 void SetCudaSDK(llvm::StringRef path) { CudaSDKPath = path; };
69 create(std::string TT, std::vector<const char *> &ClangArgv);
73 std::vector<const char *> UserArgs;
74 std::optional<std::string> TargetTriple;
77 llvm::StringRef CudaSDKPath;
92 std::unique_ptr<llvm::orc::ThreadSafeContext> TSCtx;
93 std::unique_ptr<IncrementalParser> IncrParser;
94 std::unique_ptr<IncrementalExecutor> IncrExecutor;
95 std::unique_ptr<RuntimeInterfaceBuilder> RuntimeIB;
98 std::unique_ptr<IncrementalParser> DeviceParser;
100 unsigned InitPTUSize = 0;
114 Interpreter(std::unique_ptr<CompilerInstance> CI, llvm::Error &Err,
115 std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder =
nullptr);
135 create(std::unique_ptr<CompilerInstance> CI);
138 std::unique_ptr<CompilerInstance> DCI);
151 llvm::Error
Undo(
unsigned N = 1);
173 return ValuePrintingInfo;
179 size_t getEffectivePTUSize()
const;
180 void markUserCodeStart();
182 llvm::DenseMap<CXXRecordDecl *, llvm::orc::ExecutorAddr> Dtors;
186 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.
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()
void SetCompilerArgs(const std::vector< const char * > &Args)
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCpp()
void SetTargetTriple(std::string TT)
IncrementalCompilerBuilder()
void SetCudaSDK(llvm::StringRef path)
void SetOffloadArch(llvm::StringRef Arch)
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCudaDevice()
Provides top-level interfaces for incremental compilation and execution.
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress(GlobalDecl GD) const
llvm::Error Execute(PartialTranslationUnit &T)
llvm::Expected< llvm::orc::LLJIT & > getExecutionEngine()
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddressFromLinkerName(llvm::StringRef LinkerName) const
static llvm::Expected< std::unique_ptr< Interpreter > > createWithCUDA(std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI)
const CompilerInstance * getCompilerInstance() const
llvm::Expected< llvm::orc::ExecutorAddr > CompileDtorCall(CXXRecordDecl *CXXRD)
llvm::Error LoadDynamicLibrary(const char *name)
Link a dynamic library.
const llvm::SmallVectorImpl< Expr * > & getValuePrintingInfo() const
virtual std::unique_ptr< RuntimeInterfaceBuilder > FindRuntimeInterface()
llvm::Error ParseAndExecute(llvm::StringRef Code, Value *V=nullptr)
Expr * SynthesizeExpr(Expr *E)
llvm::Error CreateExecutor()
static llvm::Expected< std::unique_ptr< Interpreter > > create(std::unique_ptr< CompilerInstance > CI)
llvm::Expected< PartialTranslationUnit & > Parse(llvm::StringRef Code)
llvm::Error Undo(unsigned N=1)
Undo N previous incremental inputs.
const ASTContext & getASTContext() const
Generate glue code between the Interpreter's built-in runtime and user code.
virtual TransformExprFunction * getPrintValueTransformer()=0
virtual ~RuntimeInterfaceBuilder()=default
ExprResult(RuntimeInterfaceBuilder *Builder, Expr *, ArrayRef< Expr * >) TransformExprFunction
The JSON file list parser is used to communicate input to InstallAPI.
ActionResult< Expr * > ExprResult
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.