gcc/gcc/rtlhooks.c
Kaveh R. Ghazi fa233e34c9 attribs.c (hash_attr, [...]): Constify.
* attribs.c (hash_attr, eq_attr, init_attributes): Constify.
	* builtins.c (validate_arg, builtin_mathfn_code,
	validate_arglist): Likewise.
	* calls.c (call_expr_flags): Likewise.
	* combine.c (reg_nonzero_bits_for_combine,
	reg_num_sign_bit_copies_for_combine, get_last_value,
	reg_truncated_to_mode): Likewise.
	* emit-rtl.c (subreg_lowpart_p): Likewise.
	* expr.c (highest_pow2_factor_for_target,
	categorize_ctor_elements_1, categorize_ctor_elements,
	count_type_elements, contains_packed_reference,
	highest_pow2_factor, highest_pow2_factor_for_target): Likewise.
	* fold-const.c (may_negate_without_overflow_p, int_const_binop,
	fold_convertible_p, operand_equal_p, tree_swap_operands_p,
	native_encode_int, native_encode_real, native_encode_complex,
	native_encode_vector, native_encode_expr, native_interpret_int,
	native_interpret_real, native_interpret_complex,
	native_interpret_vector, native_interpret_expr): Likewise.
	* function.c (use_register_for_decl): Likewise.
	* gimplify.c (get_name): Likewise.
	* langhooks-def.h (lhd_return_null_const_tree): New.
	(LANG_HOOKS_GET_CALLEE_FNDECL): Use it.
	* langhooks.c (lhd_return_null_const_tree): New.
	* langhooks.h (lang_get_callee_fndecl): Constify.
	* output.h (constructor_static_from_elts_p): Likewise.
	* rtl-factoring.c (gen_symbol_ref_rtx_for_label): Likewise.
	* rtl.h (nonzero_bits, num_sign_bit_copies, truncated_to_mode,
	subreg_lowpart_p, noop_move_p, struct rtl_hooks): Likewise.
	* rtlanal.c (cached_nonzero_bits, nonzero_bits1,
	cached_num_sign_bit_copies, num_sign_bit_copies1, noop_move_p,
	nonzero_bits, num_sign_bit_copies, truncated_to_mode): Likewise.
	* rtlhooks-def.h (reg_nonzero_bits_general,
	reg_num_sign_bit_copies_general, reg_truncated_to_mode_general):
	Likewise. 
	* rtlhooks.c (reg_num_sign_bit_copies_general,
	reg_nonzero_bits_general, reg_truncated_to_mode_general):
	Likewise. 
	* stmt.c (warn_if_unused_value, is_body_block): Likewise.
	* stor-layout.c (mode_for_size_tree): Likewise.
	* tree-ssa-loop-im.c (memref_eq): Likewise.
	* tree-ssa-loop-ivopts.c (tree_int_cst_sign_bit): Likewise.
	* tree.c (contains_placeholder_p, type_list_equal,
	simple_cst_equal, get_callee_fndecl, operand_equal_for_phi_arg_p):
	Likewise. 
	* tree.h (tree_int_cst_sign_bit, may_negate_without_overflow_p,
	mode_for_size_tree, categorize_ctor_elements, count_type_elements,
	contains_placeholder_p, contains_packed_reference,
	get_callee_fndecl, operand_equal_for_phi_arg_p,
	warn_if_unused_value, is_body_block, native_encode_expr,
	native_interpret_expr, fold_convertible_p, operand_equal_p,
	int_const_binop, tree_swap_operands_p, builtin_mathfn_code,
	validate_arglist, simple_cst_equal, type_list_equal,
	use_register_for_decl, call_expr_flags, get_name,
	highest_pow2_factor): Likewise.
	(const_call_expr_arg_iterator_d,
	init_const_call_expr_arg_iterator, next_const_call_expr_arg,
	first_const_call_expr_arg, more_const_call_expr_args_p,
	FOR_EACH_CONST_CALL_EXPR_ARG): New.
	* varasm.c (constructor_static_from_elts_p): Constify.
	
cp:
	* parser.c (eof_token): Un-constify.
	(cp_lexer_new_main, cp_lexer_new_from_tokens, VEC_alloc,
	cp_lexer_consume_token, cp_lexer_purge_token): Remove spurious
	casts.

