OSDN Git Service

* config/bfin/bfin.c (bfin_library_id_string): Remove.
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Apr 2005 14:26:52 +0000 (14:26 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Apr 2005 14:26:52 +0000 (14:26 +0000)
(bfin_library_id): New variable.
(bfin_expand_prologue): Use bfin_library_id and bfin_lib_id_given
instead of bfin_library_id_string.
(bfin_handle_option): New function.
(override_options): Remove most code to deal with shared library IDs,
just check they aren't used without -mid-shared-library.
(TARGET_HANDLE_OPTION): Define.
* config/bfin/bfin.h (TARGET_OPTIONS): Delete macro.
* config/bfin/bfin.opt (mshared-library-id=): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98023 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/bfin/bfin.c
gcc/config/bfin/bfin.h
gcc/config/bfin/bfin.opt

index b52f808..df41196 100644 (file)
@@ -1,3 +1,16 @@
+2005-04-12  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * config/bfin/bfin.c (bfin_library_id_string): Remove.
+       (bfin_library_id): New variable.
+       (bfin_expand_prologue): Use bfin_library_id and bfin_lib_id_given
+       instead of bfin_library_id_string.
+       (bfin_handle_option): New function.
+       (override_options): Remove most code to deal with shared library IDs,
+       just check they aren't used without -mid-shared-library.
+       (TARGET_HANDLE_OPTION): Define.
+       * config/bfin/bfin.h (TARGET_OPTIONS): Delete macro.
+       * config/bfin/bfin.opt (mshared-library-id=): New.
+
 2005-04-12  Kazu Hirata  <kazu@cs.umass.edu>
 
        * tree-vect-transform.c: Fix comment typos.
index 366c47d..c4287a1 100644 (file)
@@ -67,7 +67,8 @@ const char *byte_reg_names[]   =  BYTE_REGISTER_NAMES;
 
 static int arg_regs[] = FUNCTION_ARG_REGISTERS;
 
-const char *bfin_library_id_string;
+/* The value passed to -mshared-library-id=.  */
+static int bfin_library_id;
 
 static void
 bfin_globalize_label (FILE *stream, const char *name)
@@ -776,8 +777,8 @@ bfin_expand_prologue (void)
     {
       rtx addr;
       
-      if (bfin_library_id_string)
-       addr = plus_constant (pic_offset_table_rtx, atoi (bfin_library_id_string));
+      if (bfin_lib_id_given)
+       addr = plus_constant (pic_offset_table_rtx, -4 - bfin_library_id * 4);
       else
        addr = gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
                             gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
@@ -1711,6 +1712,26 @@ secondary_output_reload_class (enum reg_class class, enum machine_mode mode,
   return secondary_input_reload_class (class, mode, x);
 }
 \f
+/* Implement TARGET_HANDLE_OPTION.  */
+
+static bool
+bfin_handle_option (size_t code, const char *arg, int value)
+{
+  switch (code)
+    {
+    case OPT_mshared_library_id_:
+      if (value > MAX_LIBRARY_ID)
+       error ("-mshared-library-id=%s is not between 0 and %d",
+              arg, MAX_LIBRARY_ID);
+      else
+       bfin_library_id = value;
+      return true;
+
+    default:
+      return true;
+    }
+}
+
 /* Implement the macro OVERRIDE_OPTIONS.  */
 
 void
@@ -1720,19 +1741,8 @@ override_options (void)
     flag_omit_frame_pointer = 1;
 
   /* Library identification */
-  if (bfin_library_id_string)
-    {
-      int id;
-
-      if (! TARGET_ID_SHARED_LIBRARY)
-       error ("-mshared-library-id= specified without -mid-shared-library");
-      id = atoi (bfin_library_id_string);
-      if (id < 0 || id > MAX_LIBRARY_ID)
-       error ("-mshared-library-id=%d is not between 0 and %d", id, MAX_LIBRARY_ID);
-
-      /* From now on, bfin_library_id_string will contain the library offset.  */
-      asprintf ((char **)&bfin_library_id_string, "%d", (id * -4) - 4);
-    }
+  if (bfin_lib_id_given && ! TARGET_ID_SHARED_LIBRARY)
+    error ("-mshared-library-id= specified without -mid-shared-library");
 
   if (TARGET_ID_SHARED_LIBRARY)
     /* ??? Provide a way to use a bigger GOT.  */
@@ -2725,4 +2735,7 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
 #undef TARGET_VECTOR_MODE_SUPPORTED_P
 #define TARGET_VECTOR_MODE_SUPPORTED_P bfin_vector_mode_supported_p
 
+#undef TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION bfin_handle_option
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index f5304e0..512525a 100644 (file)
@@ -50,20 +50,6 @@ extern int target_flags;
 
 #define TARGET_DEFAULT MASK_CSYNC
 
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
-   command options that have values.  Its definition is an
-   initializer with a subgrouping for each command option.
-
-   Each subgrouping contains a string constant, that defines the
-   fixed part of the option name, and the address of a variable.  The
-   variable, type `char *', is set to the variable part of the given
-   option if the fixed part matches.  The actual option name is made
-   by appending `-m' to the specified name.  */
-#define TARGET_OPTIONS                                                 \
-{ { "shared-library-id=",      &bfin_library_id_string,                \
-    "ID of shared library to build", 0}                                        \
-}
-
 /* Maximum number of library ids we permit */
 #define MAX_LIBRARY_ID 255
 
index b09d4dd..8a07bc3 100644 (file)
@@ -34,3 +34,7 @@ Avoid speculative loads by inserting CSYNC or equivalent
 mid-shared-library
 Target Report Mask(ID_SHARED_LIBRARY)
 Enabled ID based shared library
+
+mshared-library-id=
+Target RejectNegative Joined UInteger Var(bfin_lib_id_given)
+ID of shared library to build