14#ifndef LLVM_CLANG_INTERPRETER_INTERPRETER_H
15#define LLVM_CLANG_INTERPRETER_INTERPRETER_H
22#include "llvm/ADT/DenseMap.h"
23#include "llvm/ExecutionEngine/JITSymbol.h"
24#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
25#include "llvm/Support/Error.h"
32class ThreadSafeContext;
38class CompilerInstance;
39class IncrementalExecutor;
40class IncrementalParser;
58 void SetCudaSDK(llvm::StringRef path) { CudaSDKPath = path; };
65 create(std::vector<const char *> &ClangArgv);
69 std::vector<const char *> UserArgs;
71 llvm::StringRef OffloadArch;
72 llvm::StringRef CudaSDKPath;
77 std::unique_ptr<llvm::orc::ThreadSafeContext> TSCtx;
78 std::unique_ptr<IncrementalParser> IncrParser;
79 std::unique_ptr<IncrementalExecutor> IncrExecutor;
82 std::unique_ptr<IncrementalParser> DeviceParser;
84 Interpreter(std::unique_ptr<CompilerInstance> CI, llvm::Error &Err);
86 llvm::Error CreateExecutor();
87 unsigned InitPTUSize = 0;
97 create(std::unique_ptr<CompilerInstance> CI);
100 std::unique_ptr<CompilerInstance> DCI);
112 llvm::Error
Undo(
unsigned N = 1);
134 return ValuePrintingInfo;
140 size_t getEffectivePTUSize()
const;
142 bool FindRuntimeInterface();
144 llvm::DenseMap<CXXRecordDecl *, llvm::orc::ExecutorAddr> Dtors;
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()
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
llvm::Error ParseAndExecute(llvm::StringRef Code, Value *V=nullptr)
Expr * SynthesizeExpr(Expr *E)
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
YAML serialization mapping.
The class keeps track of various objects created as part of processing incremental inputs.