From 6399c0abb3e562d7dc9cbf2f85998965dac1a1cb Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Tue, 29 May 2012 15:36:18 +0000 Subject: integrate.c: Remove. * integrate.c: Remove. * integrate.h: Remove. * Makefile.in: Remove make rules for integrate.c and INTEGRATE_H. * config/arm/t-arm: Remove INTEGRATE_H dependency for target files. * config/rs6000/t-rs6000: Likewise * config/spu/t-spu-elf: Likewise. * function.h (get_hard_reg_initial_val, has_hard_reg_initial_val, get_hard_reg_initial_reg, emit_initial_value_sets): Move prototypes from integrate.h to here. (initial_value_entry): New prototype. * reload.h (allocate_initial_values): Remove prototype. * tree.h (set_decl_abstract_flags, set_decl_origin_self): Likewise. * cse.c (fixed_base_plus_p): Don't handle virtual registers for integrate.c. * dwarf2out.c (set_decl_origin_self, set_block_origin_self, set_decl_abstract_flags, set_block_abstract_flags): Move from integrate.c to here, the only user. * expmed.c (extract_fixed_bit_field): Remove outdated comment about integrate.c. * function.c: Don't include integrate.h. (struct initial_value_pair, struct initial_value_struct, get_hard_reg_initial_val, has_hard_reg_initial_val, get_hard_reg_initial_reg, emit_initial_value_sets): Move from integrate.c to here. (initial_value_entry): New function. * genemit.c (main): Don't print integrate.h include line. * ira.c: Don't include integrate.h. (allocate_initial_values): Move from integrate.c to here. (ira): Update allocate_initial_values call. * tree-inline.c: Don't include integrate.h. (function_attribute_inlinable_p): Moved from integrate.c to here. * cfgexpand.c: Don't include integrate.h. * except.c: Likewise. * langhooks.c: Likewise. * passes.c: Likewise. * toplev.c: Likewise. * config/frv/frv.c: Likewise. * config/pa/pa.c: Likewise. * config/spu/spu.c: Likewise. * config/epiphany/epiphany.c: Likewise. * config/mep/mep.c: Likewise. * config/score/score.c: Likewise. * config/picochip/picochip.c: Likewise. * config/sh/sh.c: Likewise. * config/alpha/alpha.c: Likewise. * config/microblaze/microblaze.c: Likewise. * config/mips/mips.c: Likewise. * config/v850/v850.c: Likewise. * config/mmix/mmix.c: Likewise. * config/bfin/bfin.c: Likewise. * config/arm/arm.c: Likewise. * config/s390/s390.c: Likewise. * config/m32r/m32r.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/c6x/c6x.c: Include function.h instead of integrate.h. * config/tilegx/tilegx.c: Likewise. * config/tilepro/tilepro.c: Likewise. From-SVN: r187969 --- gcc/function.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 1 deletion(-) (limited to 'gcc/function.c') diff --git a/gcc/function.c b/gcc/function.c index 87edf7a..274d421 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -54,7 +54,6 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "ggc.h" #include "tm_p.h" -#include "integrate.h" #include "langhooks.h" #include "target.h" #include "common/common-target.h" @@ -1224,6 +1223,133 @@ init_temp_slots (void) htab_empty (temp_slot_address_table); } +/* Functions and data structures to keep track of the values hard regs + had at the start of the function. */ + +/* Private type used by get_hard_reg_initial_reg, get_hard_reg_initial_val, + and has_hard_reg_initial_val.. */ +typedef struct GTY(()) initial_value_pair { + rtx hard_reg; + rtx pseudo; +} initial_value_pair; +/* ??? This could be a VEC but there is currently no way to define an + opaque VEC type. This could be worked around by defining struct + initial_value_pair in function.h. */ +typedef struct GTY(()) initial_value_struct { + int num_entries; + int max_entries; + initial_value_pair * GTY ((length ("%h.num_entries"))) entries; +} initial_value_struct; + +/* If a pseudo represents an initial hard reg (or expression), return + it, else return NULL_RTX. */ + +rtx +get_hard_reg_initial_reg (rtx reg) +{ + struct initial_value_struct *ivs = crtl->hard_reg_initial_vals; + int i; + + if (ivs == 0) + return NULL_RTX; + + for (i = 0; i < ivs->num_entries; i++) + if (rtx_equal_p (ivs->entries[i].pseudo, reg)) + return ivs->entries[i].hard_reg; + + return NULL_RTX; +} + +/* Make sure that there's a pseudo register of mode MODE that stores the + initial value of hard register REGNO. Return an rtx for such a pseudo. */ + +rtx +get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno) +{ + struct initial_value_struct *ivs; + rtx rv; + + rv = has_hard_reg_initial_val (mode, regno); + if (rv) + return rv; + + ivs = crtl->hard_reg_initial_vals; + if (ivs == 0) + { + ivs = ggc_alloc_initial_value_struct (); + ivs->num_entries = 0; + ivs->max_entries = 5; + ivs->entries = ggc_alloc_vec_initial_value_pair (5); + crtl->hard_reg_initial_vals = ivs; + } + + if (ivs->num_entries >= ivs->max_entries) + { + ivs->max_entries += 5; + ivs->entries = GGC_RESIZEVEC (initial_value_pair, ivs->entries, + ivs->max_entries); + } + + ivs->entries[ivs->num_entries].hard_reg = gen_rtx_REG (mode, regno); + ivs->entries[ivs->num_entries].pseudo = gen_reg_rtx (mode); + + return ivs->entries[ivs->num_entries++].pseudo; +} + +/* See if get_hard_reg_initial_val has been used to create a pseudo + for the initial value of hard register REGNO in mode MODE. Return + the associated pseudo if so, otherwise return NULL. */ + +rtx +has_hard_reg_initial_val (enum machine_mode mode, unsigned int regno) +{ + struct initial_value_struct *ivs; + int i; + + ivs = crtl->hard_reg_initial_vals; + if (ivs != 0) + for (i = 0; i < ivs->num_entries; i++) + if (GET_MODE (ivs->entries[i].hard_reg) == mode + && REGNO (ivs->entries[i].hard_reg) == regno) + return ivs->entries[i].pseudo; + + return NULL_RTX; +} + +unsigned int +emit_initial_value_sets (void) +{ + struct initial_value_struct *ivs = crtl->hard_reg_initial_vals; + int i; + rtx seq; + + if (ivs == 0) + return 0; + + start_sequence (); + for (i = 0; i < ivs->num_entries; i++) + emit_move_insn (ivs->entries[i].pseudo, ivs->entries[i].hard_reg); + seq = get_insns (); + end_sequence (); + + emit_insn_at_entry (seq); + return 0; +} + +/* Return the hardreg-pseudoreg initial values pair entry I and + TRUE if I is a valid entry, or FALSE if I is not a valid entry. */ +bool +initial_value_entry (int i, rtx *hreg, rtx *preg) +{ + struct initial_value_struct *ivs = crtl->hard_reg_initial_vals; + if (!ivs || i >= ivs->num_entries) + return false; + + *hreg = ivs->entries[i].hard_reg; + *preg = ivs->entries[i].pseudo; + return true; +} + /* These routines are responsible for converting virtual register references to the actual hard register references once RTL generation is complete. -- cgit v1.1