Local variables init and stack pointer moves flags in MIPS

Elad Yosef elad.yosef@gmail.com
Thu Jul 25 01:38:00 GMT 2013


The environment is :

CPU: MIPS (we are using 16bit instruction mode)  , Operating System:
eCos Compile flags : -Os  -g -Wall -Werror \

                       -c   -EL -mips16 \

                       -msoft-float \

                       -D__MIPS16E__   \

                       -ffunction-sections  \

                       -fdata-sections      \

                       -G0                       \

                       -fno-optimize-sibling-calls \

                       -mlong-calls





1. Is there any flag to GCC that force init of the local variables in
function to zero ?

    There is flag -flocal-init-zero , but I don't see that is working



2. Is there any flag in GCC that can avoid create sub block of stack
inside of function.

    For example:

    void  f1(int a) {

        int i;

        char a[20];

        ....

        strcpy(a,"hello\n");

        ...

        if (a > 10) {

            char b[100];

            ....

            strcpy(b,a);

            ....

        }

        ...

    }

    Can we force one move of the stack pointer for this function ?

    even if 100 bytes for b is nedded only if the paramter a gt 10.


Thanks

Elad



More information about the Gcc-help mailing list