From 1460ec5c3d5a247e704245ac996750c749991fdd Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Thu, 9 Jun 2011 06:20:05 +0000 Subject: Print location for conflicting global regs. gcc/ 2011-06-08 Andi Kleen * reginfo.c (global_regs_decl): Add. (globalize_reg): Add decl parameter. Compute location. Pass location to warnings and add inform. Store decl in global_regs_decl. * rtl.h (globalize_reg): Update prototype. * varasm.c (make_decl_rtl): Pass decl to globalize_reg(). From-SVN: r174834 --- gcc/reginfo.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'gcc/reginfo.c') diff --git a/gcc/reginfo.c b/gcc/reginfo.c index a283a90..1da4cb8 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -87,6 +87,9 @@ static const char initial_call_really_used_regs[] = CALL_REALLY_USED_REGISTERS; and are also considered fixed. */ char global_regs[FIRST_PSEUDO_REGISTER]; +/* Declaration for the global register. */ +static tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER]; + /* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used in dataflow more conveniently. */ regset regs_invalidated_by_call_regset; @@ -825,8 +828,10 @@ fix_register (const char *name, int fixed, int call_used) /* Mark register number I as global. */ void -globalize_reg (int i) +globalize_reg (tree decl, int i) { + location_t loc = DECL_SOURCE_LOCATION (decl); + #ifdef STACK_REGS if (IN_RANGE (i, FIRST_STACK_REG, LAST_STACK_REG)) { @@ -836,18 +841,23 @@ globalize_reg (int i) #endif if (fixed_regs[i] == 0 && no_global_reg_vars) - error ("global register variable follows a function definition"); + error_at (loc, "global register variable follows a function definition"); if (global_regs[i]) { - warning (0, "register used for two global register variables"); + warning_at (loc, 0, + "register of %qD used for multiple global register variables", + decl); + inform (DECL_SOURCE_LOCATION (global_regs_decl[i]), + "conflicts with %qD", global_regs_decl[i]); return; } if (call_used_regs[i] && ! fixed_regs[i]) - warning (0, "call-clobbered register used for global register variable"); + warning_at (loc, 0, "call-clobbered register used for global register variable"); global_regs[i] = 1; + global_regs_decl[i] = decl; /* If we're globalizing the frame pointer, we need to set the appropriate regs_invalidated_by_call bit, even if it's already -- cgit v1.1