On 8/18/08 7:15 AM, Martin Schindewolf wrote:
<snip> txn_handle.12_4 = __builtin_stm_new ();
jmp_buf.13_5 = __builtin_stm_get_env (txn_handle.12_4);
ssj_value.14_6 = _setjmp (jmp_buf.13_5);
if (ssj_value.14_6 == 0)
goto <bb 3> (<L1>);
else
goto <bb 4> (<L2>);
# SUCC: 4 (false) 3 (true)
# BLOCK 3
# PRED: 2 (true)
<L1>:;
__builtin_printf ("SAVE_BB\n");
txn_save_m.19_15 = m_1;
txn_save_a.20_20 = a_2;
txn_save_b.21_25 = b_3;
fake_var.18_13 = __builtin_stm_dummy ("RECOVER_BB\n");
if (fake_var.18_13)
goto <bb 4> (<L2>);
else
goto <bb 5>;
# SUCC: 4 (true) 5 (false)
# BLOCK 4
# PRED: 2 (false) 3 (true)
# txn_save_b.21_26 = PHI <txn_save_b.21_24(2), txn_save_b.21_25(3)>
# txn_save_a.20_21 = PHI <txn_save_a.20_19(2), txn_save_a.20_20(3)>
# txn_save_m.19_16 = PHI <txn_save_m.19_14(2), txn_save_m.19_15(3)>
<L2>:;
__builtin_printf ("RECOVER_BB\n");
m_17 = txn_save_m.19_16;
a_22 = txn_save_a.20_21;
b_27 = txn_save_b.21_26;
# SUCC: 5 (fallthru)
# BLOCK 5
# PRED: 4 (fallthru) 3 (false)
# m_18 = PHI <m_17(4), m_1(3)>
__builtin_stm_start (txn_handle.12_4, jmp_buf.13_5, &0);
<snip here comes the begin of a transaction>
Your problem seems to be that you are introducing irregular control flow
with your setjmp buffers. Perhaps you could express this transformation
in High GIMPLE and use try/catch or try/finally? Those are then
converted into a lowered form, but that means using the internal EH
machinery.
Another option is to mark the SSA names as ocurring in abnormal PHIs
(SSA_NAME_OCCURS_IN_ABNORMAL_PHI). But I'm not sure if that's going to
be straightforward.
Diego.