- mode = "mode_Bad"
- flags = [ "cfopcode", "fragile", "start_block", "dump_noblock" ]
- pinned = "yes"
- knownBlock = True
- singleton = True
- attr_struct = "irg_attr"
+ """Bad nodes indicate invalid input, which is values which should never be
+ computed.
+
+ The typical use case for the Bad node is removing unreachable code.
+ Frontends should set the current_block to Bad when it is clear that
+ following code must be unreachable (ie. after a goto or return statement).
+ Optimisations also set block predecessors to Bad when it becomes clear,
+ that a control flow edge can never be executed.
+
+ The gigo optimisations ensures that nodes with Bad as their block, get
+ replaced by Bad themselfes. Nodes with at least 1 Bad input get exchanged
+ with Bad too. Exception to this rule are Block, Phi, Tuple and End node;
+ This is because removing inputs from a Block is hairy operation (requiring,
+ Phis to be shortened too for example). So instead of removing block inputs
+ they are set to Bad, and the actual removal is left to the control flow
+ optimisation phase. Block, Phi, Tuple with only Bad inputs however are
+ replaced by Bad right away."""
+ flags = [ "start_block", "dump_noblock" ]
+ pinned = "yes"
+ knownBlock = True
+ block = "get_irg_start_block(irg)"
+ attr_struct = "bad_attr"