8 auto& world = a->world();
11 if (a->isa_imm() && b->
isa_mut())
return -1;
12 if (a->isa_mut() && b->
isa_imm())
return +1;
14 if (a->isa_mut() && b->
isa_mut()) {
15 world.WLOG(
"resorting to unstable gid-based compare for commute check");
16 return a->gid() < a->gid() ? -1 : +1;
19 assert(a->isa_imm() && b->
isa_imm());
22 if (a->node() != b->
node() )
return a->node() < b->
node() ? -1 : +1;
23 if (a->num_ops() != b->
num_ops())
return a->num_ops() < b->
num_ops() ? -1 : +1;
24 if (a->flags() != b->
flags() )
return a->flags() < b->
flags() ? -1 : +1;
27 if (
auto var1 = a->isa<
Var>()) {
28 auto var2 = b->as<
Var>();
29 world.WLOG(
"resorting to unstable gid-based compare for commute check");
30 return var1->
gid() < var2->gid() ? -1 : +1;
33 for (
size_t i = 0, e = a->num_ops(); i != e; ++i)
34 if (
int cmp =
commute_(a->op(i), b->
op(i)); cmp != 0)
return cmp;
constexpr Node node() const noexcept
constexpr flags_t flags() const noexcept
T * isa_mut() const
If this is mutable, it will cast constness away and perform a dynamic_cast to T.
const Def * op(size_t i) const noexcept
constexpr u32 gid() const noexcept
Global id - unique number for this Def.
const T * isa_imm() const
constexpr size_t num_ops() const noexcept
int commute_(const Def *a, const Def *b)