From baf194e7456ba4568dcf11249896af35b3ce18cc Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 11 Apr 2018 16:18:29 -0700 Subject: Introduce an IR-level type system (#481) * Introduce an IR-level type system Up to this point, the Slang IR has used the front-end type system to represent types in the IR. As a result (but ultimately more importantly) the IR representation of generics and specialization has used AST-level concepts embedded in the IR. For example, to express the specialization of `vector` to a concrete type `float` for `T`, we needed an IR operation that could represent the specialization, with operands that somehow represented the type argument `float`. The whole thing was very complicated. The big idea of this change is to introduce a new representation in which types in the IR are just ordinary instructions, so that using them as operands makes sense. The hierarchy of IR types closely mirrors the AST-side hierarchy for now, and that will probably be something we should maintain going forward. In order to make these changes work, though, I also had to do major overhauls of things like the way substitutions are performed, how we check interface conformances, the way lookup through interface types is done, etc. etc. This is a big change, and unfortunately any attempt to summarize it in the commit message wouldn't do it justice. * Fix 64-bit build warning * Fix up some clang warnings/errors --- source/slang/compiler.h | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'source/slang/compiler.h') diff --git a/source/slang/compiler.h b/source/slang/compiler.h index 7ab47e6b3..703991e36 100644 --- a/source/slang/compiler.h +++ b/source/slang/compiler.h @@ -152,10 +152,7 @@ namespace Slang // where any errors were diagnosed. RefPtr decl; - // The declaration of the global generic parameter types - // This will be filled in as part of semantic analysis. - List> genericParameterTypes; - List> genericParameterWitnesses; + RefPtr globalGenericSubst; }; enum class PassThroughMode : SlangPassThrough @@ -453,7 +450,6 @@ namespace Slang RefPtr coreLanguageScope; RefPtr hlslLanguageScope; RefPtr slangLanguageScope; - RefPtr glslLanguageScope; List> loadedModuleCode; @@ -481,7 +477,6 @@ namespace Slang String getStdlibPath(); String getCoreLibraryCode(); String getHLSLLibraryCode(); - String getGLSLLibraryCode(); // Basic types that we don't want to re-create all the time RefPtr errorType; @@ -508,20 +503,6 @@ namespace Slang Type* getErrorType(); Type* getStringType(); - Type* getConstExprRate(); - RefPtr getRateQualifiedType( - Type* rate, - Type* valueType); - - RefPtr getConstExprType( - Type* valueType) - { - return getRateQualifiedType(getConstExprRate(), valueType); - } - - // Should not be used in front-end code - Type* getIRBasicBlockType(); - // Construct the type `Ptr`, where `Ptr` // is looked up as a builtin type. RefPtr getPtrType(RefPtr valueType); @@ -544,8 +525,6 @@ namespace Slang Type* elementType, IntVal* elementCount); - RefPtr getGroupSharedType(RefPtr valueType); - SyntaxClass findSyntaxClass(Name* name); Dictionary > mapNameToSyntaxClass; -- cgit v1.2.3