1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

gcc: another round of merges from the gcc pre-43 branch.

Bring The following revisions from the gcc43 branch[1]:

118360, 118361, 118363, 118576, 119820,
123906, 125246, and 125721.

They all have in common that the were merged long ago
into Apple's gcc and should help improve the general
quality of the compiler and make it easier to bring
new features from Apple's gcc42.

For details please review the additions to the files:
gcc/ChangeLog.gcc43
gcc/cp/ChangeLog.gcc43 (new, adds previous revisions)

Reference:
[1] http://gcc.gnu.org/viewcvs/gcc/trunk/?pathrev=126700

Obtained from:	gcc pre4.3 (GPLv2) branch
MFC after:	3 weeks
This commit is contained in:
Pedro F. Giffuni 2013-11-21 16:38:57 +00:00
parent e941e1e94a
commit 2bd5e058b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258428
46 changed files with 804 additions and 428 deletions

View File

@ -10,6 +10,12 @@
* doc/extend.texi: Document the 0b-prefixed binary integer
constant extension.
2007-05-31 Eric Christopher <echristo@apple.com>
* expr.c (convert_move): Assert that we don't have a BLKmode
operand.
(store_expr): Handle BLKmode moves by calling emit_block_move.
2007-05-24 Richard Sandiford <rsandifo@nildram.co.uk> (r125037)
* postreload-gcse.c (reg_changed_after_insn_p): New function.
@ -99,6 +105,12 @@
(dwarf2out_imported_module_or_decl): Suppress struct debug
information using should_emit_struct_debug when appropriate.
2007-04-16 Ian Lance Taylor <iant@google.com> (r123906)
* tree-ssa-propagate.c (cfg_blocks_add): Insert blocks with fewer
predecessors at head rather than tail.
2007-04-12 Richard Guenther <rguenther@suse.de> (r123736)
PR tree-optimization/24689
@ -333,6 +345,28 @@
* doc/invoke.texi (Warning Options): Update -Wparentheses
description.
2006-12-12 Geoffrey Keating <geoffk@apple.com> (r119820)
* mips-tdump.c: Replace CROSS_COMPILE with
CROSS_DIRECTORY_STRUCTURE.
* mips-tfile.c: Likewise.
* gcc.c: Likewise.
* configure.ac: Likewise.
* cppdefault.c: Likewise.
* Makefile.in: Likewise.
* config/alpha/osf.h: Likewise.
* config/i386/cygwin.h: Likewise.
* config/i386/beos-elf.h: Likewise.
* config/i386/nto.h: Likewise.
* config/svr4.h: Likewise.
* config/rs6000/aix.h: Likewise.
* config/rs6000/sysv4.h: Likewise.
* collect2.c: Likewise.
* configure: Regenerate.
* doc/tm.texi (Alignment Output): Document that ASM_OUTPUT_SKIP
actually takes an unsigned HOST_WIDE_INT for its second parameter.
2006-12-02 H.J. Lu <hongjiu.lu@intel.com> (r119454 - partial)
PR target/30040
@ -371,6 +405,30 @@
(override_options): Add entries for Core2.
(ix86_issue_rate): Add case for Core2.
2006-11-07 Eric Christopher <echristo@apple.com> (r118576)
* libgcc2.c (__bswapdi2): Rename from bswapDI2.
(__bswapsi2): Ditto.
* libgcc2.h: Remove transformation of bswap routines.
* config/i386/i386.md (bswapsi2): New.
(bswapdi2): Ditto.
2006-10-31 Geoffrey Keating <geoffk@apple.com> (r118360)
* coverage.c (coverage_checksum_string): Update comment.
* dwarf2out.c (switch_to_eh_frame_section): Update for removal
of get_file_function_name.
* cgraphunit.c (cgraph_build_static_cdtor): Update for rename
of get_file_function_name_long.
* tree.c (get_file_function_name): Rename from
get_file_function_name_long; improve comment; handle 'I' and 'D'
specially when the target has ctor/dtor support; remove special
handling for 'F'.
(get_file_function_name): Remove.
* tree.h (get_file_function_name): Rename from
get_file_function_name_long.
(get_file_function_name): Remove prototype.
2006-10-31 Geoffrey Keating <geoffk@apple.com> (r118356)
* c-decl.c (grokdeclarator): Don't set DECL_EXTERNAL on
@ -521,3 +579,51 @@
* builtins.c (fold_builtin_classify): Fix typo.
2006-09-07 Eric Christopher <echristo@apple.com> (r118361)
Falk Hueffner <falk@debian.org>
* doc/extend.texi (__builtin_bswap32): Document.
(__builtin_bswap64): Ditto.
* doc/libgcc.texi (bswapsi2): Document.
(bswapdi2): Ditto.
* doc/rtl.texi (bswap): Document.
* optabs.c (expand_unop): Don't widen a bswap.
(init_optabs): Init bswap. Set libfuncs explicitly
for bswapsi2 and bswapdi2.
* optabs.h (OTI_bswap): New.
(bswap_optab): Ditto.
* genopinit.c (optabs): Handle bswap_optab.
* tree.h (tree_index): Add TI_UINT32_TYPE and
TI_UINT64_TYPE.
(uint32_type_node): New.
(uint64_type_node): Ditto.
* tree.c (build_common_tree_nodes_2): Initialize
uint32_type_node and uint64_type_node.
* builtins.c (expand_builtin_bswap): New.
(expand_builtin): Call.
(fold_builtin_bswap): New.
(fold_builtin_1): Call.
* fold-const.c (tree_expr_nonnegative_p): Return true
for bswap.
* builtin-types.def (BT_UINT32): New.
(BT_UINT64): Ditto.
(BT_FN_UINT32_UINT32): Ditto.
(BT_FN_UINT64_UINT64): Ditto.
* builtins.def (BUILT_IN_BSWAP32): New.
(BUILT_IN_BSWAP64): Ditto.
* rtl.def (BSWAP): New.
* genattrtab.c (check_attr_value): New.
* libgcc2.c (__bswapSI2): New.
(__bswapDI2): Ditto.
* libgcc2.h (__bswapSI2): Declare.
(__bswapDI2): Ditto.
* mklibgcc.in (lib2funcs): Add _bswapsi2 and _bswapdi2.
* simplify-rtx.c (simplify_const_unary_operation): Return
0 for BSWAP.
* libgcc-std.ver (__bwapsi2): Add.
(__bswapdi2): Ditto.
* reload1.c (eliminate_regs_1): Add bswap.
(elimination_effects): Ditto.
* config/i386/i386.h (x86_bswap): New.
(TARGET_BSWAP): Use.
* config/i386/i386.c (x86_bswap): Set.

View File

@ -822,7 +822,8 @@ REAL_H = real.h $(MACHMODE_H)
# IN_GCC distinguishes between code compiled into GCC itself and other
# programs built during a bootstrap.
# autoconf inserts -DCROSS_COMPILE if we are building a cross compiler.
# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a
# cross compiler which does not use the native headers and libraries.
INTERNAL_CFLAGS = -DIN_GCC @CROSS@
# This is the variable actually used when we compile. If you change this,

View File

