Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10484

Add diagnostic if more than one --global_register option is supplied

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Medium
    • Resolution: Unresolved

    Description

      The attached file has this source code ...

      int compare_double(double a, double b)
      {
          double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
          return (fabs(a - b) <= maxVal * DBL_EPSILON);
      }
      

      Build it and note the use of the registers V2, V3, and V6.

      % armcl --opt_level=off --symdebug:none -s file.c & findstr "V2 V3 V6" file.asm
      ;*   Regs Modified     : A1,A2,A3,A4,V1,V2,V3,V9,SP,LR,SR                    *
      ;*   Regs Used         : A1,A2,A3,A4,V1,V2,V3,V9,SP,LR,SR                    *
              STMFD     SP!, {V1, V2, V3, LR} ; []
              BIC       V3, A1, #-2147483648  ; [] |6|
              MOV       V2, A2                ; [] |6|
              MOV       A1, V3                ; [] |6|
              MOV       A2, V2                ; [] |6|
              LDMFD     SP!, {V1, V2, V3, LR} ; []
      

      Recall the following register equivalents:
      R5 => V2
      R6 => V3
      R9 => V6

      Next attempt to make R5 and R6 global registers, which means the compiler does not use them.

      % armcl --opt_level=off --symdebug:none -s --global_register=r5 --global_register=r6 file.c & findstr "V2 V3 V6" file.asm
      ;*   Regs Modified     : A1,A2,A3,A4,V1,V2,V3,V4,V9,SP,LR,SR                 *
      ;*   Regs Used         : A1,A2,A3,A4,V1,V2,V3,V4,V9,SP,LR,SR                 *
              STMFD     SP!, {V1, V2, V4, LR} ; []
              MOV       V2, A2                ; [] |6|
              MOV       A2, V2                ; [] |6|
              LDMFD     SP!, {V1, V2, V4, LR} ; []
      

      Note that V2 is used even though --global_register=r5 is an option.

      Similar experiments will show that only the last --global_register option is used. The rest are ignored, with no diagnostics.

      Attachments

        Activity

          People

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: