This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for PR28490 (IA64 symbol+offset)
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: wilson at specifix dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Sep 2006 16:36:18 -0700 (PDT)
- Subject: Re: Patch for PR28490 (IA64 symbol+offset)
Jim,
Can I check in the following change to your patch? It affects both
Linux and HP-UX but the failures only show up on HP-UX in ILP32 mode.
I tested it on IA64 HP-UX and Linux with no regressions.
Basically this patch makes function pointers legitimate constants.
Without this change I get the following regressions on HP-UX in ILP32
mode:
gcc.c-torture/execute/20000822-1.c
gcc.c-torture/execute/eeprof-1.c
gcc.c-torture/execute/nestfunc-3.c
gcc.c-torture/execute/nestfunc-5.c
gcc.c-torture/execute/nestfunc-6.c
Without this change, function pointers are getting handled with:
| .LC0:
| data8 nested_2.1690#
|
| addl r15 = @gprel(.LC0), gp
after the change we get:
| addl r15 = @ltoff(@fptr(nested_2.1690#)), gp
Both work in 64 bit mode but the first version is not working in 32 bit
mode. Storing the function pointer as a 64 bit value may not be working
correctly. Anyway, the second version seems like a better option for
all platforms and works everywhere.
OK for checkin as a regression fix?
Steve Ellcey
sje@cup.hp.com
2006-09-18 Steve Ellcey <sje@cup.hp.com>
PR 28490
* config/ia64/ia64.c (ia64_legitimate_constant_p): Allow function
pointers as legitimate constants.
Index: config/ia64/ia64.c
===================================================================
--- config/ia64/ia64.c (revision 117011)
+++ config/ia64/ia64.c (working copy)
@@ -831,8 +831,9 @@ ia64_legitimate_constant_p (rtx x)
op = XEXP (XEXP (op, 0), 0);
}
- if (any_offset_symbol_operand (op, GET_MODE (op)))
- return true;
+ if (any_offset_symbol_operand (op, GET_MODE (op))
+ || function_operand (op, GET_MODE (op)))
+ return true;
if (aligned_offset_symbol_operand (op, GET_MODE (op)))
return (addend & 0x3fff) == 0;
return false;