diff options
Diffstat (limited to 'gcc/trans-mem.c')
-rw-r--r-- | gcc/trans-mem.c | 377 |
1 files changed, 249 insertions, 128 deletions
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 5b07e7185bf..220ded277b5 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -801,25 +801,43 @@ diagnose_tm_blocks (void) return 0; } -struct gimple_opt_pass pass_diagnose_tm_blocks = -{ - { - GIMPLE_PASS, - "*diagnose_tm_blocks", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - gate_tm, /* gate */ - diagnose_tm_blocks, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_gimple_any, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - } +namespace { + +const pass_data pass_data_diagnose_tm_blocks = +{ + GIMPLE_PASS, /* type */ + "*diagnose_tm_blocks", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_gate */ + true, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + PROP_gimple_any, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ }; + +class pass_diagnose_tm_blocks : public gimple_opt_pass +{ +public: + pass_diagnose_tm_blocks(gcc::context *ctxt) + : gimple_opt_pass(pass_data_diagnose_tm_blocks, ctxt) + {} + + /* opt_pass methods: */ + bool gate () { return gate_tm (); } + unsigned int execute () { return diagnose_tm_blocks (); } + +}; // class pass_diagnose_tm_blocks + +} // anon namespace + +gimple_opt_pass * +make_pass_diagnose_tm_blocks (gcc::context *ctxt) +{ + return new pass_diagnose_tm_blocks (ctxt); +} /* Instead of instrumenting thread private memory, we save the addresses in a log which we later use to save/restore the addresses @@ -1706,25 +1724,43 @@ execute_lower_tm (void) return 0; } -struct gimple_opt_pass pass_lower_tm = -{ - { - GIMPLE_PASS, - "tmlower", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - gate_tm, /* gate */ - execute_lower_tm, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_gimple_lcf, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - } +namespace { + +const pass_data pass_data_lower_tm = +{ + GIMPLE_PASS, /* type */ + "tmlower", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_gate */ + true, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + PROP_gimple_lcf, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ }; + +class pass_lower_tm : public gimple_opt_pass +{ +public: + pass_lower_tm(gcc::context *ctxt) + : gimple_opt_pass(pass_data_lower_tm, ctxt) + {} + + /* opt_pass methods: */ + bool gate () { return gate_tm (); } + unsigned int execute () { return execute_lower_tm (); } + +}; // class pass_lower_tm + +} // anon namespace + +gimple_opt_pass * +make_pass_lower_tm (gcc::context *ctxt) +{ + return new pass_lower_tm (ctxt); +} /* Collect region information for each transaction. */ @@ -1968,25 +2004,42 @@ gate_tm_init (void) return true; } -struct gimple_opt_pass pass_tm_init = -{ - { - GIMPLE_PASS, - "*tminit", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - gate_tm_init, /* gate */ - NULL, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_ssa | PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - } +namespace { + +const pass_data pass_data_tm_init = +{ + GIMPLE_PASS, /* type */ + "*tminit", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_gate */ + false, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + ( PROP_ssa | PROP_cfg ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ }; + +class pass_tm_init : public gimple_opt_pass +{ +public: + pass_tm_init(gcc::context *ctxt) + : gimple_opt_pass(pass_data_tm_init, ctxt) + {} + + /* opt_pass methods: */ + bool gate () { return gate_tm_init (); } + +}; // class pass_tm_init + +} // anon namespace + +gimple_opt_pass * +make_pass_tm_init (gcc::context *ctxt) +{ + return new pass_tm_init (ctxt); +} /* Add FLAGS to the GIMPLE_TRANSACTION subcode for the transaction region represented by STATE. */ @@ -2927,26 +2980,42 @@ execute_tm_mark (void) return 0; } -struct gimple_opt_pass pass_tm_mark = -{ - { - GIMPLE_PASS, - "tmmark", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - NULL, /* gate */ - execute_tm_mark, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_ssa | PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_update_ssa - | TODO_verify_ssa, /* todo_flags_finish */ - } +namespace { + +const pass_data pass_data_tm_mark = +{ + GIMPLE_PASS, /* type */ + "tmmark", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + false, /* has_gate */ + true, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + ( PROP_ssa | PROP_cfg ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */ }; + +class pass_tm_mark : public gimple_opt_pass +{ +public: + pass_tm_mark(gcc::context *ctxt) + : gimple_opt_pass(pass_data_tm_mark, ctxt) + {} + + /* opt_pass methods: */ + unsigned int execute () { return execute_tm_mark (); } + +}; // class pass_tm_mark + +} // anon namespace + +gimple_opt_pass * +make_pass_tm_mark (gcc::context *ctxt) +{ + return new pass_tm_mark (ctxt); +} /* Create an abnormal edge from STMT at iter, splitting the block @@ -3094,26 +3163,42 @@ execute_tm_edges (void) return 0; } -struct gimple_opt_pass pass_tm_edges = -{ - { - GIMPLE_PASS, - "tmedge", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - NULL, /* gate */ - execute_tm_edges, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_ssa | PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_update_ssa - | TODO_verify_ssa, /* todo_flags_finish */ - } +namespace { + +const pass_data pass_data_tm_edges = +{ + GIMPLE_PASS, /* type */ + "tmedge", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + false, /* has_gate */ + true, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + ( PROP_ssa | PROP_cfg ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + ( TODO_update_ssa | TODO_verify_ssa ), /* todo_flags_finish */ }; + +class pass_tm_edges : public gimple_opt_pass +{ +public: + pass_tm_edges(gcc::context *ctxt) + : gimple_opt_pass(pass_data_tm_edges, ctxt) + {} + + /* opt_pass methods: */ + unsigned int execute () { return execute_tm_edges (); } + +}; // class pass_tm_edges + +} // anon namespace + +gimple_opt_pass * +make_pass_tm_edges (gcc::context *ctxt) +{ + return new pass_tm_edges (ctxt); +} /* Helper function for expand_regions. Expand REGION and recurse to the inner region. Call CALLBACK on each region. CALLBACK returns @@ -3818,26 +3903,44 @@ gate_tm_memopt (void) return flag_tm && optimize > 0; } -struct gimple_opt_pass pass_tm_memopt = -{ - { - GIMPLE_PASS, - "tmmemopt", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - gate_tm_memopt, /* gate */ - execute_tm_memopt, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_ssa | PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - } +namespace { + +const pass_data pass_data_tm_memopt = +{ + GIMPLE_PASS, /* type */ + "tmmemopt", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_gate */ + true, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + ( PROP_ssa | PROP_cfg ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ }; +class pass_tm_memopt : public gimple_opt_pass +{ +public: + pass_tm_memopt(gcc::context *ctxt) + : gimple_opt_pass(pass_data_tm_memopt, ctxt) + {} + + /* opt_pass methods: */ + bool gate () { return gate_tm_memopt (); } + unsigned int execute () { return execute_tm_memopt (); } + +}; // class pass_tm_memopt + +} // anon namespace + +gimple_opt_pass * +make_pass_tm_memopt (gcc::context *ctxt) +{ + return new pass_tm_memopt (ctxt); +} + /* Interprocedual analysis for the creation of transactional clones. The aim of this pass is to find which functions are referenced in @@ -5435,24 +5538,42 @@ ipa_tm_execute (void) return 0; } -struct simple_ipa_opt_pass pass_ipa_tm = -{ - { - SIMPLE_IPA_PASS, - "tmipa", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - gate_tm, /* gate */ - ipa_tm_execute, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TRANS_MEM, /* tv_id */ - PROP_ssa | PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - }, +namespace { + +const pass_data pass_data_ipa_tm = +{ + SIMPLE_IPA_PASS, /* type */ + "tmipa", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_gate */ + true, /* has_execute */ + TV_TRANS_MEM, /* tv_id */ + ( PROP_ssa | PROP_cfg ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ }; +class pass_ipa_tm : public simple_ipa_opt_pass +{ +public: + pass_ipa_tm(gcc::context *ctxt) + : simple_ipa_opt_pass(pass_data_ipa_tm, ctxt) + {} + + /* opt_pass methods: */ + bool gate () { return gate_tm (); } + unsigned int execute () { return ipa_tm_execute (); } + +}; // class pass_ipa_tm + +} // anon namespace + +simple_ipa_opt_pass * +make_pass_ipa_tm (gcc::context *ctxt) +{ + return new pass_ipa_tm (ctxt); +} + #include "gt-trans-mem.h" |