This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[arm] Fix thumb -fPIC


Patch below fixes a couple of bugswhen generating thumb PIC code.
One we are ORing with a register number rather than a bitmask. the other we 
weren't searching all low regs when looking for a work register.

Tested with cross to arm-none-elf.
Applied as obvious to csl-arm-branch and mainline as this has been discussed 
before.

Paul

2004-01-01  Paul Brook  <paul@codesourcery.com>

 * config/arm/arm.c (thumb_compute_saved_rag_mask): Or with bitmask,
 not register number.
 (thumb_find_work_register): Search full register range.

Index: gcc/config/arm/arm.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.303.2.58
diff -u -p -r1.303.2.58 arm.c
--- gcc/config/arm/arm.c 30 Sep 2004 21:45:04 -0000 1.303.2.58
+++ gcc/config/arm/arm.c 1 Oct 2004 15:22:59 -0000
@@ -3040,7 +3040,7 @@ thumb_find_work_register (int live_regs_
     return LAST_ARG_REGNUM;
 
   /* Look for a pushed register.  */
-  for (reg = 0; reg < LAST_LO_REGNUM; reg++)
+  for (reg = LAST_LO_REGNUM; reg >=0; reg--)
     if (live_regs_mask & (1 << reg))
       return reg;
 
@@ -9178,7 +9178,7 @@ thumb_compute_save_reg_mask (void)
     }
 
   if (flag_pic && !TARGET_SINGLE_PIC_BASE)
-    mask |= PIC_OFFSET_TABLE_REGNUM;
+    mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
   if (TARGET_SINGLE_PIC_BASE)
     mask &= ~(1 << arm_pic_register);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]