double register

Asked by Jonathan Dumaresq

Hi,

is is possible to tell gcc to not use the double register to pass argument ? I have my own implementation of printf and i do not want to have gcc pass argument thru register. I want to have my variable argument passed onto the stack.

Is it possible with an attribute ?

Regards

Jonathan

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Terry Guo (terry.guo) said :
#1

I don't think so. The ARM ABI explicitly require that double arguments should be passed through double registers if they are available.

Revision history for this message
Jonathan Dumaresq (jdumaresq) said :
#2

HI,

So printf should be coded with this in mind ?

regards

jonathan

Revision history for this message
Terry Guo (terry.guo) said :
#3

There are couple of things you should consider for this issue:

1. If your target hasn't hardware double registers, then the core registers will be used.

2. If your target has hardware double registers, but you use option -mfloat-abi=soft or -mfloat-abi=softfp to build source files, then still the core registers will be used for passing arguments.

3. Only when there are hardware registers and option -mfloat-abi=hard, the hardware double registers will be used for passing double arguments.

4. If you implement your printf with just c/c++ code, without any assemble code, the compiler will handle above scenarios automatically and properly.

5. If you are using assembly code to implement your printf, you have to take care above scenarios by yourselves. Make sure the assembly code has a good assumption on which registers are used to pass arguments.

Can you help with this problem?

Provide an answer of your own, or ask Jonathan Dumaresq for more information if necessary.

To post a message you must log in.