Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SH::ShTransformer Class Reference

Program transformer. More...

#include <ShTransformer.hpp>

Collaboration diagram for SH::ShTransformer:

Collaboration graph
[legend]
List of all members.

Tuple splitting when backend canot support arbitrary

length tuples.

If any tuples are split, this adds entries to the splits map to map from original long tuple ShVariableNode to a vector of ShVariableNodes all <= max tuple size of the backend. All long tuples in the intermediate representation are split up into shorter tuples.

typedef std::vector< ShVariableNodePtr > VarNodeVec
typedef std::map< ShVariableNodePtr,
VarNodeVec > 
VarSplitMap
void splitTuples (int maxTuple, VarSplitMap &splits)
struct VariableSplitter
struct StatementSplitter

Removes interval arithmetic computation

Converts computations on N-tuple intervals of type T into computation on regular N-tuples of type T.

(Implemented in ShIntervalConverter.?pp)

splits contains a split into exactly 2 new variables for each interval variable encountered

typedef std::map< ShValueType,
ShValueType
ValueTypeMap
void convertIntervalTypes (VarSplitMap &splits)

Input and Output variable to temp convertor

In most GPU shading languages/assembly, outputs cannot be used as src variable in computation and inputs cannot be used as a dest, and inout variables are not supported directly.

Todo:
currently all or none approach to conversion. could parameterize this with flags to choose INPUT, OUTPUT, INOUT


void convertInputOutput ()
struct InputOutputConvertor

Arithmetic type conversions

Converts ops on other basic non-float Sh types to float storage types based on the floatMapping.

For each key k (a type index to convert), in floatMapping, the converter changes it to use floating point type index floatMapping[k].

(Note, the converter does not handle cases where floatMapping[j] exists, but j is also floatMapping[k])

void convertToFloat (ValueTypeMap &typeMap)

Public Member Functions

 ShTransformer (const ShProgramNodePtr &program)
bool changed ()
Texture lookup conversion
Most GPUs only do indexed lookup for rectangular textures, so convert other kinds of lookup with appropriate scales.

void convertTextureLookups ()

Detailed Description

Program transformer.

Platform-specific transformations on ShProgram objects.

These may change the variable lists (inputs, outputs, etc.) and control graph of the ShProgram, so they should be done on a copy of the ShProgram just before code generation instead of the original. (Otherwise, future algebra operations on the original may not give the expected results since the variables will no longer be the same)

Global requirements for running ShTransformer: ShContext::current()->parsing() == program

Definition at line 52 of file ShTransformer.hpp.


The documentation for this class was generated from the following files:
Generated on Mon Jan 24 18:38:25 2005 for Sh by  doxygen 1.4.1