Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain/gcc/config/vax More bug fixes. -fpic now...



details:   https://anonhg.NetBSD.org/src/rev/819012ea8be5
branches:  trunk
changeset: 509630:819012ea8be5
user:      matt <matt%NetBSD.org@localhost>
date:      Wed May 09 15:04:48 2001 +0000

description:
More bug fixes.  -fpic now produces significantly better code than
-fno-pic.  Make the pic'ifying simpler.

diffstat:

 gnu/dist/toolchain/gcc/config/vax/netbsd-elf.h |     5 +
 gnu/dist/toolchain/gcc/config/vax/netbsd.h     |    28 +-
 gnu/dist/toolchain/gcc/config/vax/vax.c        |   158 +--
 gnu/dist/toolchain/gcc/config/vax/vax.h        |    14 +-
 gnu/dist/toolchain/gcc/config/vax/vax.md       |  1187 ++++++++---------------
 5 files changed, 448 insertions(+), 944 deletions(-)

diffs (truncated from 2535 to 300 lines):

diff -r 0df07005664a -r 819012ea8be5 gnu/dist/toolchain/gcc/config/vax/netbsd-elf.h
--- a/gnu/dist/toolchain/gcc/config/vax/netbsd-elf.h    Wed May 09 15:02:59 2001 +0000
+++ b/gnu/dist/toolchain/gcc/config/vax/netbsd-elf.h    Wed May 09 15:04:48 2001 +0000
@@ -39,6 +39,11 @@
 #undef  TARGET_GAS
 #define TARGET_GAS     (1)
 
+#undef TARGET_DEFAULT
+#define        TARGET_DEFAULT  0
+
+#define        TARGET_MEM_FUNCTIONS            /* include mem* calls */
+
 #if 1
 #undef  PREFERRED_DEBUGGING_TYPE
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
diff -r 0df07005664a -r 819012ea8be5 gnu/dist/toolchain/gcc/config/vax/netbsd.h
--- a/gnu/dist/toolchain/gcc/config/vax/netbsd.h        Wed May 09 15:02:59 2001 +0000
+++ b/gnu/dist/toolchain/gcc/config/vax/netbsd.h        Wed May 09 15:04:48 2001 +0000
@@ -1,6 +1,17 @@
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES "-D__vax__ -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(vax) -Amachine(vax)"
 
+#undef CC1_SPEC
+#define CC1_SPEC "\
+       %{!fno-pic: \
+               %{!mno-pic: %{!fpic: %{!fPIC:-fPIC}}} \
+               %{!mindirect: %{!no-mindirect: -mno-indirect}}} \
+       %{mno-pic: -fno-pic -mindirect} \
+       %{fno-pic: \
+               %{!mindirect: %{!no-mindirect: -mindirect}}}"
+
+#define        CC1PLUS_SPEC CC1_SPEC
+
 /* Make gcc agree with <machine/ansi.h> */
 
 #undef SIZE_TYPE
@@ -23,7 +34,7 @@
 #undef DWARF2_UNWIND_INFO
 
 #undef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_HALFPIC    /* default to half-pic mode */
+#define TARGET_DEFAULT 0
 
 /* Function CSE screws up PLT .vs. GOT usage.
  */
