Clover Git
OpenCL 1.1 software implementation
|
Device-specific program data. More...
#include <deviceinterface.h>
Public Member Functions | |
DeviceProgram () | |
virtual | ~DeviceProgram () |
virtual bool | linkStdLib () const =0 |
Linking or not stdlib with this program. | |
virtual void | createOptimizationPasses (llvm::PassManager *manager, bool optimize)=0 |
Create device-specific optimization passes. | |
virtual bool | build (llvm::Module *module)=0 |
Build a device-specific representation of the program. |
Device-specific program data.
Definition at line 214 of file deviceinterface.h.
Coal::DeviceProgram::DeviceProgram | ( | ) | [inline] |
Definition at line 217 of file deviceinterface.h.
virtual Coal::DeviceProgram::~DeviceProgram | ( | ) | [inline, virtual] |
Definition at line 218 of file deviceinterface.h.
virtual bool Coal::DeviceProgram::build | ( | llvm::Module * | module | ) | [pure virtual] |
Build a device-specific representation of the program.
This function is called by Coal::Program::build()
when the module is compiled and linked. It can be used by the device to build a device-specific representation of the program.
module | llvm::Module containing the program's LLVM IR |
Implemented in Coal::CPUProgram.
Referenced by Coal::Program::build().
virtual void Coal::DeviceProgram::createOptimizationPasses | ( | llvm::PassManager * | manager, |
bool | optimize | ||
) | [pure virtual] |
Create device-specific optimization passes.
This hook allows a device to add LLVM optimization passes to a llvm::PassManager
. This way, devices needing function flattening or special analysis passes can have them run on the mode.
manager | llvm::PassManager to which add the passes |
optimize | false if -cl-opt-disable was given at compilation time. |
Implemented in Coal::CPUProgram.
Referenced by Coal::Program::build().
virtual bool Coal::DeviceProgram::linkStdLib | ( | ) | const [pure virtual] |
Linking or not stdlib with this program.
stdlib is a LLVM bitcode file containing some implementations of OpenCL C built-ins. This function allows a device to tell Coal::Program::build()
if it wants stdlib to be linked or not.
Linking the library may allow inlining of functions like ceil()
, floor()
, clamp()
, etc. So, if these functions are not better handled by the device itself than by stdlib, it's a good thing to link it.
But if the device provides instructions for these functions, then it could be better not to link stdlib and to replace the LLVM calls to these functions with device-specific instructions.
Coal::CPUDevice
, as it contains host-specific code (LLVM IR is not meant to be portable, pointer size changes for example).Implemented in Coal::CPUProgram.
Referenced by Coal::Program::build().