@ -75,6 +75,8 @@ DEF_PRIMITIVE_TYPE (BT_LONGLONG, long_long_integer_type_node)
DEF_PRIMITIVE_TYPE (BT_ULONGLONG, long_long_unsigned_type_node)
DEF_PRIMITIVE_TYPE (BT_INTMAX, intmax_type_node)
DEF_PRIMITIVE_TYPE (BT_UINTMAX, uintmax_type_node)
DEF_PRIMITIVE_TYPE (BT_UINT32, uint32_type_node)
DEF_PRIMITIVE_TYPE (BT_UINT64, uint64_type_node)
DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 0))
DEF_PRIMITIVE_TYPE (BT_FLOAT, float_type_node)
DEF_PRIMITIVE_TYPE (BT_DOUBLE, double_type_node)
@ -204,6 +206,10 @@ DEF_FUNCTION_TYPE_1 (BT_FN_DFLOAT128_DFLOAT128, BT_DFLOAT128, BT_DFLOAT128)
DEF_FUNCTION_TYPE_1 (BT_FN_VOID_VPTR, BT_VOID, BT_VOLATILE_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTRPTR, BT_VOID, BT_PTR_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_UINT_UINT, BT_UINT, BT_UINT)
DEF_FUNCTION_TYPE_1 (BT_FN_ULONG_ULONG, BT_ULONG, BT_ULONG)
DEF_FUNCTION_TYPE_1 (BT_FN_ULONGLONG_ULONGLONG, BT_ULONGLONG, BT_ULONGLONG)
DEF_FUNCTION_TYPE_1 (BT_FN_UINT32_UINT32, BT_UINT32, BT_UINT32)
DEF_FUNCTION_TYPE_1 (BT_FN_UINT64_UINT64, BT_UINT64, BT_UINT64)
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR, BT_FN_VOID_PTR)
@ -435,4 +441,3 @@ DEF_FUNCTION_TYPE_VAR_5 (BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR,
DEF_POINTER_TYPE (BT_PTR_FN_VOID_VAR, BT_FN_VOID_VAR)
DEF_FUNCTION_TYPE_3 (BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
BT_PTR, BT_PTR_FN_VOID_VAR, BT_PTR, BT_SIZE)

View File

@ -4589,6 +4589,30 @@ expand_builtin_alloca (tree arglist, rtx target)
return result;
}
/* Expand a call to a bswap builtin. The arguments are in ARGLIST. MODE
is the mode to expand with. */
static rtx
expand_builtin_bswap (tree arglist, rtx target, rtx subtarget)
{
enum machine_mode mode;
tree arg;
rtx op0;
if (!validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE))
return 0;
arg = TREE_VALUE (arglist);
mode = TYPE_MODE (TREE_TYPE (arg));
op0 = expand_expr (arg, subtarget, VOIDmode, 0);
target = expand_unop (mode, bswap_optab, op0, target, 1);
gcc_assert (target);
return convert_to_mode (mode, target, 0);
}
/* Expand a call to a unary builtin. The arguments are in ARGLIST.
Return 0 if a normal call should be emitted rather than expanding the
function in-line. If convenient, the result should be placed in TARGET.
@ -5877,6 +5901,14 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
expand_stack_restore (TREE_VALUE (arglist));
return const0_rtx;
case BUILT_IN_BSWAP32:
case BUILT_IN_BSWAP64:
target = expand_builtin_bswap (arglist, target, subtarget);
if (target)
return target;
break;
CASE_INT_FN (BUILT_IN_FFS):
case BUILT_IN_FFSIMAX:
target = expand_builtin_unop (target_mode, arglist, target,
@ -7539,6 +7571,67 @@ fold_builtin_bitop (tree fndecl, tree arglist)
return NULL_TREE;
}
/* Fold function call to builtin_bswap and the long and long long
variants. Return NULL_TREE if no simplification can be made. */
static tree
fold_builtin_bswap (tree fndecl, tree arglist)
{
tree arg;
if (! validate_arglist (arglist, INTEGER_TYPE, VOID_TYPE))
return 0;
/* Optimize constant value. */
arg = TREE_VALUE (arglist);
if (TREE_CODE (arg) == INTEGER_CST && ! TREE_CONSTANT_OVERFLOW (arg))
{
HOST_WIDE_INT hi, width, r_hi = 0;
unsigned HOST_WIDE_INT lo, r_lo = 0;
tree type;
type = TREE_TYPE (arg);
width = TYPE_PRECISION (type);
lo = TREE_INT_CST_LOW (arg);
hi = TREE_INT_CST_HIGH (arg);
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_BSWAP32:
case BUILT_IN_BSWAP64:
{
int s;
for (s = 0; s < width; s += 8)
{
int d = width - s - 8;
unsigned HOST_WIDE_INT byte;
if (s < HOST_BITS_PER_WIDE_INT)
byte = (lo >> s) & 0xff;
else
byte = (hi >> (s - HOST_BITS_PER_WIDE_INT)) & 0xff;
if (d < HOST_BITS_PER_WIDE_INT)
r_lo |= byte << d;
else
r_hi |= byte << (d - HOST_BITS_PER_WIDE_INT);
}
}
break;
default:
gcc_unreachable ();
}
if (width < HOST_BITS_PER_WIDE_INT)
return build_int_cst (TREE_TYPE (TREE_TYPE (fndecl)), r_lo);
else
return build_int_cst_wide (TREE_TYPE (TREE_TYPE (fndecl)), r_lo, r_hi);
}
return NULL_TREE;
}
/* Return true if EXPR is the real constant contained in VALUE. */
static bool
@ -9053,6 +9146,10 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
CASE_FLT_FN (BUILT_IN_LLRINT):
return fold_fixed_mathfn (fndecl, arglist);
case BUILT_IN_BSWAP32:
case BUILT_IN_BSWAP64:
return fold_builtin_bswap (fndecl, arglist);
CASE_INT_FN (BUILT_IN_FFS):
CASE_INT_FN (BUILT_IN_CLZ):
CASE_INT_FN (BUILT_IN_CTZ):

View File

@ -594,6 +594,8 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_ALLOCA, "alloca", BT_FN_PTR_SIZE, ATTR_MALLOC_N
DEF_GCC_BUILTIN (BUILT_IN_APPLY, "apply", BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_APPLY_ARGS, "apply_args", BT_FN_PTR_VAR, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_ARGS_INFO, "args_info", BT_FN_INT_INT, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_BSWAP32, "bswap32", BT_FN_UINT32_UINT32, ATTR_CONST_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_BSWAP64, "bswap64", BT_FN_UINT64_UINT64, ATTR_CONST_NOTHROW_LIST)
DEF_LIB_BUILTIN (BUILT_IN_CALLOC, "calloc", BT_FN_PTR_SIZE_SIZE, ATTR_MALLOC_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_CLASSIFY_TYPE, "classify_type", BT_FN_INT_VAR, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_CLZ, "clz", BT_FN_INT_UINT, ATTR_CONST_NOTHROW_LIST)

View File

@ -1676,7 +1676,7 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
tree decl, name, resdecl;
sprintf (which_buf, "%c_%d", which, counter++);
name = get_file_function_name_long (which_buf);
name = get_file_function_name (which_buf);
decl = build_decl (FUNCTION_DECL, name,
build_function_type (void_type_node, void_list_node));

View File

