diff options
author | dhuth <derickhuth@gmail.com> | 2014-08-27 09:52:06 -0600 |
---|---|---|
committer | dhuth <derickhuth@gmail.com> | 2014-08-27 09:52:06 -0600 |
commit | bff810cc371a38f493d688c54f71013f5a7d53bf (patch) | |
tree | fbe86954bb3c01deb21da9e41ebff5baa2889a45 /mem_mapping_utils.hh | |
download | chill-bff810cc371a38f493d688c54f71013f5a7d53bf.tar.gz chill-bff810cc371a38f493d688c54f71013f5a7d53bf.tar.bz2 chill-bff810cc371a38f493d688c54f71013f5a7d53bf.zip |
Initial commit
Diffstat (limited to 'mem_mapping_utils.hh')
-rw-r--r-- | mem_mapping_utils.hh | 59 |
1 files changed, 59 insertions, 0 deletions
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 <vector> +#include <string.h> +#include <map> +#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<std::string, SgVariableSymbol*> mapped_symbol; + std::map<std::string, VarDefs*> 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<std::string, SgVariableSymbol*> devptr_symbol; + // a hack for multi-dimensional texture mapping + //std::map<std::string, std::vector<int> > 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 |