[PATCH, i386] Never fix register for PIC when pseudo PIC reg is used

Uros Bizjak ubizjak@gmail.com
Thu Jan 29 10:39:00 GMT 2015


On Thu, Jan 29, 2015 at 9:13 AM, Uros Bizjak <ubizjak@gmail.com> wrote:

>>> Currently ix86_conditional_register_usage code may mark EBX as a fixed register if it is called
>>> when pic_offset_table_rtx is NULL even if we are going to use pseudo PIC register.  It already
>>> caused some problem in combination with another issue (PR jit/64722).  This patch will probably
>>> help to avoid problems in the future.
>>>
>>> BTW if we don't want to support possibility to switch to the fixed PIC register in i386 target then
>>> this code may be removed at all.
>>
>> No, we don't want to switch to fixed PIC register. cpuid asm in
>> cpuid.h and cmpxchg8b pattern will break. Please do not bring back the
>> dead and remove this code.
>
> Also, if possible, please simplify PIC_OFFSET_TABLE_REGNUM to use
> TARGET_USE_PSEUDO_PIC_REG, like:

Ops, better use the attached patch that exports ix86_use_pseudo_pic_reg.

Uros.
-------------- next part --------------
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h	(revision 220230)
+++ config/i386/i386.h	(working copy)
@@ -1256,13 +1256,11 @@
 #define REAL_PIC_OFFSET_TABLE_REGNUM  (TARGET_64BIT ? R15_REG : BX_REG)
 
 #define PIC_OFFSET_TABLE_REGNUM						\
-  ((TARGET_64BIT && (ix86_cmodel == CM_SMALL_PIC			\
-                     || TARGET_PECOFF))					\
-   || !flag_pic								\
-   ? INVALID_REGNUM							\
-   : pic_offset_table_rtx						\
-     ? INVALID_REGNUM							\
-     : REAL_PIC_OFFSET_TABLE_REGNUM)
+  (ix86_use_pseudo_pic_reg ()						\
+   ? (pic_offset_table_rtx						\
+      ? INVALID_REGNUM							\
+      : REAL_PIC_OFFSET_TABLE_REGNUM)					\
+   : INVALID_REGNUM)
 
 #define GOT_SYMBOL_NAME "_GLOBAL_OFFSET_TABLE_"
 
Index: config/i386/i386-protos.h
===================================================================
--- config/i386/i386-protos.h	(revision 220230)
+++ config/i386/i386-protos.h	(working copy)
@@ -40,6 +40,8 @@
 extern enum calling_abi ix86_cfun_abi (void);
 extern enum calling_abi ix86_function_type_abi (const_tree);
 
+extern bool ix86_use_pseudo_pic_reg (void);
+
 extern void ix86_reset_previous_fndecl (void);
 
 #ifdef RTX_CODE


More information about the Gcc-patches mailing list