@ -53,7 +53,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
the utilities are not correct for a cross-compiler; we have to hope that
cross-versions are in the proper directories. */
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
#undef OBJECT_FORMAT_COFF
#undef MD_EXEC_PREFIX
#undef REAL_LD_FILE_NAME
@ -553,7 +553,7 @@ is_ctor_dtor (const char *s)
static struct path_prefix cpath, path;
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
/* This is the name of the target machine. We use it to form the name
of the files to execute. */
@ -746,7 +746,7 @@ main (int argc, char **argv)
static const char *const strip_suffix = "strip";
static const char *const gstrip_suffix = "gstrip";
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
/* If we look for a program in the compiler directories, we just use
the short name, since these directories are already system-specific.
But it we look for a program in the system directories, we need to
@ -775,7 +775,7 @@ main (int argc, char **argv)
#endif
const char *const full_strip_suffix = strip_suffix;
const char *const full_gstrip_suffix = gstrip_suffix;
#endif /* CROSS_COMPILE */
#endif /* CROSS_DIRECTORY_STRUCTURE */
const char *arg;
FILE *outf;
@ -957,7 +957,7 @@ main (int argc, char **argv)
c_file_name = getenv ("COLLECT_GCC");
if (c_file_name == 0)
{
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
c_file_name = concat (target_machine, "-gcc", NULL);
#else
c_file_name = "gcc";

View File

@ -135,7 +135,7 @@ Boston, MA 02110-1301, USA. */
for the BeOS include files relative to TOOL_INCLUDE_DIR. Yes, we
use ANSI string concatenation here (FIXME) */
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#undef INCLUDE_DEFAULTS
#define INCLUDE_DEFAULTS \
{ \
@ -177,7 +177,7 @@ Boston, MA 02110-1301, USA. */
{ "/boot/develop/headers", 0, 0, 0 }, \
{ 0, 0, 0, 0 } \
}
#else /* CROSS_COMPILE */
#else /* CROSS_DIRECTORY_STRUCTURE */
#undef INCLUDE_DEFAULTS
#define INCLUDE_DEFAULTS \
{ \

View File

@ -146,7 +146,7 @@ char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
#undef TOOL_INCLUDE_DIR
#define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR "/usr/include"
char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1

View File

@ -1089,6 +1089,8 @@ const int x86_cmpxchg = ~m_386;
const int x86_cmpxchg8b = ~(m_386 | m_486);
/* Exchange and add was added for 80486. */
const int x86_xadd = ~m_386;
/* Byteswap was added for 80486. */
const int x86_bswap = ~m_386;
const int x86_pad_returns = m_ATHLON_K8_AMDFAM10 | m_CORE2 | m_GENERIC;
/* In case the average insn count for single function invocation is

View File

@ -168,6 +168,7 @@ extern const int x86_use_bt;
extern const int x86_cmpxchg, x86_cmpxchg8b, x86_xadd;
extern const int x86_use_incdec;
extern const int x86_pad_returns;
extern const int x86_bswap;
extern const int x86_partial_flag_reg_stall;
extern int x86_prefetch_sse, x86_cmpxchg16b;
@ -243,6 +244,7 @@ extern int x86_prefetch_sse, x86_cmpxchg16b;
#define TARGET_CMPXCHG8B (x86_cmpxchg8b & (1 << ix86_arch))
#define TARGET_CMPXCHG16B (x86_cmpxchg16b)
#define TARGET_XADD (x86_xadd & (1 << ix86_arch))
#define TARGET_BSWAP (x86_bswap & (1 << ix86_arch))
#ifndef TARGET_64BIT_DEFAULT
#define TARGET_64BIT_DEFAULT 0

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */
#undef THREAD_MODEL_SPEC
#define THREAD_MODEL_SPEC "posix"
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
#define SYSROOT_SUFFIX_SPEC "x86"
#endif

View File

@ -124,14 +124,14 @@
/* #define ASM_SPEC "-u %(asm_cpu)" */
/* Default location of syscalls.exp under AIX */
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
#else
#define LINK_SYSCALLS_SPEC ""
#endif
/* Default location of libg.exp under AIX */
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
#else
#define LINK_LIBG_SPEC ""

View File

@ -634,7 +634,7 @@ extern int fixuplabelno;
%{profile: -p}"
/* Don't put -Y P,<path> for cross compilers. */
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#define LINK_PATH_SPEC "\
%{!R*:%{L*:-R %*}} \
%{!nostdlib: %{!YP,*: \

View File

@ -84,7 +84,7 @@ Boston, MA 02110-1301, USA.
/* Under svr4, the normal location of the `ld' and `as' programs is the
/usr/ccs/bin directory. */
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#undef MD_EXEC_PREFIX
#define MD_EXEC_PREFIX "/usr/ccs/bin/"
#endif
@ -92,7 +92,7 @@ Boston, MA 02110-1301, USA.
/* Under svr4, the normal location of the various *crt*.o files is the
/usr/ccs/lib directory. */
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#undef MD_STARTFILE_PREFIX
#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
#endif
@ -136,7 +136,7 @@ Boston, MA 02110-1301, USA.
not being done. */
#undef LINK_SPEC
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
#define LINK_SPEC "%{h*} %{v:-V} \
%{b} \
%{static:-dn -Bstatic} \

View File

@ -13151,7 +13151,8 @@ for f in $build_xm_file; do
esac
done
# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
# Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
# cross-compiler which does not use the native headers and libraries.
# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
CROSS=
ALL=all.internal
@ -13168,7 +13169,7 @@ fi
if test x$host != x$target
then
CROSS="-DCROSS_COMPILE"
CROSS="-DCROSS_DIRECTORY_STRUCTURE"
ALL=all.cross
SYSTEM_HEADER_DIR=$build_system_header_dir
case "$host","$target" in

View File

@ -1729,7 +1729,8 @@ for f in $build_xm_file; do
esac
done
# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
# Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
# cross-compiler which does not use the native headers and libraries.
# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
CROSS= AC_SUBST(CROSS)
ALL=all.internal AC_SUBST(ALL)
@ -1746,7 +1747,7 @@ fi
if test x$host != x$target
then
CROSS="-DCROSS_COMPILE"
CROSS="-DCROSS_DIRECTORY_STRUCTURE"
ALL=all.cross
SYSTEM_HEADER_DIR=$build_system_header_dir
case "$host","$target" in

View File

@ -433,7 +433,7 @@ coverage_checksum_string (unsigned chksum, const char *string)
char *dup = NULL;
/* Look for everything that looks if it were produced by
get_file_function_name_long and zero out the second part
get_file_function_name and zero out the second part
that may result from flag_random_seed. This is not critical
as the checksums are used only for sanity checking. */
for (i = 0; string[i]; i++)

View File

@ -0,0 +1,28 @@
2007-06-28 Geoffrey Keating <geoffk@apple.com> (r126080)
* decl2.c (start_objects): Mark constructor-runnning function
as artificial.
2007-06-14 Geoff Keating <geoffk@apple.com> (r125721)
PR 31093
* decl2.c (determine_visibility): Remove duplicate code for
handling type info.
2007-03-12 Seongbae Park <seongbae.park@gmail.com> (r122851)
* decl.c (compute_array_index_type): New warning flag warn_vla.
2007-01-07 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/28986
* typeck.c (build_binary_op): Call overflow_warning if
TREE_OVERFLOW_P is true for the result and not for any of the
operands.
2006-10-31 Geoffrey Keating <geoffk@apple.com> (r118360)
* name-lookup.c (get_anonymous_namespace_name): New.
(push_namespace_with_attribs): Use get_anonymous_namespace_name.
* decl2.c (start_objects): Update for rename of
get_file_function_name_long.

View File

@ -1698,10 +1698,6 @@ determine_visibility (tree decl)
class can influence the visibility of the DECL. */
if (DECL_CLASS_SCOPE_P (decl))
class_type = DECL_CONTEXT (decl);
else if (TREE_CODE (decl) == VAR_DECL
&& DECL_TINFO_P (decl)
&& CLASS_TYPE_P (TREE_TYPE (DECL_NAME (decl))))
class_type = TREE_TYPE (DECL_NAME (decl));
else
{
/* Not a class member. */
@ -1787,7 +1783,8 @@ determine_visibility (tree decl)
{
/* Propagate anonymity from type to decl. */
int tvis = type_visibility (TREE_TYPE (decl));
if (tvis == VISIBILITY_ANON)
if (tvis == VISIBILITY_ANON
|| ! DECL_VISIBILITY_SPECIFIED (decl))
constrain_visibility (decl, tvis);
}
}
@ -2326,7 +2323,7 @@ start_objects (int method_type, int initp)
sprintf (type, "%c", method_type);
fndecl = build_lang_decl (FUNCTION_DECL,
get_file_function_name_long (type),
get_file_function_name (type),
build_function_type (void_type_node,
void_list_node));
start_preparsed_function (fndecl, /*attrs=*/NULL_TREE, SF_PRE_PARSED);
@ -2335,6 +2332,10 @@ start_objects (int method_type, int initp)
to scan the object file to find its ctor/dtor routine. */
TREE_PUBLIC (current_function_decl) = ! targetm.have_ctors_dtors;
/* Mark as artificial because it's not explicitly in the user's
source code. */
DECL_ARTIFICIAL (current_function_decl) = 1;
/* Mark this declaration as used to avoid spurious warnings. */
TREE_USED (current_function_decl) = 1;

View File

@ -61,6 +61,24 @@ tree global_namespace;
unit. */
static GTY(()) tree anonymous_namespace_name;
/* Initialise anonymous_namespace_name if necessary, and return it. */
static tree
get_anonymous_namespace_name(void)
{
if (!anonymous_namespace_name)
{
/* The anonymous namespace has to have a unique name
if typeinfo objects are being compared by name. */
if (! flag_weak || ! SUPPORTS_ONE_ONLY)
anonymous_namespace_name = get_file_function_name ("N");
else
/* The demangler expects anonymous namespaces to be called
something starting with '_GLOBAL__N_'. */
anonymous_namespace_name = get_identifier ("_GLOBAL__N_1");
}
return anonymous_namespace_name;
}
/* Compute the chain index of a binding_entry given the HASH value of its
name and the total COUNT of chains. COUNT is assumed to be a power
@ -3011,11 +3029,7 @@ push_namespace_with_attribs (tree name, tree attributes)
if (anon)
{
/* The name of anonymous namespace is unique for the translation
unit. */
if (!anonymous_namespace_name)
anonymous_namespace_name = get_file_function_name ('N');
name = anonymous_namespace_name;
name = get_anonymous_namespace_name();
d = IDENTIFIER_NAMESPACE_VALUE (name);
if (d)
/* Reopening anonymous namespace. */

View File

@ -33,7 +33,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define STANDARD_INCLUDE_COMPONENT 0
#endif
#if defined (CROSS_COMPILE) && !defined (TARGET_SYSTEM_ROOT)
#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
# undef LOCAL_INCLUDE_DIR
# undef SYSTEM_INCLUDE_DIR
# undef STANDARD_INCLUDE_DIR

View File

@ -6146,6 +6146,16 @@ Similar to @code{__builtin_powi}, except the argument and return types
are @code{long double}.
@end deftypefn
@deftypefn {Built-in Function} int32_t __builtin_bswap32 (int32_t x)
Returns @var{x} with the order of the bytes reversed; for example,
@code{0xaabbccdd} becomes @code{0xddccbbaa}. Byte here always means
exactly 8 bits.
@end deftypefn
@deftypefn {Built-in Function} int64_t __builtin_bswap64 (int64_t x)
Similar to @code{__builtin_bswap32}, except the argument and return types
are 64-bit.
@end deftypefn
@node Target Builtins
@section Built-in Functions Specific to Particular Target Machines

View File

@ -212,6 +212,11 @@ These functions return the value zero if the number of bits set in
These functions return the number of bits set in @var{a}.
@end deftypefn
@deftypefn {Runtime Function} int32_t __bswapsi2 (int32_t @var{a})
@deftypefnx {Runtime Function} int64_t __bswapdi2 (int64_t @var{a})
These functions return the @var{a} byteswapped.
@end deftypefn
@node Soft float library routines
@section Routines for floating point emulation
@cindex soft float library
@ -728,4 +733,3 @@ document me!
@deftypefn {Runtime Function} void __clear_cache (char *@var{beg}, char *@var{end})
This function clears the instruction cache between @var{beg} and @var{end}.
@end deftypefn

View File

@ -2084,6 +2084,11 @@ mode @var{m}. The mode of @var{x} will usually be an integer mode.
Represents the number of 1-bits modulo 2 in @var{x}, represented as an
integer of mode @var{m}. The mode of @var{x} will usually be an integer
mode.
@findex bswap
@item (bswap:@var{m} @var{x})
Represents the value @var{x} with the order of bytes reversed, carried out
in mode @var{m}, which must be a fixed-point machine mode.
@end table
@node Comparisons

View File

@ -2030,7 +2030,7 @@ switch_to_eh_frame_section (void)
/* We have no special eh_frame section. Put the information in
the data section and emit special labels to guide collect2. */
switch_to_section (data_section);
label = get_file_function_name ('F');
label = get_file_function_name ("F");
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
targetm.asm_out.globalize_label (asm_out_file,
IDENTIFIER_POINTER (label));

View File

@ -361,6 +361,8 @@ convert_move (rtx to, rtx from, int unsignedp)
gcc_assert (to_real == from_real);
gcc_assert (to_mode != BLKmode);
gcc_assert (from_mode != BLKmode);
/* If the source and destination are already the same, then there's
nothing to do. */
@ -415,7 +417,7 @@ convert_move (rtx to, rtx from, int unsignedp)
!= GET_MODE_PRECISION (to_mode))
|| (DECIMAL_FLOAT_MODE_P (from_mode)
!= DECIMAL_FLOAT_MODE_P (to_mode)));
if (GET_MODE_PRECISION (from_mode) == GET_MODE_PRECISION (to_mode))
/* Conversion between decimal float and binary float, same size. */
tab = DECIMAL_FLOAT_MODE_P (from_mode) ? trunc_optab : sext_optab;
@ -2135,7 +2137,7 @@ void
use_reg (rtx *call_fusage, rtx reg)
{
gcc_assert (REG_P (reg) && REGNO (reg) < FIRST_PSEUDO_REGISTER);
*call_fusage
= gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_USE (VOIDmode, reg), *call_fusage);
@ -2682,7 +2684,7 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, unsigned int align)
pred = insn_data[(int) code].operand[1].predicate;
if (pred != 0 && ! (*pred) (opsize, mode))
opsize = copy_to_mode_reg (mode, opsize);
opchar = val;
char_mode = insn_data[(int) code].operand[2].mode;
if (char_mode != VOIDmode)
@ -3140,9 +3142,9 @@ emit_move_multi_word (enum machine_mode mode, rtx x, rtx y)
rtx seq, inner;
bool need_clobber;
int i;
gcc_assert (GET_MODE_SIZE (mode) >= UNITS_PER_WORD);
/* If X is a push on the stack, do the push now and replace
X with a reference to the stack pointer. */
if (push_operand (x, mode))
@ -4440,6 +4442,11 @@ store_expr (tree exp, rtx target, int call_param_p)
temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
emit_move_insn (target, temp);
}
else if (GET_MODE (target) == BLKmode)
emit_block_move (target, temp, expr_size (exp),
(call_param_p
? BLOCK_OP_CALL_PARM
: BLOCK_OP_NORMAL));
else
convert_move (target, temp, unsignedp);
}
@ -4571,7 +4578,7 @@ categorize_ctor_elements_1 (tree ctor, HOST_WIDE_INT *p_nz_elts,
case CONSTRUCTOR:
{
HOST_WIDE_INT nz = 0, ic = 0;
bool const_elt_p
= categorize_ctor_elements_1 (value, &nz, &ic, p_must_clear);
@ -4648,7 +4655,7 @@ categorize_ctor_elements_1 (tree ctor, HOST_WIDE_INT *p_nz_elts,
largest element. Which would avoid comparing the size of the
initialized element against any tail padding in the union.
Doesn't seem worth the effort... */
if (simple_cst_equal (TYPE_SIZE (TREE_TYPE (ctor)),
if (simple_cst_equal (TYPE_SIZE (TREE_TYPE (ctor)),
TYPE_SIZE (init_sub_type)) == 1)
{
/* And now we have to find out if the element itself is fully
@ -4944,24 +4951,24 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
HOST_WIDE_INT bitpos = 0;
tree offset;
rtx to_rtx = target;
/* Just ignore missing fields. We cleared the whole
structure, above, if any fields are missing. */
if (field == 0)
continue;
if (cleared && initializer_zerop (value))
continue;
if (host_integerp (DECL_SIZE (field), 1))
bitsize = tree_low_cst (DECL_SIZE (field), 1);
else
bitsize = -1;
mode = DECL_MODE (field);
if (DECL_BIT_FIELD (field))
mode = VOIDmode;
offset = DECL_FIELD_OFFSET (field);
if (host_integerp (offset, 0)
&& host_integerp (bit_position (field), 0))
@ -4971,11 +4978,11 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
}
else
bitpos = tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 0);
if (offset)
{
rtx offset_rtx;
offset
= SUBSTITUTE_PLACEHOLDER_IN_EXPR (offset,
make_tree (TREE_TYPE (exp),
@ -4983,7 +4990,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
offset_rtx = expand_normal (offset);
gcc_assert (MEM_P (to_rtx));
#ifdef POINTERS_EXTEND_UNSIGNED
if (GET_MODE (offset_rtx) != Pmode)
offset_rtx = convert_to_mode (Pmode, offset_rtx, 0);
@ -5011,14 +5018,14 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
&& bitpos + BITS_PER_WORD <= exp_size * BITS_PER_UNIT)
{
tree type = TREE_TYPE (value);
if (TYPE_PRECISION (type) < BITS_PER_WORD)
{
type = lang_hooks.types.type_for_size
(BITS_PER_WORD, TYPE_UNSIGNED (type));
value = fold_convert (type, value);
}
if (BYTES_BIG_ENDIAN)
value
= fold_build2 (LSHIFT_EXPR, type, value,
@ -5035,7 +5042,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
to_rtx = copy_rtx (to_rtx);
MEM_KEEP_ALIAS_SET_P (to_rtx) = 1;
}
store_constructor_field (to_rtx, bitsize, bitpos, mode,
value, type, cleared,
get_alias_set (TREE_TYPE (field)));
@ -5079,7 +5086,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
tree index, value;
HOST_WIDE_INT count = 0, zero_count = 0;
need_to_clear = ! const_bounds_p;
/* This loop is a more accurate version of the loop in
mostly_zeros_p (it handles RANGE_EXPR in an index). It
is also needed to check for missing elements. */
@ -5089,30 +5096,30 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
if (need_to_clear)
break;
if (index != NULL_TREE && TREE_CODE (index) == RANGE_EXPR)
{
tree lo_index = TREE_OPERAND (index, 0);
tree hi_index = TREE_OPERAND (index, 1);
if (! host_integerp (lo_index, 1)
|| ! host_integerp (hi_index, 1))
{
need_to_clear = 1;
break;
}
this_node_count = (tree_low_cst (hi_index, 1)
- tree_low_cst (lo_index, 1) + 1);
}
else
this_node_count = 1;
count += this_node_count;
if (mostly_zeros_p (value))
zero_count += this_node_count;
}
/* Clear the entire array first if there are any missing
elements, or if the incidence of zero elements is >=
75%. */
@ -5121,7 +5128,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
|| 4 * zero_count >= 3 * count))
need_to_clear = 1;
}
if (need_to_clear && size > 0)
{
if (REG_P (target))
@ -5145,10 +5152,10 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
HOST_WIDE_INT bitpos;
int unsignedp;
rtx xtarget = target;
if (cleared && initializer_zerop (value))
continue;
unsignedp = TYPE_UNSIGNED (elttype);
mode = TYPE_MODE (elttype);
if (mode == BLKmode)
@ -5157,7 +5164,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
: -1);
else
bitsize = GET_MODE_BITSIZE (mode);
if (index != NULL_TREE && TREE_CODE (index) == RANGE_EXPR)
{
tree lo_index = TREE_OPERAND (index, 0);
@ -5165,7 +5172,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
rtx index_r, pos_rtx;
HOST_WIDE_INT lo, hi, count;
tree position;
/* If the range is constant and "small", unroll the loop. */
if (const_bounds_p
&& host_integerp (lo_index, 0)
@ -5183,7 +5190,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
for (; lo <= hi; lo++)
{
bitpos = lo * tree_low_cst (TYPE_SIZE (elttype), 0);
if (MEM_P (target)
&& !MEM_KEEP_ALIAS_SET_P (target)
&& TREE_CODE (type) == ARRAY_TYPE
@ -5192,7 +5199,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
target = copy_rtx (target);
MEM_KEEP_ALIAS_SET_P (target) = 1;
}
store_constructor_field
(target, bitsize, bitpos, mode, value, type, cleared,
get_alias_set (elttype));
@ -5203,18 +5210,18 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
rtx loop_start = gen_label_rtx ();
rtx loop_end = gen_label_rtx ();
tree exit_cond;
expand_normal (hi_index);
unsignedp = TYPE_UNSIGNED (domain);
index = build_decl (VAR_DECL, NULL_TREE, domain);
index_r
= gen_reg_rtx (promote_mode (domain, DECL_MODE (index),
&unsignedp, 0));
SET_DECL_RTL (index, index_r);
store_expr (lo_index, index_r, 0);
/* Build the head of the loop. */
do_pending_stack_adjust ();
emit_label (loop_start);
@ -5231,7 +5238,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
size_binop (MULT_EXPR, position,
fold_convert (ssizetype,
TYPE_SIZE_UNIT (elttype)));
pos_rtx = expand_normal (position);
xtarget = offset_address (target, pos_rtx,
highest_pow2_factor (position));
@ -5246,15 +5253,15 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
exit_cond = build2 (LT_EXPR, integer_type_node,
index, hi_index);
jumpif (exit_cond, loop_end);
/* Update the loop counter, and jump to the head of
the loop. */
expand_assignment (index,
build2 (PLUS_EXPR, TREE_TYPE (index),
index, integer_one_node));
emit_jump (loop_start);
/* Build the end of the loop. */
emit_label (loop_end);
}
@ -5263,17 +5270,17 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
|| ! host_integerp (TYPE_SIZE (elttype), 1))
{
tree position;
if (index == 0)
index = ssize_int (1);
if (minelt)
index = fold_convert (ssizetype,
fold_build2 (MINUS_EXPR,
TREE_TYPE (index),
index,
TYPE_MIN_VALUE (domain)));
position =
size_binop (MULT_EXPR, index,
fold_convert (ssizetype,
@ -5291,7 +5298,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
* tree_low_cst (TYPE_SIZE (elttype), 1));
else
bitpos = (i * tree_low_cst (TYPE_SIZE (elttype), 1));
if (MEM_P (target) && !MEM_KEEP_ALIAS_SET_P (target)
&& TREE_CODE (type) == ARRAY_TYPE
&& TYPE_NONALIASED_COMPONENT (type))
@ -5320,25 +5327,25 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
HOST_WIDE_INT bitpos;
rtvec vector = NULL;
unsigned n_elts;
gcc_assert (eltmode != BLKmode);
n_elts = TYPE_VECTOR_SUBPARTS (type);
if (REG_P (target) && VECTOR_MODE_P (GET_MODE (target)))
{
enum machine_mode mode = GET_MODE (target);
icode = (int) vec_init_optab->handlers[mode].insn_code;
if (icode != CODE_FOR_nothing)
{
unsigned int i;
vector = rtvec_alloc (n_elts);
for (i = 0; i < n_elts; i++)
RTVEC_ELT (vector, i) = CONST0_RTX (GET_MODE_INNER (mode));
}
}
/* If the constructor has fewer elements than the vector,
clear the whole array first. Similarly if this is static
constructor of a non-BLKmode object. */
@ -5350,14 +5357,14 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
{
unsigned HOST_WIDE_INT count = 0, zero_count = 0;
tree value;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value)
{
int n_elts_here = tree_low_cst
(int_const_binop (TRUNC_DIV_EXPR,
TYPE_SIZE (TREE_TYPE (value)),
TYPE_SIZE (elttype), 0), 1);
count += n_elts_here;
if (mostly_zeros_p (value))
zero_count += n_elts_here;
@ -5367,7 +5374,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
or if the incidence of zero elements is >= 75%. */
need_to_clear = (count < n_elts || 4 * zero_count >= 3 * count);
}
if (need_to_clear && size > 0 && !vector)
{
if (REG_P (target))
@ -5376,7 +5383,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
clear_storage (target, GEN_INT (size), BLOCK_OP_NORMAL);
cleared = 1;
}
/* Inform later passes that the old value is dead. */
if (!cleared && !vector && REG_P (target))
emit_move_insn (target, CONST0_RTX (GET_MODE (target)));
@ -5389,16 +5396,16 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
{
HOST_WIDE_INT eltpos;
tree value = ce->value;
bitsize = tree_low_cst (TYPE_SIZE (TREE_TYPE (value)), 1);
if (cleared && initializer_zerop (value))
continue;
if (ce->index)
eltpos = tree_low_cst (ce->index, 1);
else
eltpos = i;
if (vector)
{
/* Vector CONSTRUCTORs should only be built from smaller
@ -5419,14 +5426,14 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
cleared, get_alias_set (elttype));
}
}
if (vector)
emit_insn (GEN_FCN (icode)
(target,
gen_rtx_PARALLEL (GET_MODE (target), vector)));
break;
}
default:
gcc_unreachable ();
}
@ -6965,7 +6972,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& GET_MODE (decl_rtl) != DECL_MODE (exp))
{
enum machine_mode pmode;
/* Get the signedness used for this variable. Ensure we get the
same mode we got when the variable was declared. */
pmode = promote_mode (type, DECL_MODE (exp), &unsignedp,
@ -7336,19 +7343,19 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
tree index1 = index;
tree low_bound = array_ref_low_bound (exp);
index1 = fold_convert (sizetype, TREE_OPERAND (exp, 1));
/* Optimize the special-case of a zero lower bound.
We convert the low_bound to sizetype to avoid some problems
with constant folding. (E.g. suppose the lower bound is 1,
and its mode is QI. Without the conversion,l (ARRAY
+(INDEX-(unsigned char)1)) becomes ((ARRAY+(-(unsigned char)1))
+INDEX), which becomes (ARRAY+255+INDEX). Opps!) */
if (! integer_zerop (low_bound))
index1 = size_diffop (index1, fold_convert (sizetype,
low_bound));
if (0 > compare_tree_int (index1,
TREE_STRING_LENGTH (init)))
{
@ -7751,7 +7758,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
else
{
gcc_assert (REG_P (target));
/* Store this field into a union of the proper type. */
store_field (target,
MIN ((int_size_in_bytes (TREE_TYPE
@ -7837,9 +7844,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
other. */
else if (SCALAR_INT_MODE_P (GET_MODE (op0))
&& SCALAR_INT_MODE_P (TYPE_MODE (type)))
op0 = convert_modes (TYPE_MODE (type), GET_MODE (op0), op0,
op0 = convert_modes (TYPE_MODE (type), GET_MODE (op0), op0,
TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
/* As a last resort, spill op0 to memory, and reload it in a
/* As a last resort, spill op0 to memory, and reload it in a
different mode. */
else if (!MEM_P (op0))
{
@ -8742,7 +8749,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
case REALIGN_LOAD_EXPR:
{
tree oprnd0 = TREE_OPERAND (exp, 0);
tree oprnd0 = TREE_OPERAND (exp, 0);
tree oprnd1 = TREE_OPERAND (exp, 1);
tree oprnd2 = TREE_OPERAND (exp, 2);
rtx op2;
@ -8750,7 +8757,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
this_optab = optab_for_tree_code (code, type);
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
op2 = expand_normal (oprnd2);
temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
target, unsignedp);
gcc_assert (temp);
return temp;
@ -8765,7 +8772,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
op2 = expand_normal (oprnd2);
target = expand_widen_pattern_expr (exp, op0, op1, op2,
target = expand_widen_pattern_expr (exp, op0, op1, op2,
target, unsignedp);
return target;
}
@ -8774,7 +8781,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{
tree oprnd0 = TREE_OPERAND (exp, 0);
tree oprnd1 = TREE_OPERAND (exp, 1);
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, 0);
target = expand_widen_pattern_expr (exp, op0, NULL_RTX, op1,
target, unsignedp);

View File

@ -12591,6 +12591,8 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
CASE_INT_FN (BUILT_IN_FFS):
CASE_INT_FN (BUILT_IN_PARITY):
CASE_INT_FN (BUILT_IN_POPCOUNT):
case BUILT_IN_BSWAP32:
case BUILT_IN_BSWAP64:
/* Always true. */
return 1;

View File

@ -240,7 +240,7 @@ static const char *spec_machine = DEFAULT_TARGET_MACHINE;
/* Nonzero if cross-compiling.
When -b is used, the value comes from the `specs' file. */
#ifdef CROSS_COMPILE
#ifdef CROSS_DIRECTORY_STRUCTURE
static const char *cross_compile = "1";
#else
static const char *cross_compile = "0";
@ -1469,7 +1469,7 @@ static const char *gcc_libexec_prefix;
#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
#endif
#ifdef CROSS_COMPILE /* Don't use these prefixes for a cross compiler. */
#ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
#undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX
#undef MD_STARTFILE_PREFIX_1

View File

@ -959,6 +959,7 @@ check_attr_value (rtx exp, struct attr_desc *attr)
case CTZ:
case POPCOUNT:
case PARITY:
case BSWAP:
XEXP (exp, 0) = check_attr_value (XEXP (exp, 0), attr);
break;

View File

@ -148,6 +148,7 @@ static const char * const optabs[] =
"atan_optab->handlers[$A].insn_code = CODE_FOR_$(atan$a2$)",
"strlen_optab->handlers[$A].insn_code = CODE_FOR_$(strlen$a$)",
"one_cmpl_optab->handlers[$A].insn_code = CODE_FOR_$(one_cmpl$a2$)",
"bswap_optab->handlers[$A].insn_code = CODE_FOR_$(bswap$a2$)",
"ffs_optab->handlers[$A].insn_code = CODE_FOR_$(ffs$a2$)",
"clz_optab->handlers[$A].insn_code = CODE_FOR_$(clz$a2$)",
"ctz_optab->handlers[$A].insn_code = CODE_FOR_$(ctz$a2$)",

View File

@ -274,3 +274,10 @@ GCC_4.2.0 {
__floatuntitf
_Unwind_GetIPInfo
}
%inherit GCC_4.3 GCC_4.2.0
GCC_4.3.0 {
# byte swapping routines
__bswapsi2
__bswapdi2
}

View File

@ -492,6 +492,30 @@ __ashrdi3 (DWtype u, word_type b)
}
#endif
#ifdef L_bswapsi2
UWtype
__bswapsi2 (UWtype u)
{
return ((((u) & 0xff000000) >> 24)
| (((u) & 0x00ff0000) >> 8)
| (((u) & 0x0000ff00) << 8)
| (((u) & 0x000000ff) << 24));
}
#endif
#ifdef L_bswapdi2
UDWtype
__bswapdi2 (UDWtype u)
{
return ((((u) & 0xff00000000000000ull) >> 56)
| (((u) & 0x00ff000000000000ull) >> 40)
| (((u) & 0x0000ff0000000000ull) >> 24)
| (((u) & 0x000000ff00000000ull) >> 8)
| (((u) & 0x00000000ff000000ull) << 8)
| (((u) & 0x0000000000ff0000ull) << 24)
| (((u) & 0x000000000000ff00ull) << 40)
| (((u) & 0x00000000000000ffull) << 56));
}
#endif
#ifdef L_ffssi2
#undef int
int
@ -1862,7 +1886,7 @@ CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
{
MTYPE denom, ratio, x, y;
/* ??? We can get better behavior from logarithmic scaling instead of
/* ??? We can get better behavior from logarithmic scaling instead of
the division. But that would mean starting to link libgcc against
libm. We could implement something akin to ldexp/frexp as gcc builtins
fairly easily... */

View File

@ -345,11 +345,13 @@ extern Wtype __addvSI3 (Wtype, Wtype);
extern Wtype __subvSI3 (Wtype, Wtype);
extern Wtype __mulvSI3 (Wtype, Wtype);
extern Wtype __negvSI2 (Wtype);
extern UWtype __bswapsi2 (UWtype);
extern DWtype __absvDI2 (DWtype);
extern DWtype __addvDI3 (DWtype, DWtype);
extern DWtype __subvDI3 (DWtype, DWtype);
extern DWtype __mulvDI3 (DWtype, DWtype);
extern DWtype __negvDI2 (DWtype);
extern UDWtype __bswapdi2 (UDWtype);
#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
extern SItype __absvsi2 (SItype);

View File

@ -29,11 +29,11 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifdef index
#undef index
#endif
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#include <a.out.h>
#else
#include "mips/a.out.h"
#endif /* CROSS_COMPILE */
#endif /* CROSS_DIRECTORY_STRUCTURE */
/* Include getopt.h for the sake of getopt_long. */
#include "getopt.h"

View File

@ -667,11 +667,11 @@ main (void)
#include <signal.h>
#ifndef CROSS_COMPILE
#ifndef CROSS_DIRECTORY_STRUCTURE
#include <a.out.h>
#else
#include "mips/a.out.h"
#endif /* CROSS_COMPILE */
#endif /* CROSS_DIRECTORY_STRUCTURE */
#include "gstab.h"

View File

@ -91,7 +91,7 @@ lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
_popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
_powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
_divxc3 _divtc3'
_divxc3 _divtc3 _bswapsi2 _bswapdi2'
if [ "$LIB2_SIDITI_CONV_FUNCS" ]; then
for func in $swfloatfuncs; do

View File

@ -2591,6 +2591,10 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
goto try_libcall;
}
/* We can't widen a bswap. */
if (unoptab == bswap_optab)
goto try_libcall;
if (CLASS_HAS_WIDER_MODES_P (class))
for (wider_mode = GET_MODE_WIDER_MODE (mode);
wider_mode != VOIDmode;
@ -5253,6 +5257,7 @@ init_optabs (void)
absv_optab = init_optabv (ABS);
addcc_optab = init_optab (UNKNOWN);
one_cmpl_optab = init_optab (NOT);
bswap_optab = init_optab (BSWAP);
ffs_optab = init_optab (FFS);
clz_optab = init_optab (CLZ);
ctz_optab = init_optab (CTZ);
@ -5456,6 +5461,11 @@ init_optabs (void)
init_interclass_conv_libfuncs (trunc_optab, "trunc", MODE_FLOAT, MODE_DECIMAL_FLOAT);
init_interclass_conv_libfuncs (trunc_optab, "trunc", MODE_DECIMAL_FLOAT, MODE_FLOAT);
/* Explicitly initialize the bswap libfuncs since we need them to be
valid for things other than word_mode. */
set_optab_libfunc (bswap_optab, SImode, "__bswapsi2");
set_optab_libfunc (bswap_optab, DImode, "__bswapdi2");
/* Use cabs for double complex abs, since systems generally have cabs.
Don't define any libcall for float complex, so that cabs will be used. */
if (complex_double_type_node)

View File

@ -146,6 +146,8 @@ enum optab_index
/* Abs value */
OTI_abs,
OTI_absv,
/* Byteswap */
OTI_bswap,
/* Bitwise not */
OTI_one_cmpl,
/* Bit scanning and counting */
@ -315,6 +317,7 @@ extern GTY(()) optab optab_table[OTI_MAX];
#define abs_optab (optab_table[OTI_abs])
#define absv_optab (optab_table[OTI_absv])
#define one_cmpl_optab (optab_table[OTI_one_cmpl])
#define bswap_optab (optab_table[OTI_bswap])
#define ffs_optab (optab_table[OTI_ffs])
#define clz_optab (optab_table[OTI_clz])
#define ctz_optab (optab_table[OTI_ctz])

View File

@ -2555,6 +2555,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
case CTZ:
case POPCOUNT:
case PARITY:
case BSWAP:
new = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
if (new != XEXP (x, 0))
return gen_rtx_fmt_e (code, GET_MODE (x), new);
@ -2775,6 +2776,7 @@ elimination_effects (rtx x, enum machine_mode mem_mode)
case CTZ:
case POPCOUNT:
case PARITY:
case BSWAP:
elimination_effects (XEXP (x, 0), mem_mode);
return;

View File

@ -567,6 +567,9 @@ DEF_RTL_EXPR(ABS, "abs", "e", RTX_UNARY)
/* Square root */
DEF_RTL_EXPR(SQRT, "sqrt", "e", RTX_UNARY)
/* Swap bytes. */
DEF_RTL_EXPR(BSWAP, "bswap", "e", RTX_UNARY)
/* Find first bit that is set.
Value is 1 + number of trailing zeros in the arg.,
or 0 if arg is 0. */

View File

@ -1044,6 +1044,9 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
val &= 1;
break;
case BSWAP:
return 0;
case TRUNCATE:
val = arg0;
break;
@ -4887,4 +4890,3 @@ simplify_rtx (rtx x)
}
return NULL;
}

View File

@ -1,5 +1,5 @@
/* Generic SSA value propagation engine.
Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@ -176,6 +176,8 @@ cfg_blocks_empty_p (void)
static void
cfg_blocks_add (basic_block bb)
{
bool head = false;
gcc_assert (bb != ENTRY_BLOCK_PTR && bb != EXIT_BLOCK_PTR);
gcc_assert (!TEST_BIT (bb_in_list, bb->index));
@ -198,12 +200,26 @@ cfg_blocks_add (basic_block bb)
cfg_blocks_head = 0;
VEC_safe_grow (basic_block, heap, cfg_blocks, 2 * cfg_blocks_tail);
}
else
/* Minor optimization: we prefer to see blocks with more
predecessors later, because there is more of a chance that
the incoming edges will be executable. */
else if (EDGE_COUNT (bb->preds)
>= EDGE_COUNT (VEC_index (basic_block, cfg_blocks,
cfg_blocks_head)->preds))
cfg_blocks_tail = ((cfg_blocks_tail + 1)
% VEC_length (basic_block, cfg_blocks));
else
{
if (cfg_blocks_head == 0)
cfg_blocks_head = VEC_length (basic_block, cfg_blocks);
--cfg_blocks_head;
head = true;
}
}
VEC_replace (basic_block, cfg_blocks, cfg_blocks_tail, bb);
VEC_replace (basic_block, cfg_blocks,
head ? cfg_blocks_head : cfg_blocks_tail,
bb);
SET_BIT (bb_in_list, bb->index);
}

View File

@ -6044,41 +6044,48 @@ clean_symbol_name (char *p)
*p = '_';
}
/* Generate a name for a function unique to this translation unit.
/* Generate a name for a special-purpose function function.
The generated name may need to be unique across the whole link.
TYPE is some string to identify the purpose of this function to the
linker or collect2. */
linker or collect2; it must start with an uppercase letter,
one of:
I - for constructors
D - for destructors
N - for C++ anonymous namespaces
F - for DWARF unwind frame information. */
tree
get_file_function_name_long (const char *type)
get_file_function_name (const char *type)
{
char *buf;
const char *p;
char *q;
/* If we already have a name we know to be unique, just use that. */
if (first_global_object_name)
p = first_global_object_name;
/* If the target is handling the constructors/destructors, they
will be local to this file and the name is only necessary for
debugging purposes. */
else if ((type[0] == 'I' || type[0] == 'D') && targetm.have_ctors_dtors)
{
p = first_global_object_name;
/* For type 'F', the generated name must be unique not only to this
translation unit but also to any given link. Since global names
can be overloaded, we concatenate the first global object name
with a string derived from the file name of this object. */
if (!strcmp (type, "F"))
{
const char *file = main_input_filename;
if (! file)
file = input_filename;
q = alloca (strlen (p) + 10);
sprintf (q, "%s_%08X", p, crc32_string (0, file));
p = q;
}
const char *file = main_input_filename;
if (! file)
file = input_filename;
/* Just use the file's basename, because the full pathname
might be quite long. */
p = strrchr (file, '/');
if (p)
p++;
else
p = file;
p = q = ASTRDUP (p);
clean_symbol_name (q);
}
else
{
/* We don't have anything that we know to be unique to this translation
/* Otherwise, the name must be unique across the entire link.
We don't have anything that we know to be unique to this translation
unit, so use what we do have and throw in some randomness. */
unsigned len;
const char *name = weak_global_object_name;
@ -6110,20 +6117,6 @@ get_file_function_name_long (const char *type)
return get_identifier (buf);
}
/* If KIND=='I', return a suitable global initializer (constructor) name.
If KIND=='D', return a suitable global clean-up (destructor) name. */
tree
get_file_function_name (int kind)
{
char p[2];
p[0] = kind;
p[1] = 0;
return get_file_function_name_long (p);
}
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
@ -6585,6 +6578,10 @@ build_common_tree_nodes_2 (int short_double)
long_double_ptr_type_node = build_pointer_type (long_double_type_node);
integer_ptr_type_node = build_pointer_type (integer_type_node);
/* Fixed size integer types. */
uint32_type_node = build_nonstandard_integer_type (32, true);
uint64_type_node = build_nonstandard_integer_type (64, true);
/* Decimal float types. */
dfloat32_type_node = make_node (REAL_TYPE);
TYPE_PRECISION (dfloat32_type_node) = DECIMAL32_TYPE_SIZE;

View File

@ -3245,6 +3245,9 @@ enum tree_index
TI_UINTDI_TYPE,
TI_UINTTI_TYPE,
TI_UINT32_TYPE,
TI_UINT64_TYPE,
TI_INTEGER_ZERO,
TI_INTEGER_ONE,
TI_INTEGER_MINUS_ONE,
@ -3320,6 +3323,9 @@ extern GTY(()) tree global_trees[TI_MAX];
#define unsigned_intDI_type_node global_trees[TI_UINTDI_TYPE]
#define unsigned_intTI_type_node global_trees[TI_UINTTI_TYPE]
#define uint32_type_node global_trees[TI_UINT32_TYPE]
#define uint64_type_node global_trees[TI_UINT64_TYPE]
#define integer_zero_node global_trees[TI_INTEGER_ZERO]
#define integer_one_node global_trees[TI_INTEGER_ONE]
#define integer_minus_one_node global_trees[TI_INTEGER_MINUS_ONE]
@ -4185,7 +4191,7 @@ extern GTY(()) const char * current_function_func_begin_label;
/* In tree.c */
extern unsigned crc32_string (unsigned, const char *);
extern void clean_symbol_name (char *);
extern tree get_file_function_name_long (const char *);
extern tree get_file_function_name (const char *);
extern tree get_callee_fndecl (tree);
extern void change_decl_assembler_name (tree, tree);
extern int type_num_arguments (tree);
@ -4528,10 +4534,6 @@ extern void gimplify_function_tree (tree);
extern const char *get_name (tree);
extern tree unshare_expr (tree);
extern void sort_case_labels (tree);
/* If KIND=='I', return a suitable global initializer (constructor) name.
If KIND=='D', return a suitable global clean-up (destructor) name. */
extern tree get_file_function_name (int);
/* Interface of the DWARF2 unwind info support. */