java:
	* lang.c (java_get_callee_fndecl): Constify.

objc:
	* objc-act.c (objc_get_callee_fndecl): Constify.
	* objc-act.h (objc_get_callee_fndecl): Likewise.

From-SVN: r127036
2007-07-29 05:43:43 +00:00

171 lines
5.2 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Generic hooks for the RTL middle-end.
Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "rtlhooks-def.h"
#include "expr.h"
#include "recog.h"
/* For speed, we will copy the RTX hooks struct member-by-member
instead of doing indirect calls. For these reason, we initialize
*two* struct rtl_hooks globals: rtl_hooks is the one that is used
to actually call the hooks, while general_rtl_hooks is used
to restore the hooks by passes that modify them. */
const struct rtl_hooks general_rtl_hooks = RTL_HOOKS_INITIALIZER;
struct rtl_hooks rtl_hooks = RTL_HOOKS_INITIALIZER;
rtx
gen_lowpart_general (enum machine_mode mode, rtx x)
{
rtx result = gen_lowpart_common (mode, x);
if (result)
return result;
/* If it's a REG, it must be a hard reg that's not valid in MODE. */
else if (REG_P (x)
/* Or we could have a subreg of a floating point value. */
|| (GET_CODE (x) == SUBREG
&& FLOAT_MODE_P (GET_MODE (SUBREG_REG (x)))))
{
result = gen_lowpart_common (mode, copy_to_reg (x));
gcc_assert (result != 0);
return result;
}
else
{
int offset = 0;
/* The only additional case we can do is MEM. */
gcc_assert (MEM_P (x));
/* The following exposes the use of "x" to CSE. */
if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
&& SCALAR_INT_MODE_P (GET_MODE (x))
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (GET_MODE (x)))
&& !reload_completed)
return gen_lowpart_general (mode, force_reg (GET_MODE (x), x));
if (WORDS_BIG_ENDIAN)
offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
if (BYTES_BIG_ENDIAN)
/* Adjust the address so that the address-after-the-data
is unchanged. */
offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
return adjust_address (x, mode, offset);
}
}
/* Similar to gen_lowpart, but cannot emit any instruction via
copy_to_reg or force_reg. Mainly used in simplify-rtx.c. */
rtx
gen_lowpart_no_emit_general (enum machine_mode mode, rtx x)
{
rtx result = gen_lowpart_if_possible (mode, x);
if (result)
return result;
else
return x;
}
rtx
reg_num_sign_bit_copies_general (const_rtx x ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
const_rtx known_x ATTRIBUTE_UNUSED,
enum machine_mode known_mode ATTRIBUTE_UNUSED,
unsigned int known_ret ATTRIBUTE_UNUSED,
unsigned int *result ATTRIBUTE_UNUSED)
{
return NULL;
}
rtx
reg_nonzero_bits_general (const_rtx x ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
const_rtx known_x ATTRIBUTE_UNUSED,
enum machine_mode known_mode ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT known_ret ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT *nonzero ATTRIBUTE_UNUSED)
{
return NULL;
}
bool
reg_truncated_to_mode_general (enum machine_mode mode ATTRIBUTE_UNUSED,
const_rtx x ATTRIBUTE_UNUSED)
{
return false;
}
/* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a fixed-point
number, return an rtx (MEM, SUBREG, or CONST_INT) that refers to the
least-significant part of X.
MODE specifies how big a part of X to return.
If the requested operation cannot be done, 0 is returned.
This is similar to gen_lowpart_general. */
rtx
gen_lowpart_if_possible (enum machine_mode mode, rtx x)
{
rtx result = gen_lowpart_common (mode, x);
if (result)
return result;
else if (MEM_P (x))
{
/* This is the only other case we handle. */
int offset = 0;
rtx new;
if (WORDS_BIG_ENDIAN)
offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
if (BYTES_BIG_ENDIAN)
/* Adjust the address so that the address-after-the-data is
unchanged. */
offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
new = adjust_address_nv (x, mode, offset);
if (! memory_address_p (mode, XEXP (new, 0)))
return 0;
return new;
}
else if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode
&& validate_subreg (mode, GET_MODE (x), x,
subreg_lowpart_offset (mode, GET_MODE (x))))
return gen_lowpart_SUBREG (mode, x);
else
return 0;
}