E
Emmanuel Stapf [ES]
Hi,
Because using volatile would prevent some C compilation optimization,
I'm looking at an alternative where I would inform the C compiler that
from known points in my program code, no values are in registers and
thus the generated code should refetch the data from memory (and then
use register whenever it can).
For example,
struct complex_struct s {
int value;
};
void f () {
int i;
i = s.value + s.value; /* 1 */
routine_that_will_indirectly_modify_s_value(); /* 2 */
i = s.value + s.value; /* 3 */
}
If the C compiler had optimized the access to `s.value' in a register in
#1, I want to prevent the C compiler from using that register in #3
because the value was externally modified in #2.
If I was making volatile, then all accesses to `s.value' would be
penalized and I don't want that.
Thanks for the help,
Manu
Because using volatile would prevent some C compilation optimization,
I'm looking at an alternative where I would inform the C compiler that
from known points in my program code, no values are in registers and
thus the generated code should refetch the data from memory (and then
use register whenever it can).
For example,
struct complex_struct s {
int value;
};
void f () {
int i;
i = s.value + s.value; /* 1 */
routine_that_will_indirectly_modify_s_value(); /* 2 */
i = s.value + s.value; /* 3 */
}
If the C compiler had optimized the access to `s.value' in a register in
#1, I want to prevent the C compiler from using that register in #3
because the value was externally modified in #2.
If I was making volatile, then all accesses to `s.value' would be
penalized and I don't want that.
Thanks for the help,
Manu