Commit ca9052ce by Kenneth Zadeck

fwprop.c (update_df): Support width and offset parameters of df_ref_create.

2008-03-05  Kenneth Zadeck <zadeck@naturalbridge.com>

	* fwprop.c (update_df): Support width and offset parameters of
	df_ref_create.
	* ra-conflict.c (mark_reg_store, clear_reg_in_live,
	global_conflicts): Change DF_REF_EXTRACT to either
	DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT.  Change
	DF_REF_STRICT_LOWER_PART to DF_REF_STRICT_LOW_PART.
	* df-scan.c (df_ref_record, df_defs_record,
	df_ref_create_structure, df_def_record_1, df_uses_record,
	df_get_conditional_uses, df_get_call_refs, df_insn_refs_collect,
	df_bb_refs_collect, df_entry_block_defs_collect,
	df_exit_block_uses_collect): Support new width and offset fields.
	(ref_extract_pool): New storage pool.
	(df_free_ref): New function.
	(df_reg_chain_unlink, df_free_collection_rec,
	df_sort_and_compress_refs): Call df_free_ref.
	(df_ref_equal_p, df_ref_compare): Compare offset and width fields
	of df_ref_extract.
	(df_ref_create_structure): Allocate df_ref_extract if offset and
	width fields are used.
	(df_def_record_1): Get offset and width from ZERO_EXTRACT.
	(df_uses_record): Get offset and width from ZERO_EXTRACT 
	and SIGN_EXTRACT.
	* global.c (build_insn_chain): Change DF_REF_EXTRACT to either
	DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT.  Change
	DF_REF_STRICT_LOWER_PART to DF_REF_STRICT_LOW_PART.
	* df.h (df_ref_flags): Change DF_REF_EXTRACT to either
	DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT.  Change
	DF_REF_STRICT_LOWER_PART to DF_REF_STRICT_LOW_PART.
	(df_ref_extract): New structure.
	(DF_REF_WIDTH, DF_REF_OFFSET): New macros.
	(df_ref_create): Add width and offset parameters.

