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]

[PATCH] Define TARGET_DELEGITIMIZE_ADDRESS for bfin port GCC


Bfin port GCC of latest trunk does not build. It fails on compiling
-mid-shared-library libstdc++-v3/src/ios_init.cc. The cause is
mem_loc_descriptor () is unable to deal with  UNSPEC rtx without
target specific address delegitimize function. This patch define
TARGET_DELEGITIMIZE_ADDRESS for bfin port, such that it will build
fine.

Is it OK for trunk and 4.1 branch? Although 4.1 branch build fine, it
cannot compile the same 4.2 preprocessed ios_init.cc from trunk.

Jie
	* config/bfin/bfin.c (bfin_delegitimize_address): New.
	(TARGET_DELEGITIMIZE_ADDRESS): Define.

Index: config/bfin/bfin.c
===================================================================
--- config/bfin/bfin.c	(revision 114226)
+++ config/bfin/bfin.c	(working copy)
@@ -1030,6 +1030,25 @@
   return NULL_RTX;
 }
 
+static rtx
+bfin_delegitimize_address (rtx orig_x)
+{
+  rtx x = orig_x, y;
+
+  if (GET_CODE (x) != MEM)
+    return orig_x;
+
+  x = XEXP (x, 0);
+  if (GET_CODE (x) == PLUS
+      && GET_CODE (XEXP (x, 1)) == UNSPEC
+      && XINT (XEXP (x, 1), 1) == UNSPEC_MOVE_PIC
+      && GET_CODE (XEXP (x, 0)) == REG
+      && REGNO (XEXP (x, 0)) == PIC_OFFSET_TABLE_REGNUM)
+    return XVECEXP (XEXP (x, 1), 0, 0);
+
+  return orig_x;
+}
+
 /* This predicate is used to compute the length of a load/store insn.
    OP is a MEM rtx, we return nonzero if its addressing mode requires a
    32 bit instruction.  */
@@ -3643,4 +3677,7 @@
 #undef TARGET_SECONDARY_RELOAD
 #define TARGET_SECONDARY_RELOAD bfin_secondary_reload
 
+#undef TARGET_DELEGITIMIZE_ADDRESS
+#define TARGET_DELEGITIMIZE_ADDRESS bfin_delegitimize_address
+
 struct gcc_target targetm = TARGET_INITIALIZER;





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