re PR debug/15860 (No DW_AT_location debug info is emitted for formal arguments to...
authorRichard Henderson <rth@redhat.com>
Wed, 13 Oct 2004 23:43:56 +0000 (16:43 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 13 Oct 2004 23:43:56 +0000 (16:43 -0700)
        PR debug/15860
        * dwarf2out.c (rtl_for_decl_location): Apply big-endian correction
        for DECL_INCOMING_RTL.

From-SVN: r89012

gcc/ChangeLog
gcc/dwarf2out.c

index 036c72f18c501eb8332894d2fbd47ae14cd39924..cea88e1f31fe5ca4d098bc6096c996d3408ccf4e 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-13  Richard Henderson  <rth@redhat.com>
+
+       PR debug/15860
+       * dwarf2out.c (rtl_for_decl_location): Apply big-endian correction
+       for DECL_INCOMING_RTL.
+
 2004-10-14  Hans-Peter Nilsson  <hp@axis.com>
 
        PR target/17984
index 500ab40e68605b957bdc34dcb9010c433e40192e..75e328d91d301ce430400e2d1fc175dc68263b14 100644 (file)
@@ -9790,19 +9790,32 @@ rtl_for_decl_location (tree decl)
     {
       if (rtl == NULL_RTX || is_pseudo_reg (rtl))
        {
-         tree declared_type = type_main_variant (TREE_TYPE (decl));
-         tree passed_type = type_main_variant (DECL_ARG_TYPE (decl));
+         tree declared_type = TREE_TYPE (decl);
+         tree passed_type = DECL_ARG_TYPE (decl);
+         enum machine_mode dmode = TYPE_MODE (declared_type);
+         enum machine_mode pmode = TYPE_MODE (passed_type);
 
          /* This decl represents a formal parameter which was optimized out.
             Note that DECL_INCOMING_RTL may be NULL in here, but we handle
             all cases where (rtl == NULL_RTX) just below.  */
-         if (declared_type == passed_type)
-           rtl = DECL_INCOMING_RTL (decl);
-         else if (! BYTES_BIG_ENDIAN
-                  && TREE_CODE (declared_type) == INTEGER_TYPE
-                  && (GET_MODE_SIZE (TYPE_MODE (declared_type))
-                      <= GET_MODE_SIZE (TYPE_MODE (passed_type))))
+         if (dmode == pmode)
            rtl = DECL_INCOMING_RTL (decl);
+         else if (SCALAR_INT_MODE_P (dmode)
+                  && GET_MODE_SIZE (dmode) <= GET_MODE_SIZE (pmode))
+           {
+             rtx inc = DECL_INCOMING_RTL (decl);
+             if (REG_P (inc))
+               rtl = inc;
+             else if (MEM_P (inc))
+               {
+                 if (BYTES_BIG_ENDIAN)
+                   rtl = adjust_address_nv (inc, dmode,
+                                            GET_MODE_SIZE (pmode)
+                                            - GET_MODE_SIZE (dmode));
+                 else
+                   rtl = inc;
+               }
+           }
        }
 
       /* If the parm was passed in registers, but lives on the stack, then