Clover Git
OpenCL 1.1 software implementation
|
#include <compiler.h>
Public Member Functions | |
Compiler (DeviceInterface *device) | |
Constructor. | |
~Compiler () | |
bool | compile (const std::string &options, llvm::MemoryBuffer *source) |
Compile source to produce a LLVM module. | |
const std::string & | log () const |
Compilation log. | |
const std::string & | options () const |
Options given at compile() | |
bool | optimize () const |
Optimization enabled. | |
llvm::Module * | module () const |
LLVM module generated. | |
void | appendLog (const std::string &log) |
Append a string to the log. | |
Private Attributes | |
DeviceInterface * | p_device |
clang::CompilerInstance | p_compiler |
llvm::Module * | p_module |
bool | p_optimize |
std::string | p_log |
std::string | p_options |
llvm::raw_string_ostream | p_log_stream |
clang::TextDiagnosticPrinter * | p_log_printer |
Compiler using Clang.
This class builds a Clang instance, runs it and then retains compilation logs and produced data.
Definition at line 63 of file compiler.h.
Compiler::Compiler | ( | DeviceInterface * | device | ) |
Constructor.
device | Coal::DeviceInterface for which code will be compiled |
Definition at line 51 of file compiler.cpp.
Compiler::~Compiler | ( | ) |
Definition at line 58 of file compiler.cpp.
void Compiler::appendLog | ( | const std::string & | log | ) |
Append a string to the log.
This function can be used to append linking or code-gen logs to the internal compilation log kept by this class
log | log to be appended |
Definition at line 237 of file compiler.cpp.
Referenced by Coal::Program::build().
bool Compiler::compile | ( | const std::string & | options, |
llvm::MemoryBuffer * | source | ||
) |
Compile source
to produce a LLVM module.
options | options given to the compiler, described in the OpenCL spec |
source | source to be compiled |
Definition at line 63 of file compiler.cpp.
References log(), options(), p_compiler, p_log_printer, p_log_stream, p_module, p_optimize, and p_options.
Referenced by Coal::Program::build(), and main().
const std::string & Compiler::log | ( | ) | const |
Compilation log.
appendLog()
can also be used to append custom info at the end of the log, for instance to keep compilation and linking logs in the same place Definition at line 217 of file compiler.cpp.
References p_log.
Referenced by appendLog(), Coal::Program::build(), Coal::Program::buildInfo(), and compile().
llvm::Module * Compiler::module | ( | ) | const |
LLVM module generated.
Definition at line 232 of file compiler.cpp.
References p_module.
Referenced by Coal::Program::build().
bool Compiler::optimize | ( | ) | const |
Optimization enabled.
Definition at line 227 of file compiler.cpp.
References p_optimize.
Referenced by Coal::Program::build().
const std::string & Compiler::options | ( | ) | const |
Options given at compile()
Definition at line 222 of file compiler.cpp.
References p_options.
Referenced by Coal::Program::buildInfo(), and compile().
clang::CompilerInstance Coal::Compiler::p_compiler [private] |
Definition at line 122 of file compiler.h.
Referenced by compile().
DeviceInterface* Coal::Compiler::p_device [private] |
Definition at line 121 of file compiler.h.
std::string Coal::Compiler::p_log [private] |
Definition at line 126 of file compiler.h.
Referenced by appendLog(), and log().
clang::TextDiagnosticPrinter* Coal::Compiler::p_log_printer [private] |
Definition at line 128 of file compiler.h.
Referenced by compile().
llvm::raw_string_ostream Coal::Compiler::p_log_stream [private] |
Definition at line 127 of file compiler.h.
Referenced by compile().
llvm::Module* Coal::Compiler::p_module [private] |
Definition at line 123 of file compiler.h.
bool Coal::Compiler::p_optimize [private] |
Definition at line 124 of file compiler.h.
Referenced by compile(), and optimize().
std::string Coal::Compiler::p_options [private] |
Definition at line 126 of file compiler.h.