/sasl/include/code_generator/llvm/ty_cache.h

https://code.google.com/p/softart/ · C Header · 48 lines · 36 code · 12 blank · 0 comment · 0 complexity · 253b210e2a3f34ad876bb68033dcd36f MD5 · raw file

  1. #ifndef SASL_CODE_GENERATOR_LLVM_TY_CACHE_H
  2. #define SASL_CODE_GENERATOR_LLVM_TY_CACHE_H
  3. #include <sasl/include/code_generator/forward.h>
  4. #include <sasl/enums/builtin_types.h>
  5. #include <sasl/include/code_generator/llvm/cgllvm_service.h>
  6. #include <eflib/include/platform/disable_warnings.h>
  7. #include <llvm/ADT/ArrayRef.h>
  8. #include <llvm/ADT/StringRef.h>
  9. #include <llvm/LLVMContext.h>
  10. #include <llvm/Type.h>
  11. #include <llvm/DerivedTypes.h>
  12. #include <eflib/include/platform/enable_warnings.h>
  13. #include <eflib/include/platform/boost_begin.h>
  14. #include <boost/unordered_map.hpp>
  15. #include <boost/lexical_cast.hpp>
  16. #include <eflib/include/platform/boost_end.h>
  17. #include <string>
  18. #include <vector>
  19. BEGIN_NS_SASL_CODE_GENERATOR();
  20. using namespace llvm;
  21. using boost::unordered_map;
  22. using boost::lexical_cast;
  23. using std::string;
  24. using std::vector;
  25. class ty_cache_t{
  26. public:
  27. Type* type( LLVMContext& ctxt, builtin_types bt, abis abi );
  28. std::string const& name( builtin_types bt, abis abi );
  29. private:
  30. Type* create_ty( LLVMContext& ctxt, builtin_types bt, abis abi );
  31. unordered_map<LLVMContext*, unordered_map<builtin_types, Type*> > cache[4];
  32. unordered_map<builtin_types, std::string> ty_name[4];
  33. };
  34. Type* get_llvm_type( LLVMContext& ctxt, builtin_types bt, abis abi );
  35. END_NS_SASL_CODE_GENERATOR();
  36. #endif