OmniSciDB
a5dc49c757
|
#include <UdfCompiler.h>
Public Member Functions | |
UdfCompiler (CudaMgr_Namespace::NvidiaDeviceArch target_arch, const std::string &clang_path_override="") | |
UdfCompiler (CudaMgr_Namespace::NvidiaDeviceArch target_arch, const std::string &clang_path_override, const std::vector< std::string > clang_options) | |
std::pair< std::string, std::string > | compileUdf (const std::string &udf_file_name) const |
Static Public Member Functions | |
static std::string | getAstFileName (const std::string &udf_file_name) |
Private Member Functions | |
void | generateAST (const std::string &file_name) const |
std::string | compileToLLVMIR (const std::string &udf_file_name) const |
int | compileFromCommandLine (const std::vector< std::string > &command_line) const |
Static Private Member Functions | |
static std::string | genLLVMIRFilename (const std::string &udf_file_name) |
static std::string | genNVVMIRFilename (const std::string &udf_file_name) |
Private Attributes | |
std::string | clang_path_ |
std::vector< std::string > | clang_options_ |
Driver for calling clang/clang++ to compile C++ programs to LLVM IR for use as a UDF. Default initialization will find Clang using the clang library invocations. An optional clang override and additional arguments to the clang binary can be added. Once initialized the class holds the state for calling clang until destruction.
Definition at line 31 of file UdfCompiler.h.
UdfCompiler::UdfCompiler | ( | CudaMgr_Namespace::NvidiaDeviceArch | target_arch, |
const std::string & | clang_path_override = "" |
||
) |
Definition at line 314 of file UdfCompiler.cpp.
References clang_options_.
UdfCompiler::UdfCompiler | ( | CudaMgr_Namespace::NvidiaDeviceArch | target_arch, |
const std::string & | clang_path_override, | ||
const std::vector< std::string > | clang_options | ||
) |
Definition at line 325 of file UdfCompiler.cpp.
References clang_options_.
|
private |
Formulate the full compile command and call the compiler.
Definition at line 408 of file UdfCompiler.cpp.
References CHECK_EQ, clang_options_, clang_path_, anonymous_namespace{UdfCompiler.cpp}::exec_output(), logger::init(), run_benchmark_import::res, and shared::transform().
Referenced by compileToLLVMIR().
|
private |
Formulate Clang command line command and call clang binary to generate LLVM IR for the C/C++ file.
Definition at line 605 of file UdfCompiler.cpp.
References clang_path_, compileFromCommandLine(), genLLVMIRFilename(), run_benchmark_import::res, and to_string().
Referenced by compileUdf().
std::pair< std::string, std::string > UdfCompiler::compileUdf | ( | const std::string & | udf_file_name | ) | const |
Compile a C++ file to LLVM IR, and generate an AST file. Both artifacts exist as files on disk. Three artifacts will be generated; the AST file, the CPU LLVM IR, and GPU LLVM IR (if CUDA is enabled and compilation succeeds). These LLVM IR files can be loaded by the Executor. The AST will be processed by Calcite.
Definition at line 338 of file UdfCompiler.cpp.
References compileToLLVMIR(), generateAST(), logger::INFO, LOG, and logger::WARNING.
Referenced by DBHandler::initialize().
|
private |
Call clang binary to generate abstract syntax tree file for registration in Calcite.
Definition at line 629 of file UdfCompiler.cpp.
References clang_options_, clang_path_, anonymous_namespace{UdfCompiler.cpp}::convert(), gpu_enabled::copy(), File_Namespace::create(), report::error_code(), logger::init(), anonymous_namespace{UdfCompiler.cpp}::replace_extension(), run_benchmark_import::result, to_string(), ToolingSampleCategory(), and shared::transform().
Referenced by compileUdf().
|
staticprivate |
Definition at line 404 of file UdfCompiler.cpp.
References anonymous_namespace{UdfCompiler.cpp}::remove_file_extension().
Referenced by compileToLLVMIR().
|
staticprivate |
Definition at line 400 of file UdfCompiler.cpp.
References anonymous_namespace{UdfCompiler.cpp}::remove_file_extension().
|
static |
Definition at line 677 of file UdfCompiler.cpp.
References anonymous_namespace{UdfCompiler.cpp}::replace_extension().
Referenced by DBHandler::initialize().
|
private |
Definition at line 73 of file UdfCompiler.h.
Referenced by compileFromCommandLine(), generateAST(), and UdfCompiler().
|
private |
Definition at line 72 of file UdfCompiler.h.
Referenced by compileFromCommandLine(), compileToLLVMIR(), and generateAST().