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]

[gcc-in-cxx] Return reg_class from branch_target_register_class


This patch changes the target hook branch_target_register_class to
return an enum reg_class rather than an int.  There are other hooks in
target.h which already return reg_class, and this one should as well.
This avoids an enum mismatch in bt-load.c.

This also corrects the prototype of the needs_block_p prototype, which
broke due to a bad merge.

Committed to gcc-in-cxx branch.

Ian


2009-01-31  Ian Lance Taylor  <iant@google.com>

	* target.h (struct sched): Correct needs_block_p prototype.
	(struct gcc_target): Change return type of
	branch_target_register_class to enum reg_class.
	* target-def.h (TARGET_BRANCH_TARGET_REGISTER_CLASS): Change to
	default_branch_target_register_class.
	* targhooks.h (default_branch_target_register_class): Declare.
	* targhooks.c (default_branch_target_register_class): Define.


Index: targhooks.h
===================================================================
--- targhooks.h	(revision 143841)
+++ targhooks.h	(working copy)
@@ -85,6 +85,7 @@ extern int hook_int_CUMULATIVE_ARGS_mode
   (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
 extern const char *hook_invalid_arg_for_unprototyped_fn
   (const_tree, const_tree, const_tree);
+extern enum reg_class default_branch_target_register_class (void);
 extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
 extern rtx default_function_value (const_tree, const_tree, bool);
 extern rtx default_internal_arg_pointer (void);
Index: targhooks.c
===================================================================
--- targhooks.c	(revision 143841)
+++ targhooks.c	(working copy)
@@ -531,6 +531,12 @@ default_hidden_stack_protect_fail (void)
 #endif
 }
 
+enum reg_class
+default_branch_target_register_class (void)
+{
+  return NO_REGS;
+}
+
 bool
 hook_bool_const_rtx_commutative_p (const_rtx x,
 				   int outer_code ATTRIBUTE_UNUSED)
Index: target.h
===================================================================
--- target.h	(revision 143841)
+++ target.h	(working copy)
@@ -397,7 +397,7 @@ struct sched
   /* The following member value is a pointer to a function called
      by the insn scheduler.  It should return true if the check instruction
      passed as the parameter needs a recovery block.  */
-  bool (* needs_block_p) (const_rtx);
+  bool (* needs_block_p) (int);
 
   /* The following member value is a pointer to a function called
      by the insn scheduler.  It should return a pattern for the check
@@ -789,7 +789,7 @@ struct gcc_target
 
   /* Return a register class for which branch target register
      optimizations should be applied.  */
-  int (* branch_target_register_class) (void);
+  enum reg_class (* branch_target_register_class) (void);
 
   /* Return true if branch target register optimizations should include
      callee-saved registers that are not already live during the current
Index: target-def.h
===================================================================
--- target-def.h	(revision 143841)
+++ target-def.h	(working copy)
@@ -479,7 +479,7 @@
 
 /* In hooks.c.  */
 #define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false
-#define TARGET_BRANCH_TARGET_REGISTER_CLASS hook_int_void_no_regs
+#define TARGET_BRANCH_TARGET_REGISTER_CLASS default_branch_target_register_class
 #define TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED hook_bool_bool_false
 #define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false
 #define TARGET_CANNOT_COPY_INSN_P NULL

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