ibc: Implement ballot
This is a whole lot more than just implementing ballot. It also implements handling of flag registers which are read/written as scalars instead of flags. As such, it has to significantly improve the flag allocation/spilling pass.