Conditional branch adjustment after trace generation
Currently we are doing this adjustment during instruction selection (target dependent code). It is possible to do this in a cleaner and target indepdent way.
We need another pass to adjust conditional branch after trace generation. Ideally before instruction selection, a conditional branch should always be followed by its false label. The adjustment should follow the rules:
- any conditional branch followed by its false label stays unchanged
- for conditional branch followed by its true label, we switch the true and false label, and negate the condition
- for conditional branch followed by neither label, we invent a new false label, and rewrite the conditional branch so that the new cond branch will be followed by the new false label.