Jian-Xin Lai
2014-02-18 06:37:42 UTC
Hi,
Basically, the volatile symbol shouldn't appear in the mu and chi. For
example, in osprey/be/opt/opt_revise_ssa.cxx, we can find the following
code:
933 // this loop for pre-existing variables
934 IDX_32_SET_ITER iter;
935 iter.Init(_symbols_to_revise);
936 for (i = iter.First_elem(); ! iter.Is_Empty(); i = iter.Next_elem())
{
937 if (i >= _first_new_aux_id)
938 break;
939 if (_opt_stab->Aux_stab_entry(i)->Is_volatile())
940 continue; // volatiles do not appear in any mu and chi
941 Update_chi_list_for_old_var(stmt, i);
942 }
943
944 // this loop for new variables
945 for (i = _first_new_aux_id; i <= _opt_stab->Lastidx(); i++) {
946 if (_opt_stab->Aux_stab_entry(i)->Is_volatile())
947 continue; // volatiles do not appear in any mu and chi
948 Insert_mu_and_chi_list_for_new_var(stmt, i);
949 }
But I do find in some other places, there are code to handle the volatile
symbol in mu/chi list:
opt_dce.cxx, BOOL DCE::Required_stmt(const STMTREP *stmt) const
2168 FOR_ALL_NODE(cnode, chi_iter, Init(stmt->Chi_list())) {
......
2175 // Fix 621039: mark statement affecting a volatile accesses to be
live
2176 if (Opt_stab()->Aux_stab_entry(cnode->Aux_id())->Is_volatile())
2177 return TRUE;
2178 }
opt_find.cxx, void CODEMAP::Fix_zero_version(CHI_NODE *chi, STMTREP *stmt)
884 // Fix 815093: Set volatile flag
885 if ( Opt_stab()->Is_volatile( chi_opnd->Aux_id() ) ) {
886 retval->Set_is_volatile();
887 }
And in opt_verify.cxx, I also find the following comments from Raymond in
the code:
670 // The aux symbol table allows volatile variables that are virtual
variable
671 // to be entered into the mu/chi list. Real volative variables are
not
672 // entered though. It is inconsistent and should be clean up.
After the
673 // cleanup, changes in be/opt/opt_remame -r1.5 can be backed out.
674 // -Raymond 6/24/98.
I'm confuced by the code and comments above. My questions are,
1. What will the "consistent approach" look like?
2. Can the volatile symbol appear in mu/chi regardless it's virtual or not?
If it's not allowed, how to represent the side effect for a iload/istore on
volatile symbols? Can it always use the default vsym?
Thank you very much.
Basically, the volatile symbol shouldn't appear in the mu and chi. For
example, in osprey/be/opt/opt_revise_ssa.cxx, we can find the following
code:
933 // this loop for pre-existing variables
934 IDX_32_SET_ITER iter;
935 iter.Init(_symbols_to_revise);
936 for (i = iter.First_elem(); ! iter.Is_Empty(); i = iter.Next_elem())
{
937 if (i >= _first_new_aux_id)
938 break;
939 if (_opt_stab->Aux_stab_entry(i)->Is_volatile())
940 continue; // volatiles do not appear in any mu and chi
941 Update_chi_list_for_old_var(stmt, i);
942 }
943
944 // this loop for new variables
945 for (i = _first_new_aux_id; i <= _opt_stab->Lastidx(); i++) {
946 if (_opt_stab->Aux_stab_entry(i)->Is_volatile())
947 continue; // volatiles do not appear in any mu and chi
948 Insert_mu_and_chi_list_for_new_var(stmt, i);
949 }
But I do find in some other places, there are code to handle the volatile
symbol in mu/chi list:
opt_dce.cxx, BOOL DCE::Required_stmt(const STMTREP *stmt) const
2168 FOR_ALL_NODE(cnode, chi_iter, Init(stmt->Chi_list())) {
......
2175 // Fix 621039: mark statement affecting a volatile accesses to be
live
2176 if (Opt_stab()->Aux_stab_entry(cnode->Aux_id())->Is_volatile())
2177 return TRUE;
2178 }
opt_find.cxx, void CODEMAP::Fix_zero_version(CHI_NODE *chi, STMTREP *stmt)
884 // Fix 815093: Set volatile flag
885 if ( Opt_stab()->Is_volatile( chi_opnd->Aux_id() ) ) {
886 retval->Set_is_volatile();
887 }
And in opt_verify.cxx, I also find the following comments from Raymond in
the code:
670 // The aux symbol table allows volatile variables that are virtual
variable
671 // to be entered into the mu/chi list. Real volative variables are
not
672 // entered though. It is inconsistent and should be clean up.
After the
673 // cleanup, changes in be/opt/opt_remame -r1.5 can be backed out.
674 // -Raymond 6/24/98.
I'm confuced by the code and comments above. My questions are,
1. What will the "consistent approach" look like?
2. Can the volatile symbol appear in mu/chi regardless it's virtual or not?
If it's not allowed, how to represent the side effect for a iload/istore on
volatile symbols? Can it always use the default vsym?
Thank you very much.
--
Regards,
Lai Jian-Xin
Regards,
Lai Jian-Xin