Revert "operand: Implement operand hashing and use hashed set for declarations"

This reverts commit 1e665afa36.
This commit is contained in:
ReinUsesLisp
2019-09-09 16:48:05 -03:00
parent 58c5406436
commit d24685ebd3
10 changed files with 13 additions and 66 deletions

View File

@@ -5,7 +5,6 @@
*/
#include <cassert>
#include <climits>
#include "common_types.h"
#include "literal_number.h"
@@ -48,21 +47,6 @@ bool Op::operator==(const Operand& other) const {
return false;
}
std::size_t Op::Hash() const {
std::size_t hash = Operand::Hash();
hash ^= static_cast<std::size_t>(opcode) << 20;
if (result_type) {
hash ^= result_type->Hash() << 16;
}
hash ^= static_cast<std::size_t>(id.value_or(0)) << 8;
std::size_t wrap = 32;
for (const auto operand : operands) {
wrap = (wrap + 7) % (sizeof(std::size_t) * CHAR_BIT);
hash ^= operand->Hash() << wrap;
}
return hash;
}
void Op::Write(Stream& stream) const {
stream.Write(static_cast<u16>(opcode));
stream.Write(WordCount());