Hi,

I'm new to WinCE (and ARM assembler) and have been debugging my application.
When I look at my code disassembled, I noticed that in C++ a function call
will have parameters number 4 and above pushed onto the stack while
parameters 1-3 are put in r1-r3. As far as I can tell, I'm not compiling
optimized. Are there compile flags that I can use that force every parameter
to the stack prior to the function call? I know that it isn't optimal, but
some of our code depends on this behavior since we have an intermingling of
.asm and .cpp.

Any help appreciated. Thanks!

Re: function call parameters and ARM assembly by Steve

Steve
Mon Apr 25 20:33:38 CDT 2005

That's the defined and specified calling convention for the ARM compiler.
You can count on it and write your ASM code accordingly.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com



RE: function call parameters and ARM assembly by Woojung_DOT_Huh_AT_smsc_DOT_com>

Woojung_DOT_Huh_AT_smsc_DOT_com>
Mon Apr 25 21:44:10 CDT 2005

I don't think it is possible to force to generate code not to use r0~r3 as
1st~3rd function parms.
I guess you have to write own rouines in ASM to pass parms using stack to
call your sources.

"joevolleyball" wrote:

> Hi,
>
> I'm new to WinCE (and ARM assembler) and have been debugging my application.
> When I look at my code disassembled, I noticed that in C++ a function call
> will have parameters number 4 and above pushed onto the stack while
> parameters 1-3 are put in r1-r3. As far as I can tell, I'm not compiling
> optimized. Are there compile flags that I can use that force every parameter
> to the stack prior to the function call? I know that it isn't optimal, but
> some of our code depends on this behavior since we have an intermingling of
> .asm and .cpp.
>
> Any help appreciated. Thanks!

Re: function call parameters and ARM assembly by hel

hel
Mon Apr 25 22:59:56 CDT 2005

You could double-up the first three args:

yourcall(a1,a2,a3,a1,a2,a3,a4,a5);

Wasted days and wasted nights and a little bit
of wasted bytes. But no harm, and no foul.
--
40th Floor - Software @ http://40th.com/
iPlay : the ultimate audio player for PPCs
mp3,mp4,m4a,aac,ogg,flac,wav,play & record
parametric eq, xfeed, reverb: all on a ppc

RE: function call parameters and ARM assembly by joevolleyball

joevolleyball
Tue Apr 26 15:56:44 CDT 2005

the problem I'll have with most of these replies is that my code is cross
platform and established in x86 land. So huge re-writes isn't ideal. I know
that x86 will behave similarly and pass the first two or 3 parameters in
registers when optimised, but when I compile with optimization off, then it
puts all of the parameters onto the stack prior to the function call. I was
hoping for similar behavior from the ARM compiler.

I guess I'll just have to hack around it.

thanks for all of your suggestions.

"joevolleyball" wrote:

> Hi,
>
> I'm new to WinCE (and ARM assembler) and have been debugging my application.
> When I look at my code disassembled, I noticed that in C++ a function call
> will have parameters number 4 and above pushed onto the stack while
> parameters 1-3 are put in r1-r3. As far as I can tell, I'm not compiling
> optimized. Are there compile flags that I can use that force every parameter
> to the stack prior to the function call? I know that it isn't optimal, but
> some of our code depends on this behavior since we have an intermingling of
> .asm and .cpp.
>
> Any help appreciated. Thanks!

Re: function call parameters and ARM assembly by joevolleyball

joevolleyball
Tue Apr 26 16:01:06 CDT 2005

I'm confused...the parameters being passed in registers is the defined and
specified calling convention? Or the behavior that I desire and am not
seeing (all parameters pushed on the stack prior to a function call) is the
defined and specified calling convention?

"Steve Maillet (eMVP)" wrote:

> That's the defined and specified calling convention for the ARM compiler.
> You can count on it and write your ASM code accordingly.
>
> --
> Steve Maillet
> EmbeddedFusion
> www.EmbeddedFusion.com
> smaillet at EmbeddedFusion dot com
>
>
>

Re: function call parameters and ARM assembly by Steve

Steve
Wed Apr 27 00:10:45 CDT 2005

What you see is the defined behavior. There's no need for re-writes as your
assembly code is NOT platform independent just write the ARM code to use the
convention expected and used by the compiler. For more information See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcepbguide5/html/wce50oriarmcallingsequencespecification.asp

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com