@@ -45,7 +56,7 @@
 #define ENCODE_SECTION_INFO(DECL)                              \
 do                                                             \
   {                                                            \
-    if ((flag_pic | TARGET_HALFPIC))                           \
+    if (flag_pic)                                              \
       {                                                                \
        rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'    \
                   ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));    \
@@ -62,13 +73,12 @@
 
 /* Put relocations in the constant pool in the writable data section.  */
 #undef  SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX)           \
-{                                              \
-  if ((flag_pic || TARGET_HALFPIC)             \
-      && vax_symbolic_operand ((RTX), (MODE))) \
-    data_section ();                           \
-  else                                         \
-    readonly_data_section ();                  \
+#define SELECT_RTX_SECTION(MODE,RTX)                   \
+{                                                      \
+  if (flag_pic && vax_symbolic_operand ((RTX), (MODE)))        \
+    data_section ();                                   \
+  else                                                 \
+    readonly_data_section ();                          \
 }
 
 /* Use sjlj exceptions. */
diff -r 0df07005664a -r 819012ea8be5 gnu/dist/toolchain/gcc/config/vax/vax.c
--- a/gnu/dist/toolchain/gcc/config/vax/vax.c   Wed May 09 15:02:59 2001 +0000
+++ b/gnu/dist/toolchain/gcc/config/vax/vax.c   Wed May 09 15:04:48 2001 +0000
@@ -85,6 +85,16 @@
   if (GET_CODE (addr) == PLUS && GET_CODE (XEXP (addr, 1)) == CONST)
     debug_rtx (addr);
 #endif
+#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
+  if (flag_pic && GET_CODE (addr) == CONST &&
+      GET_CODE (XEXP (addr, 0)) == PLUS &&
+      GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF &&
+      !SYMBOL_REF_FLAG (XEXP (XEXP (addr, 0), 0)) &&
+      GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT)
+    {
+      fatal_insn ("Non-PIC operand escaped:\n", addr);
+    }
+#endif
 
  retry:
   switch (GET_CODE (addr))
@@ -745,7 +755,7 @@
    || (!INDEXED && GET_CODE (X) == CONST                               \
        && GET_CODE (XEXP ((X), 0)) == PLUS                             \
        && GET_CODE (XEXP (XEXP ((X), 0), 0)) == SYMBOL_REF             \
-       && ((!INDIRECT && !(flag_pic || TARGET_HALFPIC))                        \
+       && ((!INDIRECT && !flag_pic)                                    \
            || SYMBOL_REF_FLAG (XEXP (XEXP ((X), 0), 0))))              \
    || GET_CODE (X) == CONST_INT)
 
@@ -801,8 +811,7 @@
   if (INDIRECTABLE_ADDRESS_P (X, STRICT, INDEXED, 0)) goto ADDR;       \
   xfoob = XEXP (X, 0);                                                 \
   if (GET_CODE (X) == MEM                                              \
-      && INDIRECTABLE_ADDRESS_P (xfoob, STRICT, INDEXED,               \
-                                (flag_pic || TARGET_HALFPIC)))         \
+      && INDIRECTABLE_ADDRESS_P (xfoob, STRICT, INDEXED, TARGET_INDIRECT)) \
     goto ADDR;                                                         \
   if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC)            \
       && GET_CODE (xfoob) == REG                                       \
@@ -914,6 +923,12 @@
       debug_rtx (xbar);
     }
 #endif
+  if (flag_pic && GET_CODE (xbar) == SYMBOL_REF
+#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
+            && !SYMBOL_REF_FLAG (xbar)
+#endif
+            && mode == DImode)
+    return 0;
   return 1;
 }
 
@@ -930,30 +945,19 @@
             && GET_CODE (XEXP (op, 0)) == PLUS
             && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
 #ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-            && (SYMBOL_REF_FLAG (XEXP (XEXP (op, 0), 0))
-                || !(flag_pic || TARGET_HALFPIC))
+            && (SYMBOL_REF_FLAG (XEXP (XEXP (op, 0), 0)) || !flag_pic)
 #endif
             && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT)
