From 3e3e2473bf85365593629bd1f6f070d11f0b8ab2 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 13 Oct 2017 22:39:15 -0700 Subject: Get rid of the `-slang-ir-asm` target (#212) * Get rid of the `-slang-ir-asm` target This is really only useful for debugging, so I've replaced the functionality with a `-dump-ir` command line option (which dump's the IR for an entry point before doing codegen). * fixup: use HLSL target, not DXBC, so test can run on Linux --- source/slang/syntax.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'source/slang/syntax.cpp') diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 4dbb6c05b..b863cb707 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -294,6 +294,15 @@ void Type::accept(IValVisitor* visitor, void* extra) declRef)->As(); } + RefPtr Session::getGroupSharedType(RefPtr valueType) + { + RefPtr groupSharedType = new GroupSharedType(); + groupSharedType->setSession(this); + groupSharedType->valueType = valueType; + return groupSharedType; + } + + SyntaxClass Session::findSyntaxClass(Name* name) { SyntaxClass syntaxClass; @@ -337,6 +346,36 @@ void Type::accept(IValVisitor* visitor, void* extra) return baseType->ToString() + "[]"; } + // GroupSharedType + + Slang::String GroupSharedType::ToString() + { + return "@ThreadGroup " + valueType->ToString(); + } + + bool GroupSharedType::EqualsImpl(Type * type) + { + auto t = type->As(); + if (!t) + return false; + return valueType->Equals(t->valueType); + } + + Type* GroupSharedType::CreateCanonicalType() + { + auto canonicalValueType = valueType->GetCanonicalType(); + auto canonicalGroupSharedType = getSession()->getGroupSharedType(canonicalValueType); + session->canonicalTypes.Add(canonicalGroupSharedType); + return canonicalGroupSharedType; + } + + int GroupSharedType::GetHashCode() + { + return combineHash( + valueType->GetHashCode(), + (int)(typeid(this).hash_code())); + } + // DeclRefType String DeclRefType::ToString() -- cgit v1.2.3