aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2010-07-12 18:53:17 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2010-07-12 18:53:17 +0000
commit5fb0e246f4d16dd1f341cc34ded11eb4813fe50d (patch)
treecafe482a7a09e052682a76fb7e607508ee8298a3
parent939dcd0d38af0571a15f1bcff788d593ed33d5eb (diff)
downloadgcc-5fb0e246f4d16dd1f341cc34ded11eb4813fe50d.zip
gcc-5fb0e246f4d16dd1f341cc34ded11eb4813fe50d.tar.gz
gcc-5fb0e246f4d16dd1f341cc34ded11eb4813fe50d.tar.bz2
Makefile.in (target-globals.o): Depend on $(RTL_H).
gcc/ * Makefile.in (target-globals.o): Depend on $(RTL_H). * rtl.h: (target_rtl): New structure. (default_target_rtl): Declare. (this_target_rtl): Declare as a variable or define as a macro. (global_rtl, pic_offset_table_rtx, return_address_pointer_rtx): Redefine as macros. * emit-rtl.c (default_target_rtl): New variable. (this_target_rtl): New conditional variable. (global_rtl, static_regno_reg_rtx, pic_offset_table_rtx) (return_address_pointer_rtx): Delete. (initial_regno_reg_rtx): New macro. (init_emit): Use initial_regno_reg_rtx instead of static_regno_reg_rtx. (init_emit_regs): Likewise. * target-globals.h (this_target_rtl): Declare. (target_globals): Add a rtl field. (restore_target_globals): Copy the rtl field to this_target_rtl. * target-globals.c: Include rtl.h. (default_target_globals): Initialize the rtl field. (save_target_globals): Likewise. From-SVN: r162088
-rw-r--r--gcc/ChangeLog22
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/emit-rtl.c48
-rw-r--r--gcc/rtl.h52
-rw-r--r--gcc/target-globals.c5
-rw-r--r--gcc/target-globals.h3
6 files changed, 86 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eec56ce..16b7772 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,27 @@
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+ * Makefile.in (target-globals.o): Depend on $(RTL_H).
+ * rtl.h: (target_rtl): New structure.
+ (default_target_rtl): Declare.
+ (this_target_rtl): Declare as a variable or define as a macro.
+ (global_rtl, pic_offset_table_rtx, return_address_pointer_rtx):
+ Redefine as macros.
+ * emit-rtl.c (default_target_rtl): New variable.
+ (this_target_rtl): New conditional variable.
+ (global_rtl, static_regno_reg_rtx, pic_offset_table_rtx)
+ (return_address_pointer_rtx): Delete.
+ (initial_regno_reg_rtx): New macro.
+ (init_emit): Use initial_regno_reg_rtx instead of static_regno_reg_rtx.
+ (init_emit_regs): Likewise.
+ * target-globals.h (this_target_rtl): Declare.
+ (target_globals): Add a rtl field.
+ (restore_target_globals): Copy the rtl field to this_target_rtl.
+ * target-globals.c: Include rtl.h.
+ (default_target_globals): Initialize the rtl field.
+ (save_target_globals): Likewise.
+
+2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+
* Makefile.in (target-globals.o): Depend on $(REGS_H).
* regs.h (target_reg_modes): New structure.
(default_target_reg_modes): Declare.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 1365227..919c5ae 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3477,7 +3477,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H)
target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) $(TOPLEV_H) target-globals.h \
- $(FLAGS_H) $(REGS_H)
+ $(FLAGS_H) $(REGS_H) $(RTL_H)
$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index da7677a..bb9f63a 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -61,6 +61,13 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "target.h"
+struct target_rtl default_target_rtl;
+#if SWITCHABLE_TARGET
+struct target_rtl *this_target_rtl = &default_target_rtl;
+#endif
+
+#define initial_regno_reg_rtx (this_target_rtl->x_initial_regno_reg_rtx)
+
/* Commonly used modes. */
enum machine_mode byte_mode; /* Mode whose width is BITS_PER_UNIT. */
@@ -84,19 +91,6 @@ rtx * regno_reg_rtx;
static GTY(()) int label_num = 1;
-/* Commonly used rtx's, so that we only need space for one copy.
- These are initialized once for the entire compilation.
- All of these are unique; no other rtx-object will be equal to any
- of these. */
-
-rtx global_rtl[GR_MAX];
-
-/* Commonly used RTL for hard registers. These objects are not necessarily
- unique, so we allocate them separately from global_rtl. They are
- initialized once per compilation unit, then copied into regno_reg_rtx
- at the beginning of each function. */
-static GTY(()) rtx static_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
-
/* We record floating-point CONST_DOUBLEs in each floating-point mode for
the values of 0, 1, and 2. For the integer entries and VOIDmode, we
record a copy of const[012]_rtx. */
@@ -115,30 +109,6 @@ REAL_VALUE_TYPE dconsthalf;
FIXED_VALUE_TYPE fconst0[MAX_FCONST0];
FIXED_VALUE_TYPE fconst1[MAX_FCONST1];
-/* All references to the following fixed hard registers go through
- these unique rtl objects. On machines where the frame-pointer and
- arg-pointer are the same register, they use the same unique object.
-
- After register allocation, other rtl objects which used to be pseudo-regs
- may be clobbered to refer to the frame-pointer register.
- But references that were originally to the frame-pointer can be
- distinguished from the others because they contain frame_pointer_rtx.
-
- When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
- tricky: until register elimination has taken place hard_frame_pointer_rtx
- should be used if it is being set, and frame_pointer_rtx otherwise. After
- register elimination hard_frame_pointer_rtx should always be used.
- On machines where the two registers are same (most) then these are the
- same.
-
- In an inline procedure, the stack and frame pointer rtxs may not be
- used for anything else. */
-rtx pic_offset_table_rtx; /* (REG:Pmode PIC_OFFSET_TABLE_REGNUM) */
-
-/* This is used to implement __builtin_return_address for some machines.
- See for instance the MIPS port. */
-rtx return_address_pointer_rtx; /* (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM) */
-
/* We make one copy of (const_int C) where C is in
[- MAX_SAVED_CONST_INT, MAX_SAVED_CONST_INT]
to save space during the compilation and simplify comparisons of
@@ -5576,7 +5546,7 @@ init_emit (void)
/* Put copies of all the hard registers into regno_reg_rtx. */
memcpy (regno_reg_rtx,
- static_regno_reg_rtx,
+ initial_regno_reg_rtx,
FIRST_PSEUDO_REGISTER * sizeof (rtx));
/* Put copies of all the virtual register rtx into regno_reg_rtx. */
@@ -5703,7 +5673,7 @@ init_emit_regs (void)
/* Initialize RTL for commonly used hard registers. These are
copied into regno_reg_rtx as we begin to compile each function. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- static_regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i);
+ initial_regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i);
#ifdef RETURN_ADDRESS_POINTER_REGNUM
return_address_pointer_rtx
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 6cc44b9..366b5fd 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2006,8 +2006,53 @@ enum global_rtl_index
GR_MAX
};
-/* Pointers to standard pieces of rtx are stored here. */
-extern GTY(()) rtx global_rtl[GR_MAX];
+/* Target-dependent globals. */
+struct GTY(()) target_rtl {
+ /* All references to the hard registers in global_rtl_index go through
+ these unique rtl objects. On machines where the frame-pointer and
+ arg-pointer are the same register, they use the same unique object.
+
+ After register allocation, other rtl objects which used to be pseudo-regs
+ may be clobbered to refer to the frame-pointer register.
+ But references that were originally to the frame-pointer can be
+ distinguished from the others because they contain frame_pointer_rtx.
+
+ When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
+ tricky: until register elimination has taken place hard_frame_pointer_rtx
+ should be used if it is being set, and frame_pointer_rtx otherwise. After
+ register elimination hard_frame_pointer_rtx should always be used.
+ On machines where the two registers are same (most) then these are the
+ same. */
+ rtx x_global_rtl[GR_MAX];
+
+ /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
+ rtx x_pic_offset_table_rtx;
+
+ /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
+ This is used to implement __builtin_return_address for some machines;
+ see for instance the MIPS port. */
+ rtx x_return_address_pointer_rtx;
+
+ /* Commonly used RTL for hard registers. These objects are not
+ necessarily unique, so we allocate them separately from global_rtl.
+ They are initialized once per compilation unit, then copied into
+ regno_reg_rtx at the beginning of each function. */
+ rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
+};
+
+extern GTY(()) struct target_rtl default_target_rtl;
+#if SWITCHABLE_TARGET
+extern struct target_rtl *this_target_rtl;
+#else
+#define this_target_rtl (&default_target_rtl)
+#endif
+
+#define global_rtl \
+ (this_target_rtl->x_global_rtl)
+#define pic_offset_table_rtx \
+ (this_target_rtl->x_pic_offset_table_rtx)
+#define return_address_pointer_rtx \
+ (this_target_rtl->x_return_address_pointer_rtx)
/* Standard pieces of rtx, to be substituted directly into things. */
#define pc_rtx (global_rtl[GR_PC])
@@ -2021,9 +2066,6 @@ extern GTY(()) rtx global_rtl[GR_MAX];
#define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
#define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
-extern GTY(()) rtx pic_offset_table_rtx;
-extern GTY(()) rtx return_address_pointer_rtx;
-
/* Include the RTL generation functions. */
#ifndef GENERATOR_FILE
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index 3a7f2d4..26b2fa3 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -28,11 +28,13 @@ along with GCC; see the file COPYING3. If not see
#include "target-globals.h"
#include "flags.h"
#include "regs.h"
+#include "rtl.h"
#if SWITCHABLE_TARGET
struct target_globals default_target_globals = {
&default_target_flag_state,
- &default_target_regs
+ &default_target_regs,
+ &default_target_rtl
};
struct target_globals *
@@ -43,6 +45,7 @@ save_target_globals (void)
g = ggc_alloc_target_globals ();
g->flag_state = XCNEW (struct target_flag_state);
g->regs = XCNEW (struct target_regs);
+ g->rtl = ggc_alloc_cleared_target_rtl ();
restore_target_globals (g);
target_reinit ();
return g;
diff --git a/gcc/target-globals.h b/gcc/target-globals.h
index a733aa5..f8db59c 100644
--- a/gcc/target-globals.h
+++ b/gcc/target-globals.h
@@ -23,10 +23,12 @@ along with GCC; see the file COPYING3. If not see
#if SWITCHABLE_TARGET
extern struct target_flag_state *this_target_flag_state;
extern struct target_regs *this_target_regs;
+extern struct target_rtl *this_target_rtl;
struct GTY(()) target_globals {
struct target_flag_state *GTY((skip)) flag_state;
struct target_regs *GTY((skip)) regs;
+ struct target_rtl *rtl;
};
extern struct target_globals default_target_globals;
@@ -38,6 +40,7 @@ restore_target_globals (struct target_globals *g)
{
this_target_flag_state = g->flag_state;
this_target_regs = g->regs;
+ this_target_rtl = g->rtl;
}
#endif