In the internals, there is no description of a backend can add a new pass. And no backend uses passes.c:register_pass (4.5 and 4.7), so here is the question:
How can a backend add a pass? I tried this code in OVERRIDE_OPTIONS (simply because I found no canonical place to put it). struct register_pass_info pass_info; pass_info.pass = &pass_phiopt.pass; pass_info.reference_pass_name = "mergephi"; pass_info.ref_pass_instance_number = 1; pass_info.pos_op = PASS_POS_INSERT_BEFORE; register_pass (&pass_info); The pass is added, but it's the last pass of all tree passes, i.e. it's inserted after .optimized and .statistics; at least the pass number indicate that. When I use PASS_POS_REPLACE as .pos_op, the original "mergephi1" is removed, but again the new pass is added after all other passes. What am I doing wrong? passes.c:register_pass finds the right place in the list, but the insertion is incorrect. Thanks for hints, I tried with 4.5.2 Johann