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/val-defs.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'source/slang/val-defs.h') diff --git a/source/slang/val-defs.h b/source/slang/val-defs.h index d83cda85c..1a277c60c 100644 --- a/source/slang/val-defs.h +++ b/source/slang/val-defs.h @@ -85,9 +85,6 @@ END_SYNTAX_CLASS() ABSTRACT_SYNTAX_CLASS(SubtypeWitness, Witness) FIELD(RefPtr, sub) FIELD(RefPtr, sup) - RAW( - virtual DeclRef getLastStepDeclRef() = 0; - ) END_SYNTAX_CLASS() SYNTAX_CLASS(TypeEqualityWitness, SubtypeWitness) @@ -96,10 +93,6 @@ RAW( virtual String ToString() override; virtual int GetHashCode() override; virtual RefPtr SubstituteImpl(SubstitutionSet subst, int * ioDiff) override; - virtual DeclRef getLastStepDeclRef() override - { - return DeclRef(); - } ) END_SYNTAX_CLASS() // A witness that one type is a subtype of another @@ -111,10 +104,6 @@ RAW( virtual String ToString() override; virtual int GetHashCode() override; virtual RefPtr SubstituteImpl(SubstitutionSet subst, int * ioDiff) override; - virtual DeclRef getLastStepDeclRef() override - { - return declRef; - } ) END_SYNTAX_CLASS() @@ -124,31 +113,11 @@ SYNTAX_CLASS(TransitiveSubtypeWitness, SubtypeWitness) FIELD(RefPtr, subToMid); // Witness that `mid : sup` - FIELD(RefPtr, midToSup); + FIELD(DeclRef, midToSup); RAW( virtual bool EqualsVal(Val* val) override; virtual String ToString() override; virtual int GetHashCode() override; virtual RefPtr SubstituteImpl(SubstitutionSet subst, int * ioDiff) override; - virtual DeclRef getLastStepDeclRef() override - { - return midToSup->getLastStepDeclRef(); - } -) -END_SYNTAX_CLASS() - -// A value that is used as a proxy when we need to -// put an IR-level value into AST types -SYNTAX_CLASS(IRProxyVal, Val) - FIELD(IRUse, inst) -RAW( - virtual bool EqualsVal(Val* val) override; - virtual String ToString() override; - virtual int GetHashCode() override; - ~IRProxyVal() override - { - inst.clear(); - } ) END_SYNTAX_CLASS() - -- cgit v1.2.3