intrusive_list: Interface changes

- Remove the root pointer from iterators.

This is unnecessary, since the only way to get a valid iterator is
either from a node itself (it transiently becomes an iterator via the
underlying interface), or through the iterator interface for the list.
This should also result in better code generation, as each increment or
decrement of an iterator is now branchless.

- Remove iterator_to

This is actually a pretty dangerous function, since it would immediately
create an iterator into the list using the given item, even if it's not
actually part of the list. This was only left around due to lack of
type handling around constructors.

- Add other overloads for erase() and remove()

Now handles iterators, pointers, and references.
This commit is contained in:
Lioncash 2016-08-26 15:38:59 -04:00 committed by MerryMage
parent d164184b1e
commit f2bf795876
2 changed files with 107 additions and 44 deletions

View file

@ -42,7 +42,7 @@ static Xbyak::Address MJitStateCpsr() {
}
static void EraseInstruction(IR::Block& block, IR::Inst* inst) {
block.Instructions().erase(block.Instructions().iterator_to(*inst));
block.Instructions().erase(inst);
}
EmitX64::BlockDescriptor EmitX64::Emit(IR::Block& block) {