Revision b9c18f56

b/tcg/tcg.c
1122 1122
                        dead_temps[arg] = 1;
1123 1123
                    }
1124 1124
                    
1125
                    /* globals are live (they may be used by the call) */
1126
                    memset(dead_temps, 0, s->nb_globals);
1127
                    
1125
                    if (!(call_flags & TCG_CALL_CONST)) {
1126
                        /* globals are live (they may be used by the call) */
1127
                        memset(dead_temps, 0, s->nb_globals);
1128
                    }
1129

  
1128 1130
                    /* input args are live */
1129 1131
                    dead_iargs = 0;
1130 1132
                    for(i = 0; i < nb_iargs; i++) {
......
1821 1823
    
1822 1824
    /* store globals and free associated registers (we assume the call
1823 1825
       can modify any global. */
1824
    save_globals(s, allocated_regs);
1826
    if (!(flags & TCG_CALL_CONST)) {
1827
        save_globals(s, allocated_regs);
1828
    }
1825 1829

  
1826 1830
    tcg_out_op(s, opc, &func_arg, &const_func_arg);
1827 1831
    
b/tcg/tcg.h
178 178
   and cannot raise exceptions. Hence a call to a pure function can be
179 179
   safely suppressed if the return value is not used. */
180 180
#define TCG_CALL_PURE           0x0010 
181
/* A const function only reads its arguments and does not use TCG
182
   globals variables. Hence a call to such a function does not
183
   save TCG globals variabes back to their canonical location. */
184
#define TCG_CALL_CONST          0x0020
181 185

  
182 186
/* used to align parameters */
183 187
#define TCG_CALL_DUMMY_TCGV     MAKE_TCGV_I32(-1)

Also available in: Unified diff