From 5de3003af561bad33680940ab1809622c428e94b Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 17 Aug 2017 09:46:19 -0700 Subject: IR generation cleanup work - Make all instructions store their argument count for now, so we can iterate over them easily. - Longer term we might try to optimize for space because the common case is that the operand count is known, but keeping it simpler seems better for now - Split apart the creation of an instruction from adding it to a parent - Use the above capability to make sure that we add a function to its parent *after* all the parameter/result type emission has occured. - Perform simple value numbering for types during IR creation - This logic also tries to pick a good parent for any type instructions, so that types don't get created local to a function unless they really need to - Create all constants at global scope, and re-use when values are identical --- source/core/hash.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/core') diff --git a/source/core/hash.h b/source/core/hash.h index 07a14099b..dd2086305 100644 --- a/source/core/hash.h +++ b/source/core/hash.h @@ -95,7 +95,10 @@ namespace Slang return PointerHash::value>::GetHashCode(key); } - + inline int combineHash(int left, int right) + { + return (left * 16777619) ^ right; + } } #endif \ No newline at end of file -- cgit v1.2.3