Hi, We are optimizing the G.723.1 speech codec on c6211. The problem i am facing is , when the complier generates the asm code,it deletes some function parameters which are passed through function calls when i use the program level optimization i.e -pm option. When I remove the -pm option the function parameters are not deleted. I came to know that all the function parameters deleted are globals and hence are deleted.But using the -pm option I get more reduction in cycles. So whether to use -pm option or not in TI C6211 processor. Plz reply |
|
C6x function parameters deleted when called and takes from global
Started by ●May 3, 2002
Reply by ●May 3, 20022002-05-03
At 01:47 PM 05/03/02 +0530, Mahesh Patil wrote: > Hi, > We are optimizing the G.723.1 speech codec on c6211. > The problem i am facing is , when the complier generates the asm > code,it deletes some function parameters which are passed through >function > calls when i use the program level optimization i.e -pm > option. When I remove the -pm option the function parameters are not >deleted. > I came to know that all the function parameters deleted are globals > and hence are deleted.But using the -pm option I get more reduction > in cycles. > So whether to use -pm option or not in TI C6211 processor. Forgive me for not understanding your issues, but from reading the above it sounds as if you've found that the program mode optimization is really helping your program run faster, and is deleting some parameters that are useless when calling your function. Sounds like the compiler is acting great! What's the actual problem you're concerned about? -W |
Reply by ●May 7, 20022002-05-07
The parameters deleted are the globals. But we are making the code reentrant by passing the parameters to the function.If the parameters passed are globals then the compiler deletes that particular parameter and takes from the global which is available. But we want the code to be reentrant. If we don't use program level optimization ,parameters don't get deleted but we don't get better optimization without -pm option.So using the program level optimization can we overcome this problem. ----- Original Message ----- From: "C.W." <> To: "Mahesh Patil" <>; <> Sent: Friday, May 03, 2002 8:42 PM Subject: Re: [c6x] C6x function parameters deleted when called and takes from global > At 01:47 PM 05/03/02 +0530, Mahesh Patil wrote: > > Hi, > > We are optimizing the G.723.1 speech codec on c6211. > > The problem i am facing is , when the complier generates the asm > > code,it deletes some function parameters which are passed through > >function > > calls when i use the program level optimization i.e -pm > > option. When I remove the -pm option the function parameters are not > >deleted. > > I came to know that all the function parameters deleted are globals > > and hence are deleted.But using the -pm option I get more reduction > > in cycles. > > So whether to use -pm option or not in TI C6211 processor. > Forgive me for not understanding your issues, but from reading the above it > sounds as if you've found that the program mode optimization is really > helping your program run faster, and is deleting some parameters that are > useless when calling your function. Sounds like the compiler is acting great! > > What's the actual problem you're concerned about? > > -W > > _____________________________________ > Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. > > _____________________________________ > About this discussion group: > > To Join: Send an email to > > To Post: Send an email to > > To Leave: Send an email to > > Archives: http://www.yahoogroups.com/group/c6x > > Other Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/ > > |
|
Reply by ●May 7, 20022002-05-07
> The parameters deleted are the globals. > But we are making the code reentrant by passing the parameters to the > function.If the parameters passed are globals then the compiler deletes > that particular parameter and takes from the global which is available. > But we want the code to be reentrant. > If we don't use program level optimization ,parameters don't get deleted > but we don't get better optimization without -pm option.So using the > program level optimization can we overcome this problem. [The following are my comments based on what little I know of your code.] What direct connection do you believe there is between the global variable and making the function reentrant? What sort of re-entrancy are you using? Interrupt driven? Do you just want to make sure that the function copies the value at the beginning of the function and ignores further changes to the global variable while within the function? The compiler, in program mode, can see all the function calls to every function (unless you have assembly, see below). It can tell that every time you call this function, you are using a global variable as a parameter. Therefore, it can avoid the extra time spent pushing and popping the value from the stack at each call, and instead delete the parameter and just copy the global variable once inside the function. This has nothing direct to do with re-entrancy. If the global variable is changed and the function called a second time, the function will again make a copy of the data once it begins the second time (or at least it should). Note that the global variable, if it's possible it can be changed in something like an interrupt, needs to be marked volatile to tell the compiler that it can change without warning in a flow of code that otherwise does not contain modifications to it. Also note that if you have assembly functions which might be calling this function, then you also need to use the pragma FUNC_EXT_CALLED to tell the compiler that there are calls to the function outside of the code that it can see, and so to reduce certain types of optimizations. Otherwise, it all your interrupt handlers are in C and are compiled in when doing program mode optimization, then the compiler seems correct in it's deleting the parameter that it can more easily get from the global variable, and this should not affect reentrancy. -W |