Forum Discussion
Altera_Forum
Honored Contributor
14 years agoAh - I think -fdce got added for gcc 4.1, you are probably running gcc 3.4.5 for nios2.
I found that the newer gcc generated worse code - but I didn't look where/why. My code was somewhat tweaked to avoid unwanted memory references and almost all cycle stalls. I'm not sure which 'stuck bits' (etc) you might have that leave the processor running well enough to test... You might find that defining some like:#define XSTR(x)# x# define STR(x) XSTR(x)# define GCC_MEMBAR()
asm volatile( "#gcc_membar, line " STR(__LINE__) "\n" : : : "memory" ) (which tells gcc that any memory might be changed by the (non-existent) assembler). Then a GCC_MEMBAR() in the code will force gcc to write out values cached in registers, and re-read values from memory. This might let you do the checks you want. (I used it to control the number of live values and pressure on registers.)