path: root/ir/be/beflags.h
diff options
authorAndreas Fried <>2014-08-07 14:50:02 +0200
committerAndreas Fried <>2014-08-08 10:45:17 +0200
commita7fe14d46c6e3f2e5567e143883120ee62ec2322 (patch)
tree1adbd115a2a4b4ad3839f4f3f9f8220f1140712b /ir/be/beflags.h
parent2b4b670a4a2c3ad956915ae5461ecc89c5613e45 (diff)
Add a callback to be_sched_fix_flags to optimize flag usage.
Implemented for now: When the flags of one Sub or Cmp node are needed, but the flags of another one are currently alive, invert the condition code and avoid rematerialization.
Diffstat (limited to 'ir/be/beflags.h')
1 files changed, 8 insertions, 1 deletions
diff --git a/ir/be/beflags.h b/ir/be/beflags.h
index 45de49b..db5a3f3 100644
--- a/ir/be/beflags.h
+++ b/ir/be/beflags.h
@@ -24,6 +24,12 @@ typedef ir_node * (*func_rematerialize) (ir_node *node, ir_node *after);
typedef bool (*check_modifies_flags) (const ir_node *node);
+ * Callback function that checks whether consumers can use the
+ * available flags instead of their original ones.
+ */
+typedef bool (*try_replace_flags) (ir_node *consumers, ir_node *flags_needed, ir_node *available_flags, int pn);
* Walks the schedule and ensures that flags aren't destroyed between producer
* and consumer of flags. It does so by moving down/rematerialising of the
* nodes. This does not work across blocks.
@@ -32,6 +38,7 @@ typedef bool (*check_modifies_flags) (const ir_node *node);
void be_sched_fix_flags(ir_graph *irg, const arch_register_class_t *flag_cls,
func_rematerialize remat_func,
- check_modifies_flags check_modifies_flags_func);
+ check_modifies_flags check_modifies_flags_func,
+ try_replace_flags try_replace_flags_func);