mips-protos.h (SYMBOL_GENERAL): Rename to...

gcc/
	* config/mips/mips-protos.h (SYMBOL_GENERAL): Rename to...
	(SYMBOL_ABSOLUTE): ...this.
	(SYMBOL_SMALL_DATA): Rename to...
	(SYMBOL_GP_RELATIVE): ...this.
	(SYMBOL_CONSTANT_POOL): Rename to...
	(SYMBOL_PC_RELATIVE): ...this.
	* config/mips/mips.c (mips_classify_symbol, mips_symbolic_constant_p)
	(mips_symbolic_address_p, mips_symbol_insns, override_options)
	(mips_rewrite_small_data_p, mips_use_anchors_for_symbol_p): Update
	after above changes.
	* config/mips/predicates.md (const_call_insn_operand): Likewise.
	(general_symbolic_operand): Rename to...
	(absolute_symbolic_operand): ...this.
	* config/mips/mips.md: Update after above changes.

From-SVN: r127294
This commit is contained in:
Richard Sandiford 2007-08-08 15:06:05 +00:00 committed by Richard Sandiford
parent 76b4f0f724
commit 67da85da79
5 changed files with 65 additions and 45 deletions

View File

@ -1,3 +1,20 @@
2007-08-08 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips-protos.h (SYMBOL_GENERAL): Rename to...
(SYMBOL_ABSOLUTE): ...this.
(SYMBOL_SMALL_DATA): Rename to...
(SYMBOL_GP_RELATIVE): ...this.
(SYMBOL_CONSTANT_POOL): Rename to...
(SYMBOL_PC_RELATIVE): ...this.
* config/mips/mips.c (mips_classify_symbol, mips_symbolic_constant_p)
(mips_symbolic_address_p, mips_symbol_insns, override_options)
(mips_rewrite_small_data_p, mips_use_anchors_for_symbol_p): Update
after above changes.
* config/mips/predicates.md (const_call_insn_operand): Likewise.
(general_symbolic_operand): Rename to...
(absolute_symbolic_operand): ...this.
* config/mips/mips.md: Update after above changes.
2007-08-08 Vladimir Yanovsky <yanov@il.ibm.com>
Revital Eres <eres@il.ibm.com>

View File

@ -27,14 +27,17 @@ along with GCC; see the file COPYING3. If not see
/* Classifies a SYMBOL_REF, LABEL_REF or UNSPEC address.
SYMBOL_GENERAL
Used when none of the below apply.
SYMBOL_ABSOLUTE
The symbol's value will be calculated using absolute relocations,
such as %hi and %lo.
SYMBOL_SMALL_DATA
The symbol refers to something in a small data section.
SYMBOL_GP_RELATIVE
The symbol's value will be calculated by adding a 16-bit offset
from $gp.
SYMBOL_CONSTANT_POOL
The symbol refers to something in the mips16 constant pool.
SYMBOL_PC_RELATIVE
The symbol's value will be calculated using a MIPS16 PC-relative
calculation.
SYMBOL_GOT_PAGE_OFST
The symbol's value will be calculated by loading an address
@ -87,9 +90,9 @@ along with GCC; see the file COPYING3. If not see
An UNSPEC wrapper around any kind of address. It represents the
low 16 bits of that address. */
enum mips_symbol_type {
SYMBOL_GENERAL,
SYMBOL_SMALL_DATA,
SYMBOL_CONSTANT_POOL,
SYMBOL_ABSOLUTE,
SYMBOL_GP_RELATIVE,
SYMBOL_PC_RELATIVE,
SYMBOL_GOT_PAGE_OFST,
SYMBOL_GOT_DISP,
SYMBOL_GOTOFF_PAGE,

View File

@ -1446,10 +1446,10 @@ mips_classify_symbol (rtx x)
if (GET_CODE (x) == LABEL_REF)
{
if (TARGET_MIPS16)
return SYMBOL_CONSTANT_POOL;
return SYMBOL_PC_RELATIVE;
if (TARGET_ABICALLS && !TARGET_ABSOLUTE_ABICALLS)
return SYMBOL_GOT_PAGE_OFST;
return SYMBOL_GENERAL;
return SYMBOL_ABSOLUTE;
}
gcc_assert (GET_CODE (x) == SYMBOL_REF);
@ -1460,25 +1460,25 @@ mips_classify_symbol (rtx x)
if (CONSTANT_POOL_ADDRESS_P (x))
{
if (TARGET_MIPS16)
return SYMBOL_CONSTANT_POOL;
return SYMBOL_PC_RELATIVE;
if (!TARGET_EMBEDDED_DATA
&& GET_MODE_SIZE (get_pool_mode (x)) <= mips_section_threshold)
return SYMBOL_SMALL_DATA;
return SYMBOL_GP_RELATIVE;
}
/* Do not use small-data accesses for weak symbols; they may end up
being zero. */
if (SYMBOL_REF_SMALL_P (x)
&& !SYMBOL_REF_WEAK (x))
return SYMBOL_SMALL_DATA;
return SYMBOL_GP_RELATIVE;
if (TARGET_ABICALLS)
{
/* Don't use GOT accesses for locally-binding symbols; we can use
%hi and %lo instead. */
if (TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x))
return SYMBOL_GENERAL;
return SYMBOL_ABSOLUTE;
/* There are three cases to consider:
@ -1505,7 +1505,7 @@ mips_classify_symbol (rtx x)
return SYMBOL_GOT_PAGE_OFST;
}
return SYMBOL_GENERAL;
return SYMBOL_ABSOLUTE;
}
/* Return true if OFFSET is within the range [0, ALIGN), where ALIGN
@ -1559,7 +1559,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_type *symbol_type)
relocations. */
switch (*symbol_type)
{
case SYMBOL_GENERAL:
case SYMBOL_ABSOLUTE:
case SYMBOL_64_HIGH:
case SYMBOL_64_MID:
case SYMBOL_64_LOW:
@ -1573,7 +1573,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_type *symbol_type)
/* In other cases the relocations can handle any offset. */
return true;
case SYMBOL_CONSTANT_POOL:
case SYMBOL_PC_RELATIVE:
/* Allow constant pool references to be converted to LABEL+CONSTANT.
In this case, we no longer have access to the underlying constant,
but the original symbol-based access was known to be valid. */
@ -1582,7 +1582,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_type *symbol_type)
/* Fall through. */
case SYMBOL_SMALL_DATA:
case SYMBOL_GP_RELATIVE:
/* Make sure that the offset refers to something within the
same object block. This should guarantee that the final
PC- or GP-relative offset is within the 16-bit limit. */
@ -1681,13 +1681,13 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
{
switch (symbol_type)
{
case SYMBOL_GENERAL:
case SYMBOL_ABSOLUTE:
return !TARGET_MIPS16;
case SYMBOL_SMALL_DATA:
case SYMBOL_GP_RELATIVE:
return true;
case SYMBOL_CONSTANT_POOL:
case SYMBOL_PC_RELATIVE:
/* PC-relative addressing is only available for lw and ld. */
return GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8;
@ -1838,7 +1838,7 @@ mips_symbol_insns (enum mips_symbol_type type)
{
switch (type)
{
case SYMBOL_GENERAL:
case SYMBOL_ABSOLUTE:
/* In mips16 code, general symbols must be fetched from the
constant pool. */
if (TARGET_MIPS16)
@ -1857,11 +1857,11 @@ mips_symbol_insns (enum mips_symbol_type type)
symbols we just need a preparatory lui. */
return (ABI_HAS_64BIT_SYMBOLS ? 6 : 2);
case SYMBOL_SMALL_DATA:
case SYMBOL_GP_RELATIVE:
case SYMBOL_HALF:
return 1;
case SYMBOL_CONSTANT_POOL:
case SYMBOL_PC_RELATIVE:
/* This case is for mips16 only. Assume we'll need an
extended instruction. */
return 2;
@ -5429,32 +5429,32 @@ override_options (void)
mips_hi_relocs[SYMBOL_64_LOW] = "%hi(";
mips_lo_relocs[SYMBOL_64_LOW] = "%lo(";
mips_split_p[SYMBOL_GENERAL] = true;
mips_lo_relocs[SYMBOL_GENERAL] = "%lo(";
mips_split_p[SYMBOL_ABSOLUTE] = true;
mips_lo_relocs[SYMBOL_ABSOLUTE] = "%lo(";
}
}
else
{
if (TARGET_EXPLICIT_RELOCS || mips_split_addresses)
{
mips_split_p[SYMBOL_GENERAL] = true;
mips_hi_relocs[SYMBOL_GENERAL] = "%hi(";
mips_lo_relocs[SYMBOL_GENERAL] = "%lo(";
mips_split_p[SYMBOL_ABSOLUTE] = true;
mips_hi_relocs[SYMBOL_ABSOLUTE] = "%hi(";
mips_lo_relocs[SYMBOL_ABSOLUTE] = "%lo(";
}
}
if (TARGET_MIPS16)
{
/* The high part is provided by a pseudo copy of $gp. */
mips_split_p[SYMBOL_SMALL_DATA] = true;
mips_lo_relocs[SYMBOL_SMALL_DATA] = "%gprel(";
mips_split_p[SYMBOL_GP_RELATIVE] = true;
mips_lo_relocs[SYMBOL_GP_RELATIVE] = "%gprel(";
}
if (TARGET_EXPLICIT_RELOCS)
{
/* Small data constants are kept whole until after reload,
then lowered by mips_rewrite_small_data. */
mips_lo_relocs[SYMBOL_SMALL_DATA] = "%gp_rel(";
mips_lo_relocs[SYMBOL_GP_RELATIVE] = "%gp_rel(";
mips_split_p[SYMBOL_GOT_PAGE_OFST] = true;
if (TARGET_NEWABI)
@ -6439,7 +6439,7 @@ mips_rewrite_small_data_p (rtx x)
return (TARGET_EXPLICIT_RELOCS
&& mips_symbolic_constant_p (x, &symbol_type)
&& symbol_type == SYMBOL_SMALL_DATA);
&& symbol_type == SYMBOL_GP_RELATIVE);
}
@ -8309,8 +8309,8 @@ mips_use_anchors_for_symbol_p (rtx symbol)
{
switch (mips_classify_symbol (symbol))
{
case SYMBOL_CONSTANT_POOL:
case SYMBOL_SMALL_DATA:
case SYMBOL_PC_RELATIVE:
case SYMBOL_GP_RELATIVE:
return false;
default:

View File

@ -3094,7 +3094,7 @@
[(set_attr "type" "store")
(set_attr "mode" "<MODE>")])
;; An instruction to calculate the high part of a 64-bit SYMBOL_GENERAL.
;; An instruction to calculate the high part of a 64-bit SYMBOL_ABSOLUTE.
;; The required value is:
;;
;; (%highest(op1) << 48) + (%higher(op1) << 32) + (%hi(op1) << 16)
@ -3111,7 +3111,7 @@
;; to take effect.
(define_insn_and_split "*lea_high64"
[(set (match_operand:DI 0 "register_operand" "=d")
(high:DI (match_operand:DI 1 "general_symbolic_operand" "")))]
(high:DI (match_operand:DI 1 "absolute_symbolic_operand" "")))]
"TARGET_EXPLICIT_RELOCS && ABI_HAS_64BIT_SYMBOLS"
"#"
"&& epilogue_completed"
@ -3136,7 +3136,7 @@
;; daddu op1,op1,op0
(define_peephole2
[(set (match_operand:DI 1 "register_operand")
(high:DI (match_operand:DI 2 "general_symbolic_operand")))
(high:DI (match_operand:DI 2 "absolute_symbolic_operand")))
(match_scratch:DI 0 "d")]
"TARGET_EXPLICIT_RELOCS && ABI_HAS_64BIT_SYMBOLS"
[(set (match_dup 1) (high:DI (match_dup 3)))
@ -3150,7 +3150,7 @@
})
;; On most targets, the expansion of (lo_sum (high X) X) for a 64-bit
;; SYMBOL_GENERAL X will take 6 cycles. This next pattern allows combine
;; SYMBOL_ABSOLUTE X will take 6 cycles. This next pattern allows combine
;; to merge the HIGH and LO_SUM parts of a move if the HIGH part is only
;; used once. We can then use the sequence:
;;
@ -3164,7 +3164,7 @@
;; which takes 4 cycles on most superscalar targets.
(define_insn_and_split "*lea64"
[(set (match_operand:DI 0 "register_operand" "=d")
(match_operand:DI 1 "general_symbolic_operand" ""))
(match_operand:DI 1 "absolute_symbolic_operand" ""))
(clobber (match_scratch:DI 2 "=&d"))]
"TARGET_EXPLICIT_RELOCS && ABI_HAS_64BIT_SYMBOLS && cse_not_expected"
"#"
@ -4182,7 +4182,7 @@
(match_dup 4)] UNSPEC_LOAD_GOT))]
{
operands[2] = pic_offset_table_rtx;
operands[3] = mips_unspec_address (operands[0], SYMBOL_GENERAL);
operands[3] = mips_unspec_address (operands[0], SYMBOL_ABSOLUTE);
operands[4] = mips_unspec_address (operands[1], SYMBOL_HALF);
})

View File

@ -101,7 +101,7 @@
switch (symbol_type)
{
case SYMBOL_GENERAL:
case SYMBOL_ABSOLUTE:
/* We can only use direct calls for TARGET_ABSOLUTE_ABICALLS if we
are sure that the target function does not need $25 to be live
on entry. This is true for any locally-defined function because
@ -229,11 +229,11 @@
return mips_symbolic_constant_p (op, &type);
})
(define_predicate "general_symbolic_operand"
(define_predicate "absolute_symbolic_operand"
(match_code "const,symbol_ref,label_ref")
{
enum mips_symbol_type type;
return mips_symbolic_constant_p (op, &type) && type == SYMBOL_GENERAL;
return mips_symbolic_constant_p (op, &type) && type == SYMBOL_ABSOLUTE;
})
(define_predicate "got_disp_operand"