From-SVN: r132962
parent 256fe3d7
2008-03-05 Kenneth Zadeck <zadeck@naturalbridge.com>
* fwprop.c (update_df): Support width and offset parameters of
df_ref_create.
* ra-conflict.c (mark_reg_store, clear_reg_in_live,
global_conflicts): Change DF_REF_EXTRACT to either
DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT. Change
DF_REF_STRICT_LOWER_PART to DF_REF_STRICT_LOW_PART.
* df-scan.c (df_ref_record, df_defs_record,
df_ref_create_structure, df_def_record_1, df_uses_record,
df_get_conditional_uses, df_get_call_refs, df_insn_refs_collect,
df_bb_refs_collect, df_entry_block_defs_collect,
df_exit_block_uses_collect): Support new width and offset fields.
(ref_extract_pool): New storage pool.
(df_free_ref): New function.
(df_reg_chain_unlink, df_free_collection_rec,
df_sort_and_compress_refs): Call df_free_ref.
(df_ref_equal_p, df_ref_compare): Compare offset and width fields
of df_ref_extract.
(df_ref_create_structure): Allocate df_ref_extract if offset and
width fields are used.
(df_def_record_1): Get offset and width from ZERO_EXTRACT.
(df_uses_record): Get offset and width from ZERO_EXTRACT
and SIGN_EXTRACT.
* global.c (build_insn_chain): Change DF_REF_EXTRACT to either
DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT. Change
DF_REF_STRICT_LOWER_PART to DF_REF_STRICT_LOW_PART.
* df.h (df_ref_flags): Change DF_REF_EXTRACT to either
DF_REF_ZERO_EXTRACT or DF_REF_SIGN_EXTRACT. Change
DF_REF_STRICT_LOWER_PART to DF_REF_STRICT_LOW_PART.
(df_ref_extract): New structure.
(DF_REF_WIDTH, DF_REF_OFFSET): New macros.
(df_ref_create): Add width and offset parameters.
2008-03-05 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (get_constraint_for_component_ref):
......@@ -135,6 +169,7 @@
transformations for modes that have signed zeros.
* ifcvt.c (noce_try_abs): Ditto.
>>>>>>> .r132956
2008-03-04 Joseph Myers <joseph@codesourcery.com>
* config/i386/i386.c (override_options): Force
......
......@@ -117,14 +117,18 @@ enum df_ref_flags
DF_REF_MUST_CLOBBER = 1 << 7,
/* This flag is set if this ref is inside a pre/post modify. */
DF_REF_PRE_POST_MODIFY = 1 << 8,
/* If the ref has one of the following two flags set, then the
struct df_ref can be cast to struct df_ref_extract to access
the width and offset fields. */
/* This flag is set if the ref contains a SIGN_EXTRACT. */
DF_REF_SIGN_EXTRACT = 1 << 8,
/* This flag is set if the ref contains a ZERO_EXTRACT or SIGN_EXTRACT. */
DF_REF_EXTRACT = 1 << 9,
/* This flag is set if the ref contains a ZERO_EXTRACT. */
DF_REF_ZERO_EXTRACT = 1 << 9,
/* This flag is set if the ref contains a STRICT_LOWER_PART. */
DF_REF_STRICT_LOWER_PART = 1 << 10,
/* This flag is set if the ref contains a STRICT_LOW_PART. */
DF_REF_STRICT_LOW_PART = 1 << 10,
/* This flag is set if the ref contains a SUBREG. */
DF_REF_SUBREG = 1 << 11,
......@@ -138,7 +142,11 @@ enum df_ref_flags
DF_REF_CALL_STACK_USAGE = 1 << 13,
/* This flag is used for verification of existing refs. */
DF_REF_REG_MARKER = 1 << 14
DF_REF_REG_MARKER = 1 << 14,
/* This flag is set if this ref is inside a pre/post modify. */
DF_REF_PRE_POST_MODIFY = 1 << 15
};
/* The possible ordering of refs within the df_ref_info. */
......@@ -381,6 +389,17 @@ struct df_ref
struct df_ref *prev_reg; /* Prev ref with same regno and type. */
};
/* A df_ref_extract is just a df_ref with a width and offset field at
the end of it. It is used to hold this information if the ref was
wrapped by a SIGN_EXTRACT or a ZERO_EXTRACT and to pass this info
to passes that wish to process partial regs precisely. */
struct df_ref_extract
{
struct df_ref ref;
int width;
int offset;
};
/* These links are used for two purposes:
1) def-use or use-def chains.
2) Multiword hard registers that underly a single hardware register. */
......@@ -598,7 +617,10 @@ struct df
#define DF_REF_IS_REG_MARKED(REF) (DF_REF_FLAGS_IS_SET ((REF),DF_REF_REG_MARKER))
#define DF_REF_NEXT_REG(REF) ((REF)->next_reg)
#define DF_REF_PREV_REG(REF) ((REF)->prev_reg)
/* The following two macros may only be applied if one of
DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT is true. */
#define DF_REF_WIDTH(REF) (((struct df_ref_extract *)(REF))->width)
#define DF_REF_OFFSET(REF) (((struct df_ref_extract *)(REF))->offset)
/* Macros to determine the reference type. */
#define DF_REF_REG_DEF_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_DEF)
......@@ -862,7 +884,8 @@ extern void df_grow_reg_info (void);
extern void df_grow_insn_info (void);
extern void df_scan_blocks (void);
extern struct df_ref *df_ref_create (rtx, rtx *, rtx,basic_block,
enum df_ref_type, enum df_ref_flags);
enum df_ref_type, enum df_ref_flags,
int, int);
extern void df_ref_remove (struct df_ref *);
extern struct df_insn_info * df_insn_create_insn_record (rtx);
extern void df_insn_delete (basic_block, unsigned int);
......
......@@ -642,17 +642,25 @@ update_df (rtx insn, rtx *loc, struct df_ref **use_rec, enum df_ref_type type,
{
struct df_ref *use = *use_rec;
struct df_ref *orig_use = use, *new_use;
int width = -1;
int offset = -1;
rtx *new_loc = find_occurrence (loc, DF_REF_REG (orig_use));
use_rec++;
if (!new_loc)
continue;
if (DF_REF_FLAGS_IS_SET (orig_use, DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT))
{
width = DF_REF_WIDTH (orig_use);
offset = DF_REF_OFFSET (orig_use);
}
/* Add a new insn use. Use the original type, because it says if the
use was within a MEM. */
new_use = df_ref_create (DF_REF_REG (orig_use), new_loc,
insn, BLOCK_FOR_INSN (insn),
type, DF_REF_FLAGS (orig_use) | new_flags);
type, DF_REF_FLAGS (orig_use) | new_flags, width, offset);
/* Set up the use-def chain. */
df_chain_copy (new_use, DF_REF_CHAIN (orig_use));
......
......@@ -1490,7 +1490,7 @@ build_insn_chain (void)
/* We can model subregs, but not if they are
wrapped in ZERO_EXTRACTS. */
if (GET_CODE (reg) == SUBREG
&& !DF_REF_FLAGS_IS_SET (def, DF_REF_EXTRACT))
&& !DF_REF_FLAGS_IS_SET (def, DF_REF_ZERO_EXTRACT))
{
unsigned int start = SUBREG_BYTE (reg);
unsigned int last = start
......@@ -1503,7 +1503,7 @@ build_insn_chain (void)
regno, reg);
if (!DF_REF_FLAGS_IS_SET
(def, DF_REF_STRICT_LOWER_PART))
(def, DF_REF_STRICT_LOW_PART))
{
/* Expand the range to cover entire words.
Bytes added here are "don't care". */
......@@ -1566,7 +1566,7 @@ build_insn_chain (void)
precisely so we do not need to look at the
fabricated use. */
if (DF_REF_FLAGS_IS_SET (use, DF_REF_READ_WRITE)
&& !DF_REF_FLAGS_IS_SET (use, DF_REF_EXTRACT)
&& !DF_REF_FLAGS_IS_SET (use, DF_REF_ZERO_EXTRACT)
&& DF_REF_FLAGS_IS_SET (use, DF_REF_SUBREG))
continue;
......@@ -1585,7 +1585,8 @@ build_insn_chain (void)
if (regno < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
{
if (GET_CODE (reg) == SUBREG
&& !DF_REF_FLAGS_IS_SET (use, DF_REF_EXTRACT))
&& !DF_REF_FLAGS_IS_SET (use,
DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT))
{
unsigned int start = SUBREG_BYTE (reg);
unsigned int last = start
......
......@@ -297,7 +297,7 @@ mark_reg_store (sparseset allocnos_live,
{
unsigned int start = regno;
unsigned int last = end_hard_regno (mode, regno);
if ((GET_CODE (reg) == SUBREG) && !DF_REF_FLAGS_IS_SET (ref, DF_REF_EXTRACT))
if ((GET_CODE (reg) == SUBREG) && !DF_REF_FLAGS_IS_SET (ref, DF_REF_ZERO_EXTRACT))
{
start += subreg_regno_offset (regno, GET_MODE (SUBREG_REG (reg)),
SUBREG_BYTE (reg), GET_MODE (reg));
......@@ -457,7 +457,7 @@ clear_reg_in_live (sparseset allocnos_live,
if (allocnum >= 0)
{
if (GET_CODE (reg) == SUBREG
&& !DF_REF_FLAGS_IS_SET (def, DF_REF_EXTRACT))
&& !DF_REF_FLAGS_IS_SET (def, DF_REF_ZERO_EXTRACT))
{
unsigned int start = SUBREG_BYTE (reg);
unsigned int last = start + GET_MODE_SIZE (GET_MODE (reg));
......@@ -465,7 +465,7 @@ clear_reg_in_live (sparseset allocnos_live,
ra_init_live_subregs (sparseset_bit_p (allocnos_live, allocnum),
live_subregs, live_subregs_used, allocnum, reg);
if (!DF_REF_FLAGS_IS_SET (def, DF_REF_STRICT_LOWER_PART))
if (!DF_REF_FLAGS_IS_SET (def, DF_REF_STRICT_LOW_PART))
{
/* Expand the range to cover entire words.
Bytes added here are "don't care". */
......@@ -511,7 +511,7 @@ clear_reg_in_live (sparseset allocnos_live,
{
unsigned int start = regno;
if (GET_CODE (reg) == SUBREG
&& !DF_REF_FLAGS_IS_SET (def, DF_REF_EXTRACT))
&& !DF_REF_FLAGS_IS_SET (def, DF_REF_ZERO_EXTRACT))
{
unsigned int last;
start += SUBREG_BYTE (reg);
......@@ -864,7 +864,7 @@ global_conflicts (void)
rtx reg = DF_REF_REG (def);
set_reg_in_live (allocnos_live, live_subregs, live_subregs_used,
&hard_regs_live, reg,
DF_REF_FLAGS_IS_SET (def, DF_REF_EXTRACT));
DF_REF_FLAGS_IS_SET (def, DF_REF_ZERO_EXTRACT));
if (dump_file)
dump_ref (dump_file, " adding def", "\n",
reg, DF_REF_REGNO (def), live_subregs, live_subregs_used);
......@@ -946,7 +946,7 @@ global_conflicts (void)
use unless that set also happens to wrapped in a
ZERO_EXTRACT. */
if (DF_REF_FLAGS_IS_SET (use, DF_REF_READ_WRITE)
&& (!DF_REF_FLAGS_IS_SET (use, DF_REF_EXTRACT))
&& (!DF_REF_FLAGS_IS_SET (use, DF_REF_ZERO_EXTRACT))
&& DF_REF_FLAGS_IS_SET (use, DF_REF_SUBREG))
continue;
......@@ -957,7 +957,7 @@ global_conflicts (void)
if (allocnum >= 0)
{
if (GET_CODE (reg) == SUBREG
&& !DF_REF_FLAGS_IS_SET (use, DF_REF_EXTRACT))
&& !DF_REF_FLAGS_IS_SET (use, DF_REF_ZERO_EXTRACT))
{
unsigned int start = SUBREG_BYTE (reg);
unsigned int last = start + GET_MODE_SIZE (GET_MODE (reg));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment