Clover Git
OpenCL 1.1 software implementation
Public Member Functions

Coal::DeviceProgram Class Reference

Device-specific program data. More...

#include <deviceinterface.h>

Inheritance diagram for Coal::DeviceProgram:

List of all members.

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.

Detailed Description

Device-specific program data.

Definition at line 214 of file deviceinterface.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
modulellvm::Module containing the program's LLVM IR
Returns:
true in case of success, false otherwise

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.

Parameters:
managerllvm::PassManager to which add the passes
optimizefalse 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.

Warning:
Stdlib currently only works for Coal::CPUDevice, as it contains host-specific code (LLVM IR is not meant to be portable, pointer size changes for example).
Returns:
true if stdlib must be linked with the program

Implemented in Coal::CPUProgram.

Referenced by Coal::Program::build().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines