Keil Logo

C51: COMMAND LINE GLOBAL REGISTER OPTIMIZATION


Information in this article applies to:

  • C51 Version 5 and Later

QUESTION

How is the REGFILE directive used on the command line to achieve global register optimization? The manual does not seem to describe this in detail.

ANSWER

  1. Compile your source file and invoke the linker with the REGFILE directive. For example:
    BL51 FOO.OBJ, BAR.OBJ TO FOOBAR PRINT(FOOBAR.M51) REGFILE(FOOBAR.REG)
    
  2. Look at the end of the linker map file (.m51). If you see something like the following, then you must rebuild your project as described in steps 3 and 4:
    RE-TRANSLATION LIST FOR OPTIMAL REGISTER MASKS
    
    
    MESSAGE                         MODULE
       INFORMATION
    --------------------------------------
    
    ** RE-TRANSLATION SUGGESTED **  FOO.OBJ (FOO)
       REG MASK (@000000) IS TOO PESSIMISTIC FOR FUNCTION '_TOUPPER'
    
  3. Recompile the source files required, using the compiler REGFILE directive. In the example above, FOO.C compiles to produce FOO.OBJ, so only FOO.C needs to be recompiled. When using the directive, specify the .REG file generated by the linker in step 2.
    C51 FOO.C REGFILE(FOOBAR.REG)
    
  4. Relink and repeat step 2 until retranslation is no longer suggested.

MORE INFORMATION

  • Refer to REGFILE in the BL51 User's Guide.
  • Refer to REGFILE in the Cx51 User's Guide.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.