GPUOcelot

Translator.h

Go to the documentation of this file.
00001 
00007 #ifndef TRANSLATOR_H_INCLUDED
00008 #define TRANSLATOR_H_INCLUDED
00009 
00010 // Ocelot Includes
00011 #include <ocelot/ir/interface/Instruction.h>
00012 
00013 #include <ocelot/transforms/interface/Pass.h>
00014 
00015 // Hydrazine Includes
00016 #include <hydrazine/implementation/Exception.h>
00017 
00018 namespace ir { class Kernel; }
00019 
00021 namespace translator
00022 {
00023 
00025 class Translator : public transforms::ImmutableKernelPass
00026 {
00027 public:
00029   class Exception : public hydrazine::Exception
00030   {
00031     public:
00032       Exception( const std::string& message );
00033   };
00034 
00036   enum OptimizationLevel
00037   {
00038     NoOptimization = 0x0,
00039     ReportOptimization,
00040     DebugOptimization,
00041     InstrumentOptimization,
00042     MemoryCheckOptimization,
00043     BasicOptimization,
00044     AggressiveOptimization,
00045     SpaceOptimization,
00046     FullOptimization
00047   };
00048 
00049 protected:
00051   OptimizationLevel optimizationLevel;
00052   
00054   ir::Instruction::Architecture sourceArchitecture;
00055   
00057   ir::Instruction::Architecture targetArchitecture;
00058 
00059 public:
00060   static std::string toString( OptimizationLevel level );
00061 
00062 public:
00064   Translator( ir::Instruction::Architecture s, 
00065     ir::Instruction::Architecture t, 
00066     OptimizationLevel l = NoOptimization, int r = Analysis::NoAnalysis,
00067     const std::string& name = "" );
00069   virtual ~Translator();
00070   
00071 public:
00082   virtual ir::Kernel* translate( const ir::Kernel* i ) = 0;
00083 
00084 public:
00086   void initialize( const ir::Module& m );
00088   void runOnKernel( const ir::IRKernel& k );    
00090   void finalize();
00091 
00092 };
00093 
00094 }
00095 
00096 #endif
00097 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines