/sasl/include/code_generator/llvm/ty_cache.h
C Header | 48 lines | 36 code | 12 blank | 0 comment | 0 complexity | 253b210e2a3f34ad876bb68033dcd36f MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, JSON, MPL-2.0-no-copyleft-exception, GPL-2.0, GPL-3.0, LGPL-3.0, BSD-2-Clause
1#ifndef SASL_CODE_GENERATOR_LLVM_TY_CACHE_H 2#define SASL_CODE_GENERATOR_LLVM_TY_CACHE_H 3 4#include <sasl/include/code_generator/forward.h> 5 6#include <sasl/enums/builtin_types.h> 7#include <sasl/include/code_generator/llvm/cgllvm_service.h> 8 9#include <eflib/include/platform/disable_warnings.h> 10#include <llvm/ADT/ArrayRef.h> 11#include <llvm/ADT/StringRef.h> 12#include <llvm/LLVMContext.h> 13#include <llvm/Type.h> 14#include <llvm/DerivedTypes.h> 15#include <eflib/include/platform/enable_warnings.h> 16 17#include <eflib/include/platform/boost_begin.h> 18#include <boost/unordered_map.hpp> 19#include <boost/lexical_cast.hpp> 20#include <eflib/include/platform/boost_end.h> 21 22#include <string> 23#include <vector> 24 25BEGIN_NS_SASL_CODE_GENERATOR(); 26 27using namespace llvm; 28using boost::unordered_map; 29using boost::lexical_cast; 30using std::string; 31using std::vector; 32 33class ty_cache_t{ 34public: 35 Type* type( LLVMContext& ctxt, builtin_types bt, abis abi ); 36 std::string const& name( builtin_types bt, abis abi ); 37private: 38 Type* create_ty( LLVMContext& ctxt, builtin_types bt, abis abi ); 39 40 unordered_map<LLVMContext*, unordered_map<builtin_types, Type*> > cache[4]; 41 unordered_map<builtin_types, std::string> ty_name[4]; 42}; 43 44Type* get_llvm_type( LLVMContext& ctxt, builtin_types bt, abis abi ); 45 46END_NS_SASL_CODE_GENERATOR(); 47 48#endif