summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2010-06-29 14:38:13 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2010-06-29 15:38:13 +0100
commit74f7912ac84090b59ebc8fffa51893b167a0552a (patch)
tree59640e76d8830768e1fbdfbf9ed5e3164eca252d
parent20a6bb58201d19ef46edaa44266c2dc2e992b365 (diff)
downloadgcc-74f7912ac84090b59ebc8fffa51893b167a0552a.tar.gz
tm.texi (TARGET_OPTION_OVERRIDE): Document.
* doc/tm.texi (TARGET_OPTION_OVERRIDE): Document. (OVERRIDE_OPTIONS): Add note of obsolescence. Replace references with references to TARGET_OPTION_OVERRIDE. (Except for C_COMMON_OVERRIDE_OPTIONS, which remains similar to the macro). * targhooks.c (default_target_option_override): New function. * targhooks.h (default_target_option_override): Declare. * target.h (struct gcc_target): Add override member to target_option emmber. * toplev.c (process_options): Replace OVERRIDE_OPTIONS use with targetm.target_option.override call. * target-def.h (TARGET_OPTION_OVERRIDE): Define. (TARGET_OPTION_HOOKS): Add TARGET_OPTION_OVERRIDE. From-SVN: r161538
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/doc/tm.texi31
-rw-r--r--gcc/target-def.h5
-rw-r--r--gcc/target.h3
-rw-r--r--gcc/targhooks.c8
-rw-r--r--gcc/targhooks.h1
-rw-r--r--gcc/toplev.c4
7 files changed, 58 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f84221b063..28db8c5ee93 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2010-06-29 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * doc/tm.texi (TARGET_OPTION_OVERRIDE): Document.
+ (OVERRIDE_OPTIONS): Add note of obsolescence.
+ Replace references with references to TARGET_OPTION_OVERRIDE.
+ (Except for C_COMMON_OVERRIDE_OPTIONS, which remains similar to
+ the macro).
+ * targhooks.c (default_target_option_override): New function.
+ * targhooks.h (default_target_option_override): Declare.
+ * target.h (struct gcc_target): Add override member to
+ target_option emmber.
+ * toplev.c (process_options): Replace OVERRIDE_OPTIONS use with
+ targetm.target_option.override call.
+ * target-def.h (TARGET_OPTION_OVERRIDE): Define.
+ (TARGET_OPTION_HOOKS): Add TARGET_OPTION_OVERRIDE.
+
2010-06-29 Jan Hubicka <jh@suse.cz>
* tree-inline.c: Replace incomming by incomin and clonning by cloning.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 81665c310aa..2290fd4ec47 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -786,15 +786,18 @@ Don't use this macro to turn on various extra optimizations for
If you need to do something whenever the optimization level is
changed via the optimize attribute or pragma, see
@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
+
+This macros is obsolete, new ports should use the target hook
+@code{TARGET_OPTION_OVERRIDE} instead.
@end defmac
@deftypefn {Target Hook} void TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE (void)
-This target function is similar to the macro @code{OVERRIDE_OPTIONS}
+This target function is similar to the hook @code{TARGET_OPTION_OVERRIDE}
but is called when the optimize level is changed via an attribute or
pragma or when it is reset at the end of the code affected by the
attribute or pragma. It is not called at the beginning of compilation
-when @code{OVERRIDE_OPTIONS} is called so if you want to perform these
-actions then, you should have @code{OVERRIDE_OPTIONS} call
+when @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform these
+actions then, you should have @code{TARGET_OPTION_OVERRIDE} call
@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.
@end deftypefn
@@ -8839,7 +8842,7 @@ define the macro.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @var{align_jumps} in the target's
-@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
@end defmac
@@ -8868,7 +8871,7 @@ define the macro.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @code{align_loops} in the target's
-@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
@end defmac
@@ -8884,7 +8887,7 @@ the maximum of the specified values is used.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @code{align_labels} in the target's
-@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
+@code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
@end defmac
@@ -9356,7 +9359,7 @@ in response to the @option{-g} option. The default behavior for VMS
is to generate minimal debug info for a traceback in the absence of
@option{-g} unless explicitly overridden with @option{-g0}. This
behavior is controlled by @code{OPTIMIZATION_OPTIONS} and
-@code{OVERRIDE_OPTIONS}.
+@code{TARGET_OPTION_OVERRIDE}.
@end defmac
@node Floating Point
@@ -9698,6 +9701,20 @@ input stream. The options should be the same as handled by the
@code{TARGET_VALID_OPTION_ATTRIBUTE_P} hook.
@end deftypefn
+@deftypefn {Target Hook} void TARGET_OPTION_OVERRIDE (void)
+Sometimes certain combinations of command options do not make sense on
+a particular target machine. You can override the hook
+@code{TARGET_OPTION_OVERRIDE} to take account of this. This hooks is called
+once just after all the command options have been parsed.
+
+Don't use this hook to turn on various extra optimizations for
+@option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
+
+If you need to do something whenever the optimization level is
+changed via the optimize attribute or pragma, see
+@code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee})
This target hook returns @code{false} if the @var{caller} function
cannot inline @var{callee}, based on target specific information. By
diff --git a/gcc/target-def.h b/gcc/target-def.h
index a0c2ca60f1a..00b66c62c33 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -971,6 +971,10 @@
#define TARGET_OPTION_PRAGMA_PARSE default_target_option_pragma_parse
#endif
+#ifndef TARGET_OPTION_OVERRIDE
+#define TARGET_OPTION_OVERRIDE default_target_option_override
+#endif
+
#ifndef TARGET_CAN_INLINE_P
#define TARGET_CAN_INLINE_P default_target_can_inline_p
#endif
@@ -982,6 +986,7 @@
TARGET_OPTION_RESTORE, \
TARGET_OPTION_PRINT, \
TARGET_OPTION_PRAGMA_PARSE, \
+ TARGET_OPTION_OVERRIDE, \
TARGET_CAN_INLINE_P, \
}
diff --git a/gcc/target.h b/gcc/target.h
index 6ced77061cf..71b4d202a98 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -1264,6 +1264,9 @@ struct gcc_target
true if the options are valid, and set the current state. */
bool (*pragma_parse) (tree, tree);
+ /* Do option overrides for the target. */
+ void (*override) (void);
+
/* Function to determine if one function can inline another function. */
bool (*can_inline_p) (tree, tree);
} target_option;
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index f2fe0795fbc..128a5cb448c 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -910,6 +910,14 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
return rclass;
}
+void
+default_target_option_override (void)
+{
+#ifdef OVERRIDE_OPTIONS
+ OVERRIDE_OPTIONS;
+#endif
+}
+
bool
default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
const char *arg ATTRIBUTE_UNUSED,
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 393b12f1367..f6e1ddce00f 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -122,6 +122,7 @@ extern const enum reg_class *default_ira_cover_classes (void);
extern enum reg_class default_secondary_reload (bool, rtx, enum reg_class,
enum machine_mode,
secondary_reload_info *);
+extern void default_target_option_override (void);
extern void hook_void_bitmap (bitmap);
extern bool default_handle_c_option (size_t, const char *, int);
extern int default_reloc_rw_mask (void);
diff --git a/gcc/toplev.c b/gcc/toplev.c
index c22cb98fd62..276ae7ed4f1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1761,10 +1761,8 @@ process_options (void)
so we can correctly initialize debug output. */
no_backend = lang_hooks.post_options (&main_input_filename);
-#ifdef OVERRIDE_OPTIONS
/* Some machines may reject certain combinations of options. */
- OVERRIDE_OPTIONS;
-#endif
+ targetm.target_option.override ();
/* Avoid any informative notes in the second run of -fcompare-debug. */
if (flag_compare_debug)