diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-29 00:08:49 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-29 00:08:49 +0800 |
| commit | d4e6ae6f8237f18d9d0b51e7a6404118dffb709f (patch) | |
| tree | eb0969f20e5959866e535ac8fe5c84db55595ab5 /TypeManager.hh | |
| parent | 404afbef3c9223bc44ddd91066c52c44349e43c7 (diff) | |
add pointer and shifting support
Diffstat (limited to 'TypeManager.hh')
| -rw-r--r-- | TypeManager.hh | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/TypeManager.hh b/TypeManager.hh index 9cfed8c..c7543a9 100644 --- a/TypeManager.hh +++ b/TypeManager.hh @@ -16,6 +16,14 @@ class TypeManager { TypeManager(); std::shared_ptr<Type> GetBuiltinType(BuiltinType type); + std::shared_ptr<PointerType> + GetPointerType(std::shared_ptr<Type> ElementType, + const char* CustomName = nullptr); + + std::shared_ptr<FunctionType> + CreateFunctionType(std::shared_ptr<Type> ReturnType, + std::vector<std::shared_ptr<Type>> ArgTypes); + // binary operators may change type std::pair<std::shared_ptr<Type>, Value> CreateOperation(BinaryOperator op, std::shared_ptr<Type> LeftType, @@ -29,13 +37,11 @@ class TypeManager { Value CreateCast(std::shared_ptr<Type> DstType, std::shared_ptr<Type> SrcType, Value v, Context* context); - std::shared_ptr<FunctionType> - CreateFunctionType(std::shared_ptr<Type> ReturnType, - std::vector<std::shared_ptr<Type>> ArgTypes); - private: std::vector<std::shared_ptr<Type>> builtins_; - std::vector<std::shared_ptr<Type>> types_; + std::map<std::shared_ptr<Type>, std::shared_ptr<PointerType>> PointerTypes_; + std::vector<std::shared_ptr<FunctionType>> FunctionTypes_; + std::vector<std::shared_ptr<ArrayType>> ArrayTypes_; // if we are porting to some 64-bit machines, we can change these types to // 64-bit type, in order to make pointers behave correctly |
