From bff810cc371a38f493d688c54f71013f5a7d53bf Mon Sep 17 00:00:00 2001 From: dhuth Date: Wed, 27 Aug 2014 09:52:06 -0600 Subject: Initial commit --- mem_mapping_utils.hh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 mem_mapping_utils.hh (limited to 'mem_mapping_utils.hh') diff --git a/mem_mapping_utils.hh b/mem_mapping_utils.hh new file mode 100644 index 0000000..8ff0545 --- /dev/null +++ b/mem_mapping_utils.hh @@ -0,0 +1,59 @@ +#ifndef MEM_MAPPING_UTILS_HH +#define MEM_MAPPING_UTILS_HH + +#include +#include +#include +#include "rose.h" + +using namespace SageInterface; +using namespace SageBuilder; + +struct VarDefs; + +class memory_mapping { +private: + bool mem_used; + std::vector< std::string > mapped_array_name; + std::map mapped_symbol; + std::map vardefs; +public: + memory_mapping(); + memory_mapping(bool used, const char* array_name); + void add(const char* array_name); + bool is_mem_used(); + bool is_array_mapped(const char* array_name); + void set_mapped_symbol(const char* array_name, SgVariableSymbol* sym); + void set_vardef(const char* array_name, VarDefs* vardef); + SgVarRefExp* get_mapped_symbol_exp(const char* array_name); + VarDefs* get_vardef(const char* vardef_name); +}; + +//protonu --class introduced to hold texture memory information in one single place +//this might help me get over the weird memory issues I am having with the Loop class +//where someone/something corrupts my memory + +class texture_memory_mapping : public memory_mapping { +private: + std::map devptr_symbol; + // a hack for multi-dimensional texture mapping + //std::map > dims; +public: + texture_memory_mapping ( bool used, const char * array_name); + //texture_memory_mapping (bool used, const char* array_name, int width, int height); + // this function is a hack to get arround a bug + // void add(const char* array_name, int width, int height); + void set_devptr_symbol(const char * array_name, SgVariableSymbol* sym); + SgVarRefExp* get_devptr_symbol_exp(const char * array_name); + //int get_dim_length(const char* array_name, int dim); + //int get_dims(const char* array_name); + texture_memory_mapping(); +}; + +class constant_memory_mapping : public memory_mapping { +public: + constant_memory_mapping(); + constant_memory_mapping(bool used, const char* array_name); +}; + +#endif -- cgit v1.2.3-70-g09d2