This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[C6727] Innocent function treated as recursive

Hi,

I have the function :

..........................................................................................................

#define L_add(a,b)     (_sadd((a),(b))) 
#define L_mult(a,b)    (_smpy((a),(b))) 
#define L_macNs(a,b,c) L_add_c((a),L_mult(b,c))

static inline int32_t c67_dot(int16_t *x, int16_t *y, int len)
{
 int32_t dot = 0, i;
 for (i = 0; i < len; i++) 
   L_macNs(dot, x[i], y[i]);
 return dot;
}

.............................................................................................................

After compiling the code fot c6727 with cl6x v6.1.9 with the following options :

INCLUDES= -i. -i/usr/ti/csl/dsp/inc -i/usr/ti/inc -i/usr/ti/csl/intc/dsp/inc
DEFINES= -D=C6727 -D=CHIP_6727 -D=CHIP_C6727
CFLAGS = $(DEFINES) $(INCLUDES) -q -pdv -al -pm -ss -k -mw -on2 -mt -mf=5 -mi=0

I've noticed such lines in *.nfo file :

These functions may be recursive: c67_dot
Inlineable function will be suppressed: c67_dot()

So questions are :

1. What does this message means ?

2. Why compiler emits words "may be" ?

3. If the function really treated as recursive - how to avoid this behaviour ?

Thanks in advance

  • > These functions may be recursive: c67_dot

    The algorithm that determines whether a function may be recursive operates on the entire call graph, plus some information taken from the compilation options.  Thus it depends on the context of this function and not solely the function itself, and I can't give you a precise answer from what I have.

    That said, it appears that c67_dot() calls L_add_c().  Perhaps L_add_c() makes an indirect call, or perhaps it calls a function that makes an indirect call.  The most common reason for non-obvious may-be-recursive notes is an indirect call for which the set of actual callees can't be determined.

    If a function may be recursive, certain optimisations (mostly related to aliased variables) will be more conservative.

     

    > Inlineable function will be suppressed: c67_dot()

    If all calls to a function are inlined, and it can't be called from outside the compilation unit, there's no need to include the function itself in the output.  That's what we mean by "suppression."