This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

long type arguments stored in registers ?

Table in www.keil.com/.../c51_le_passingparmsinregs.htm lists registers are used to store different argument.

I saw arg1 and arg2 are shared the same registers R4~R7 when they are long type. It is incorrect. arg2 should be stored in fixed memory.
The same way, when arguments are generic pointers, only arg1 is stored in R1~R3, arg2 and arg3 should be stored in fixed memory.

Reference to http://www.keil.com/support/docs/2314.htm

Parents
  • "I saw arg1 and arg2 are shared the same registers R4~R7 when they are long type."

    I think you have misinterpreted the table, there!

    I think that what the table means to say is that a 2nd parameter of type long or float will be passed in R4-R7 if available

    Clearly, if R4-R7 have already been used for a 1st parameter of type long or float, then a 2nd parameter of that type will, as you say, have to "spill out" to a fixed memory location.

    Similarly for Generic Pointers in R1-R3.

    I agree that the table is not entirely clear about this! :-(

    In the PDF manual, the table is followed by some examples with illustrate the above - these examples are missing from the web version. :-(

    You need to contact Keil direct to report this issue:

    "Keil support personnel do not monitor this forum and are not guaranteed to reply to your queries."
    http://www.keil.com/forum/

Reply
  • "I saw arg1 and arg2 are shared the same registers R4~R7 when they are long type."

    I think you have misinterpreted the table, there!

    I think that what the table means to say is that a 2nd parameter of type long or float will be passed in R4-R7 if available

    Clearly, if R4-R7 have already been used for a 1st parameter of type long or float, then a 2nd parameter of that type will, as you say, have to "spill out" to a fixed memory location.

    Similarly for Generic Pointers in R1-R3.

    I agree that the table is not entirely clear about this! :-(

    In the PDF manual, the table is followed by some examples with illustrate the above - these examples are missing from the web version. :-(

    You need to contact Keil direct to report this issue:

    "Keil support personnel do not monitor this forum and are not guaranteed to reply to your queries."
    http://www.keil.com/forum/

Children