From f216b77752b9e4aea52882b2110ceb1cc64a2171 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 13 Sep 2022 13:11:48 -0700 Subject: Deduplicate AST type nodes and cache lookup operations. (#2397) * wip: dedup AST type nodes and cache lookup. * Fix. * Remove profiling. * Fixes. Co-authored-by: Yong He --- source/core/slang-array.h | 17 +++++++++++++++++ source/core/slang-short-list.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'source/core') diff --git a/source/core/slang-array.h b/source/core/slang-array.h index 2647e163f..8d22e1848 100644 --- a/source/core/slang-array.h +++ b/source/core/slang-array.h @@ -125,6 +125,23 @@ namespace Slang insertArray(rs, args...); return rs; } + + + template + void addToList(TList&) + { + } + template + void addToList(TList& list, T node) + { + list.add(node); + } + template + void addToList(TList& list, T node, TArgs ... args) + { + list.add(node); + addToList(list, args...); + } } #endif diff --git a/source/core/slang-short-list.h b/source/core/slang-short-list.h index 7d51a8abf..5bad9faf8 100644 --- a/source/core/slang-short-list.h +++ b/source/core/slang-short-list.h @@ -288,6 +288,8 @@ namespace Slang void addRange(ArrayView list) { addRange(list.m_buffer, list.m_count); } + void addRange(ConstArrayView list) { addRange(list.m_buffer, list.m_count); } + template void addRange(const ShortList& list) { -- cgit v1.2.3