-        || (GET_CODE (op) == CONST
-            && GET_CODE (XEXP (op, 0)) == PLUS
-            && GET_CODE (XEXP (XEXP (op, 0), 1)) == SYMBOL_REF
-#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-            && (SYMBOL_REF_FLAG (XEXP (XEXP (op, 0), 1))
-                || !(flag_pic || TARGET_HALFPIC))
-#endif
-            && GET_CODE (XEXP (XEXP (op, 0), 0)) == CONST_INT)
         || (GET_CODE (op) == PLUS
             && GET_CODE (XEXP (op, 1)) == SYMBOL_REF
 #ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-            && (SYMBOL_REF_FLAG (XEXP (op, 1))
-                || !(flag_pic || TARGET_HALFPIC))
+            && (SYMBOL_REF_FLAG (XEXP (op, 1)) || !flag_pic)
 #endif
             && GET_CODE (XEXP (op, 0)) == CONST_INT)
         || (GET_CODE (op) == PLUS
             && GET_CODE (XEXP (op, 0)) == SYMBOL_REF
 #ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-            && (SYMBOL_REF_FLAG (XEXP (op, 0))
-                || !(flag_pic || TARGET_HALFPIC))
+            && (SYMBOL_REF_FLAG (XEXP (op, 0)) || !flag_pic)
 #endif
             && GET_CODE (XEXP (op, 1)) == CONST_INT))
     {
@@ -1018,7 +1022,7 @@
 {
   if (!general_operand(op, mode))
     return 0;
-  if (!(flag_pic || TARGET_HALFPIC))
+  if (!flag_pic)
     return 1;
   if ((GET_CODE (op) == CONST
        && GET_CODE (XEXP (op, 0)) == PLUS
@@ -1047,124 +1051,6 @@
   return 1;
 }
 
-/* Legitimize PIC addresses.  If the address is already
-   position-independent, we return ORIG.  Newly generated
-   position-independent addresses go to REG.  If we need more
-   than one register, we lose.  
-
-   An address is legitimized by making an indirect reference
-   through the Global Offset Table with the name of the symbol
-   used as an offset.  
-
-   The assembler/loader are responsible for translating a symbol name
-   into a PC-relative displacement.
-
-   A quick example may make things a little clearer:
-
-   When not generating PIC code to store the value 12345 into _foo+4
-   we would generate the following code:
-
-       movl    $12345, _foo+4
-
-   When generating PIC a transformation is made.  First, the compiler
-   loads the address of foo into a register.  So the transformation makes:
-
-       movab   _foo, r0
-       movl    $12345, 4(r0)
-
-   That (in a nutshell) is how *all* symbol references are handled.  */
-
-rtx
-legitimize_pic_address (orig, reg, code)
-     rtx orig;
-     rtx reg;
-     int code;
-{
-  rtx pic_ref = orig;
-
-  if (!(flag_pic || TARGET_HALFPIC) || no_new_pseudos)
-    return pic_ref;
-
-  /* fprintf(stderr, "before: "); debug_rtx(orig); */
-  if (GET_CODE (orig) == SYMBOL_REF
-      && code != CODE_FOR_movsi
-      && code != CODE_FOR_addsi3)
-    {
-      if (reg == NULL || !reload_in_progress)
-       reg = gen_reg_rtx (Pmode);
-
-      emit_move_insn (reg, orig);
-      pic_ref = reg;
-    }
-  else if (GET_CODE (orig) == CONST
-          && GET_CODE (XEXP (orig, 0)) == PLUS)
-    {
-      if (GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
-         && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
-       {
-#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-         if (!SYMBOL_REF_FLAG (XEXP (XEXP (orig, 0), 0)))
-           {
-             if (reg == NULL || !reload_in_progress)
-               reg = gen_reg_rtx (Pmode);
-
-             emit_move_insn (reg, XEXP (XEXP (orig, 0), 0));
-             pic_ref = plus_constant_for_output (reg, INTVAL (XEXP (XEXP (orig, 0), 1)));
-           }
-         else
-#endif
-           if (code != CODE_FOR_movsi)
-             {
-               if (reg == NULL || !reload_in_progress)
-                 reg = gen_reg_rtx (Pmode);
-
-               emit_move_insn (reg, orig);
-               pic_ref = reg;
-             }
-       }
-      else
-       {
-         if (GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
-             || GET_CODE (XEXP (XEXP (orig, 0), 1)) == SYMBOL_REF)
-           {
-             debug_rtx (orig);
-             abort ();
-           }
-       }
-#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-    }
-  else if (GET_CODE (orig) == PLUS
-          && GET_CODE (XEXP (orig, 0)) == CONST_INT
-          && GET_CODE (XEXP (orig, 1)) == SYMBOL_REF
-          && !SYMBOL_REF_FLAG (XEXP (orig, 1)))
-    {
-      if (reg == NULL || !reload_in_progress)
-        reg = gen_reg_rtx (Pmode);
-
-      emit_move_insn (reg, XEXP (orig, 1));
-      pic_ref = plus_constant_for_output (reg, INTVAL (XEXP (orig, 0)));
-    }
-  else if (GET_CODE (orig) == PLUS
-          && GET_CODE (XEXP (orig, 0)) == SYMBOL_REF
-          && !SYMBOL_REF_FLAG (XEXP (orig, 0))
-          && GET_CODE (XEXP (orig, 1)) == CONST_INT)
-    {
-      if (reg == NULL || !reload_in_progress)
-        reg = gen_reg_rtx (Pmode);
-
-      emit_move_insn (reg, XEXP (orig, 0));
-      pic_ref = plus_constant_for_output (reg, INTVAL (XEXP (orig, 1)));
-#endif
-    }
-#if 0
-  if (orig != pic_ref)
-    debug_rtx (orig);
-#endif
- 
-  /* fprintf(stderr, "after: "); debug_rtx(pic_ref); */
-  return pic_ref;
-}
-
 int
 vax_reg_used_p(operand, reg)
      rtx operand;
diff -r 0df07005664a -r 819012ea8be5 gnu/dist/toolchain/gcc/config/vax/vax.h
--- a/gnu/dist/toolchain/gcc/config/vax/vax.h   Wed May 09 15:02:59 2001 +0000
+++ b/gnu/dist/toolchain/gcc/config/vax/vax.h   Wed May 09 15:04:48 2001 +0000
@@ -63,8 +63,8 @@
 #define TARGET_G_FLOAT (target_flags & MASK_G_FLOAT)
 



Home | Main Index | Thread Index | Old Index