feat(furc/ssa): implement basic constant propagation

Refs: #2
This commit is contained in:
2026-06-13 14:46:16 +02:00
parent f1f62fad8c
commit d0f3637539
3 changed files with 238 additions and 0 deletions
+15
View File
@@ -44,6 +44,8 @@ struct register_operand {
friend std::ostream& operator<<(std::ostream& os, const register_operand& op) {
return os << op.reg << '_' << op.ver;
}
bool operator==(const register_operand& rhs) const { return reg == rhs.reg && ver == rhs.ver; }
};
/**
@@ -270,4 +272,17 @@ private:
} // namespace ir
} // namespace furlang
namespace std {
template <>
struct hash<furlang::ir::register_operand> {
std::size_t operator()(const furlang::ir::register_operand& op) const noexcept {
std::size_t h1 = std::hash<decltype(op.reg)>{}(op.reg);
std::size_t h2 = std::hash<std::uint32_t>{}(op.ver);
return h1 ^ (h2 + 0x9e3779b9 + (h1 << 6) + (h1 >> 2));
}
};
} // namespace std
#endif // FURLANG_IR_OPERAND_HPP