summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-04 17:56:55 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-04 17:56:55 +0000
commitda9055d29af60e521b94ef9d06e5e99f4e79e6a9 (patch)
tree5f6e71850acc8fc72a303b3e8977d8f2ef788bc4
parentb4df425bacd370bd1700ca7ba7e6fe4f830b5eb8 (diff)
downloadgcc-da9055d29af60e521b94ef9d06e5e99f4e79e6a9.tar.gz
2008-12-04 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r142432 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@142441 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog67
-rw-r--r--ChangeLog.melt3
-rw-r--r--MAINTAINERS8
-rw-r--r--Makefile.def3
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--gcc/ChangeLog150
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/builtins.c44
-rw-r--r--gcc/combine.c4
-rw-r--r--gcc/config/i386/t-darwin646
-rw-r--r--gcc/config/i386/winnt.c31
-rw-r--r--gcc/config/m68k/lb1sf68.asm82
-rw-r--r--gcc/config/mips/mips.c5
-rw-r--r--gcc/config/mips/mips.md49
-rw-r--r--gcc/config/spu/float_unsdidf.c4
-rw-r--r--gcc/config/spu/float_unssidf.c2
-rw-r--r--gcc/config/stormy16/stormy16.c485
-rw-r--r--gcc/config/stormy16/stormy16.h5
-rw-r--r--gcc/config/stormy16/stormy16.md246
-rwxr-xr-xgcc/configure116
-rw-r--r--gcc/configure.ac46
-rw-r--r--gcc/cp/ChangeLog33
-rw-r--r--gcc/cp/call.c20
-rw-r--r--gcc/cp/cp-tree.h6
-rw-r--r--gcc/cp/decl.c58
-rw-r--r--gcc/cp/init.c71
-rw-r--r--gcc/cp/parser.c10
-rw-r--r--gcc/cp/pt.c1
-rw-r--r--gcc/cse.c2
-rw-r--r--gcc/emit-rtl.c3
-rw-r--r--gcc/fold-const.c10
-rw-r--r--gcc/fortran/ChangeLog21
-rw-r--r--gcc/fortran/Make-lang.in4
-rw-r--r--gcc/fortran/decl.c3
-rw-r--r--gcc/fortran/expr.c25
-rw-r--r--gcc/fortran/primary.c3
-rw-r--r--gcc/fortran/resolve.c2
-rw-r--r--gcc/fortran/symbol.c5
-rw-r--r--gcc/fortran/trans-types.c7
-rw-r--r--gcc/gimplify.c9
-rw-r--r--gcc/testsuite/ChangeLog91
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto11.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted5.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist10.C53
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist9.C29
-rw-r--r--gcc/testsuite/g++.dg/init/value5.C17
-rw-r--r--gcc/testsuite/g++.dg/tc1/dr152.C4
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37716.C56
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/ctor1.C2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20081203-1.c24
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr38343-2.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr38343.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr38359.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr38360.c9
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/darwin-comm.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr37868.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr36326.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr38250.c24
-rw-r--r--gcc/testsuite/gcc.dg/union-4.c23
-rw-r--r--gcc/testsuite/gcc.misc-tests/linkage.exp15
-rw-r--r--gcc/testsuite/gfortran.dg/entry_7.f902
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_11.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_12.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_2.f905
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_3.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/result_1.f9018
-rw-r--r--gcc/tree-data-ref.c12
-rw-r--r--gcc/tree-data-ref.h2
-rw-r--r--gcc/tree-loop-distribution.c30
-rw-r--r--gcc/tree-predcom.c6
-rw-r--r--gcc/tree-sra.c86
-rw-r--r--gcc/tree-ssa-ccp.c25
-rw-r--r--gcc/tree-ssa-forwprop.c27
-rw-r--r--gcc/tree-ssa-pre.c2
-rw-r--r--libjava/ChangeLog11
-rwxr-xr-xlibjava/configure2
-rw-r--r--libjava/configure.ac2
-rw-r--r--libjava/testsuite/lib/libjava.exp2
-rw-r--r--libstdc++-v3/ChangeLog15
-rw-r--r--libstdc++-v3/src/localename.cc56
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc45
85 files changed, 1772 insertions, 733 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ea8fef6c4f..a49ff418c9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2008-12-04 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * configure.ac: Add double brackets on darwin[912].
+ * configure: Regenerate.
+
+2008-12-03 Daniel Kraft <d@domob.eu>
+
+ * MAINTAINERS: Moved myself and Mikael Morin from Write After
+ Approval to Reviewer section (for Fortran front-end).
+
+2008-12-02 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * configure.ac: Expand to darwin10 and later.
+ * configure: Regenerate.
+
+2008-12-02 Andreas Schwab <schwab@suse.de>
+
+ * Makefile.def: configure-target-boehm-gc depends on
+ all-target-libstdc++-v3.
+ * Makefile.in: Regenerate.
+
+2008-12-02 Kai Tietz <kai.tietz@onevision.com>
+
+ * MAINTAINERS: Add myself as mingw maintainer.
+
2008-12-02 Ben Elliston <bje@au.ibm.com>
* config.sub, config.guess: Update from upstream sources.
@@ -76,11 +101,11 @@
2008-11-04 Thomas Schwinge <tschwinge@gnu.org>
- * MAINTAINERS (Write after approval): Add myself.
+ * MAINTAINERS (Write after approval): Add myself.
2008-10-31 Mikael Morin <mikael.morin@tele2.fr>
- * MAINTAINERS (Write after approval): Add myself.
+ * MAINTAINERS (Write after approval): Add myself.
2008-10-31 Ben Elliston <bje@au.ibm.com>
@@ -177,11 +202,11 @@
2008-09-20 Steven Bosscher <steven@gcc.gnu.org>
- * MAINTAINERS: Add myself in "Write After Approval".
+ * MAINTAINERS: Add myself in "Write After Approval".
2008-09-18 Steve Ellcey <sje@cup.hp.com>
- * MAINTAINERS: Add myself as ia64 maintainer.
+ * MAINTAINERS: Add myself as ia64 maintainer.
2008-09-04 Gerald Pfeifer <gerald@pfeifer.com>
@@ -364,7 +389,7 @@
2008-05-18 Xinliang David Li <davidxl@google.com>
- * ChangeLog: Remove wrong ChangeLog entry.
+ * ChangeLog: Remove wrong ChangeLog entry.
2008-05-17 Xinliang David Li <davidxl@google.com>
@@ -385,7 +410,7 @@
2008-05-10 Paolo Carlini <paolo.carlini@oracle.com>
* MAINTAINERS: Update my email address.
-
+
2008-05-03 Kris Van Hees <kris.van.hees@oracle.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -403,8 +428,8 @@
Sync with src:
2008-04-14 David S. Miller <davem@davemloft.net>
- * configure.ac: Add sparc*-*-* to gold supported targets.
- * configure: Regenerate.
+ * configure.ac: Add sparc*-*-* to gold supported targets.
+ * configure: Regenerate.
2008-04-18 Paolo Bonzini <bonzini@gnu.org>
@@ -414,14 +439,14 @@
2008-04-18 Paolo Bonzini <bonzini@gnu.org>
- * Makefile.tpl (restrap): Call `make all' using double-colon rules.
- * Makefile.in: Regenerate.
+ * Makefile.tpl (restrap): Call `make all' using double-colon rules.
+ * Makefile.in: Regenerate.
2008-04-18 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
- * configure.ac (cr16-*-*): Add case for cr16 target and include gdb
+ * configure.ac (cr16-*-*): Add case for cr16 target and include gdb
as nonconfigurable directories list.
- * configure: Regenerate.
+ * configure: Regenerate.
2008-04-14 Ben Elliston <bje@au.ibm.com>
@@ -456,8 +481,8 @@
2008-04-04 NightStrike <NightStrike@gmail.com>
PR other/35151
- * configure.ac: Combine rules for mingw32 and mingw64.
- * configure: Regenerate.
+ * configure.ac: Combine rules for mingw32 and mingw64.
+ * configure: Regenerate.
2008-04-02 Kai Tietz <kai.tietz@onvision.com>
@@ -502,9 +527,9 @@
* configure: Regenerate.
Backport from upstream Libtool:
-
+
2007-10-12 Eric Blake <ebb9@byu.net>
-
+
Deal with Autoconf 2.62's semantic change in m4_append.
* ltsugar.m4 (lt_append): Replace broken versions of
m4_append.
@@ -791,7 +816,7 @@
* Makefile.def: Add libgomp config as a maybe dependency for libstdc++.
* configure: Regenerate.
* Makefile.in: Regenerate.
-
+
2007-09-17 Andreas Schwab <schwab@suse.de>
* configure.ac: Raise minimum makeinfo version to 4.6.
@@ -983,13 +1008,13 @@
* configure.ac: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
-
+
2007-06-28 DJ Delorie <dj@redhat.com>
* configure.ac (arm*-*-linux-gnueabi): Don't build libgloss if we're
not building newlib.
* configure: Regenerated.
-
+
2007-06-28 Jan Sjodin <jan.sjodin@amd.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -1168,7 +1193,7 @@
2007-04-04 Christian Bruel <christian.bruel@st.com>
* MAINTAINERS (Write After Approval): Add myself.
-
+
2007-04-02 Dave Korn <dave.korn@artimi.com>
* MAINTAINERS (Write After Approval): Add myself.
@@ -1180,7 +1205,7 @@
2007-03-28 Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
* MAINTAINERS (Write After Approval): Add myself.
-
+
2007-03-24 Ayal Zaks <zaks@il.ibm.com>
* MAINTAINERS (Modulo Scheduler): Add myself.
diff --git a/ChangeLog.melt b/ChangeLog.melt
index 0b3e65a9b67..4cce2d01159 100644
--- a/ChangeLog.melt
+++ b/ChangeLog.melt
@@ -1,3 +1,6 @@
+2008-12-04 Basile Starynkevitch <basile@starynkevitch.net>
+ MELT branch merged with trunk r142432
+
2008-12-02 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r142344
diff --git a/MAINTAINERS b/MAINTAINERS
index 8acc9711469..7d342e3c85a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -116,6 +116,7 @@ RTEMS Ports Ralf Corsepius ralf.corsepius@rtems.org
VxWorks ports Nathan Sidwell nathan@codesourcery.com
windows, cygwin, mingw Christopher Faylor me.gcc@gcc.gnu.org
windows, cygwin, mingw Danny Smith dannysmith@users.sourceforge.net
+windows, cygwin, mingw Kai Tietz kai.tietz@onevision.com
Language Front Ends Maintainers
@@ -247,10 +248,13 @@ Fortran Tobias Burnus burnus@net-b.de
Fortran Jerry DeLisle jvdelisle@gcc.gnu.org
Fortran Erik Edelmann erik.edelmann@iki.fi
Fortran Thomas König tkoenig@gcc.gnu.org
+Fortran Daniel Kraft d@domob.eu
Fortran Toon Moene toon@moene.org
+Fortran Mikael Morin mikael.morin@tele2.fr
Fortran Brooks Moses brooks.moses@codesourcery.com
Fortran Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Fortran Paul Thomas pault@gcc.gnu.org
+Fortran Janus Weil janus@gcc.gnu.org
Graphite Daniel Berlin dberlin@dberlin.org
Graphite Sebastian Pop sebastian.pop@amd.com
register allocation Peter Bergner bergner@vnet.ibm.com
@@ -356,7 +360,6 @@ Jeff Knaggs jknaggs@redhat.com
Michael Koch konqueror@gmx.de
Dave Korn dave.korn.cygwin@gmail.com
Matt Kraai kraai@ftbfs.org
-Daniel Kraft d@domob.eu
Maxim Kuvyrkov maxim@codesourcery.com
Doug Kwan dougkwan@google.com
Scott Robert Ladd scott.ladd@coyotegulch.com
@@ -392,7 +395,6 @@ Lee Millward lee.millward@gmail.com
Alan Modra amodra@bigpond.net.au
Alexander Monakov amonakov@ispras.ru
Catherine Moore clm@codesourcery.com
-Mikael Morin mikael.morin@tele2.fr
James A. Morrison phython@gcc.gnu.org
Dirk Mueller dmueller@suse.de
Adam Nemet anemet@caviumnetworks.com
@@ -444,14 +446,12 @@ Gabriele Svelto gabriele.svelto@st.com
Samuel Tardieu sam@rfc1149.net
Kresten Krab Thorup krab@gcc.gnu.org
Caroline Tice ctice@apple.com
-Kai Tietz kai.tietz@onevision.com
David Ung davidu@mips.com
Kris Van Hees kris.van.hees@oracle.com
Jonathan Wakely redi@gcc.gnu.org
Feng Wang fengwang@nudt.edu.cn
Stephen M. Webb stephen.webb@bregmasoft.com
John Wehle john@feith.com
-Janus Weil janus@gcc.gnu.org
Florian Weimer fw@deneb.enyo.de
Zack Weinberg zackw@panix.com
Mark Wielaard mark@gcc.gnu.org
diff --git a/Makefile.def b/Makefile.def
index b5e38151e3a..dea795ac895 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -4,7 +4,7 @@ AutoGen definitions Makefile.tpl;
// Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
// This file was originally written by Nathanael Nerode.
//
-// Copyright 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
+// Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation
//
// This file is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -496,6 +496,7 @@ lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; };
lang_env_dependencies = { module=libiberty; no_c=true; };
dependencies = { module=configure-target-boehm-gc; on=configure-target-qthreads; };
+dependencies = { module=configure-target-boehm-gc; on=all-target-libstdc++-v3; };
dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
dependencies = { module=all-target-fastjar; on=all-target-zlib; };
dependencies = { module=all-target-fastjar; on=all-target-libiberty; };
diff --git a/Makefile.in b/Makefile.in
index 0f235fd740c..ab03aabc5b2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -55703,6 +55703,7 @@ all-send-pr: maybe-all-prms
all-tar: maybe-all-build-texinfo
all-uudecode: maybe-all-build-texinfo
configure-target-boehm-gc: maybe-configure-target-qthreads
+configure-target-boehm-gc: maybe-all-target-libstdc++-v3
configure-target-fastjar: maybe-configure-target-zlib
all-target-fastjar: maybe-all-target-zlib
all-target-fastjar: maybe-all-target-libiberty
diff --git a/configure b/configure
index 8bf9f059763..403982c69fb 100755
--- a/configure
+++ b/configure
@@ -2210,7 +2210,7 @@ case "${target}" in
*-*-chorusos)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
- powerpc-*-darwin* | x86_64-*-darwin9*)
+ powerpc-*-darwin* | x86_64-*-darwin[912]*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
diff --git a/configure.ac b/configure.ac
index 1a95b1955e5..21fcf78ed49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -446,7 +446,7 @@ case "${target}" in
*-*-chorusos)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
- powerpc-*-darwin* | x86_64-*-darwin9*)
+ powerpc-*-darwin* | x86_64-*-darwin[[912]]*)
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 33a076943ee..49d2b33fdb0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,153 @@
+2008-12-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * cse.c (equiv_constant): Fix pasto.
+
+2008-12-04 Nick Clifton <nickc@redhat.com>
+
+ * config/stormy16/stormy16.md: Remove extraneous spaces and
+ quotes.
+ * config/stormy16/stormy16.c: Remove extraneous spaces and fix up
+ formatting of quotes.
+
+2008-12-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38371
+ * fold-const.c (fold_checksum_tree): Allow modification of
+ TYPE_NEXT_VARIANT.
+
+2008-12-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38360
+ * tree-ssa-ccp.c (ccp_fold_builtin): Bail out if the builtin doesn't
+ have the right number of arguments.
+
+2008-12-03 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36326
+ * gimplify.c (is_gimple_mem_or_call_rhs): Remove work-around for
+ non-BLKmode types.
+
+2008-12-03 Tomas Bily <tbily@suse.cz>
+
+ PR middle-end/38250
+ * tree-loop-distribution.c (build_size_arg): New function.
+ (generate_memset_zero): Checks if dr_analyze_innermost succeed.
+ Reorganized generating of stmts.
+ * testsuite/gcc.dg/tree-ssa/pr38250.c: New file.
+ * tree-data-ref.c (dr_analyze_innermost): Returns bool.
+ Indicate if analysis succeed.
+ * tree-data-ref.h (dr_analyze_innermost): Returns bool.
+ * tree-predcom.c (valid_initializer_p, find_looparound_phi):
+ Uses new definition of dr_analyze_innermost.
+
+2008-12-03 Ben Elliston <bje@au.ibm.com>
+
+ * tree-ssa-pre.c (do_regular_insertion): Initialise edoubleprime.
+
+2008-12-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/37716
+ * tree-sra.c (sra_build_assignment): For scalar bitfield SRC construct
+ all the needed operations as trees and gimplify_assign it to dst.
+
+ PR target/37610
+ * configure.ac (gcc_cv_readelf): Look for readelf.
+ (gcc_cv_as_cfi_advance_working): Check for working
+ cfi advances with code alignment factor > 1.
+ (HAVE_GAS_CFI_DIRECTIVE): Don't define if cfi advances
+ don't work properly.
+ * configure: Regenerated.
+
+2008-12-03 Eric Botcazou <ebotcazou@adacore.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR rtl-optimization/38281
+ * combine.c (distribute_notes): When invoking SET_INSN_DELETED on i2,
+ set it to NULL_RTX afterwards.
+
+ * emit-rtl.c (set_insn_deleted): Fix formatting.
+
+2008-12-02 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips.c (mips_expand_builtin): Fix the mode of the
+ error return value.
+ * config/mips/mips.md (IMOVE32): New mode iterator.
+ (movsi): Generalize with IMOVE32.
+ (*movsi_internal): Likewise.
+ (*mov<mode>_mips16): Likewise.
+ (*lwxs): Likewise.
+
+2008-12-02 Nathan Sidwell <nathan@codesourcery.com>
+ Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * config/m68k/lb1sf68.asm (PICCALL, PICJUMP): Use GOT instead of
+ PC-relative addressing when compiling for uclinux PIC.
+ (__cmpdf_internal, __cmpsf_internal): Hide.
+ (__cmpdf, __cmpsf): Use PIC call sequence.
+
+2008-12-02 Andreas Tobler <a.tobler@schweiz.org>
+ Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * config/i386/t-darwin64: Add m32 multilib support.
+
+2008-12-02 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * testsuite/gcc.dg/darwin-comm.c: Expand to darwin10 and later.
+
+2008-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38343
+ * builtins.c (fold_builtin_memory_op): Convert len to sizetype
+ before using it in POINTER_PLUS_EXPR.
+
+2008-12-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/38359
+ * fold-const.c (fold_binary): Fold -1 >> x to -1 only for
+ non-negative x.
+
+2008-12-02 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/37861
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Do not check
+ for INDIRECT_REFs.
+ (forward_propagate_addr_into_variable_array_index): Check that the
+ offset is not computed from a MULT_EXPR, use is_gimple_assign rather
+ than the gimple code directly.
+
+2008-12-02 Ben Elliston <bje@au.ibm.com>
+
+ * config/spu/float_disf.c (__floatdisf): Prototype.
+ * config/spu/float_unsdisf.c (__float_undisf): Likewise.
+ * config/spu/float_unssidf.c (__float_unssidf): Constify cast.
+ * config/spu/float_unsdidf.c (__float_unsdidf): Likewise.
+
+2008-12-02 DJ Delorie <dj@redhat.com>
+
+ * config/stormy16/stormy16.h (INCOMING_FRAME_SP_OFFSET): Negate.
+ (DWARF_CIE_DATA_ALIGNMENT): Define.
+
+ * config/stormy16/stormy16.c (xstormy16_compute_stack_layout):
+ Invert add/sub for INCOMING_FRAME_SP_OFFSET.
+ (xstormy16_expand_prologue): Likewise.
+ (xstormy16_expand_builtin_va_start): Likewise.
+ (xstormy16_gimplify_va_arg_expr): Likewise.
+
+2008-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38343
+ * builtins.c (expand_builtin_mempcpy_args): Handle COMPOUND_EXPRs
+ potentially returned from folding memcpy.
+ (expand_builtin_stpcpy_args): Similarly for folding strcpy.
+ (fold_builtin_2): Handle BUILT_IN_STPCPY if result is ignored.
+
+2008-12-02 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR target/38054
+ * config/i386/winnt.c (i386_pe_encode_section_info): Condition stdcall
+ decoration of function RTL names here on Ada language.
+
2008-12-01 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/38280
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 040675f3c0e..811bd63db75 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20081202
+20081204
diff --git a/gcc/builtins.c b/gcc/builtins.c
index a6ee5a96729..444baa606d1 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3406,7 +3406,7 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode)
stpcpy. */
static rtx
-expand_builtin_mempcpy(tree exp, rtx target, enum machine_mode mode)
+expand_builtin_mempcpy (tree exp, rtx target, enum machine_mode mode)
{
if (!validate_arglist (exp,
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
@@ -3433,15 +3433,18 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len, tree type,
rtx target, enum machine_mode mode, int endp)
{
/* If return value is ignored, transform mempcpy into memcpy. */
- if (target == const0_rtx)
+ if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_MEMCPY])
{
tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ tree result = build_call_expr (fn, 3, dest, src, len);
- if (!fn)
- return NULL_RTX;
-
- return expand_expr (build_call_expr (fn, 3, dest, src, len),
- target, mode, EXPAND_NORMAL);
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
}
else
{
@@ -3707,14 +3710,19 @@ expand_builtin_stpcpy (tree exp, rtx target, enum machine_mode mode)
src = CALL_EXPR_ARG (exp, 1);
/* If return value is ignored, transform stpcpy into strcpy. */
- if (target == const0_rtx)
+ if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_STRCPY])
{
tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
- if (!fn)
- return NULL_RTX;
+ tree result = build_call_expr (fn, 2, dst, src);
- return expand_expr (build_call_expr (fn, 2, dst, src),
- target, mode, EXPAND_NORMAL);
+ STRIP_NOPS (result);
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
}
else
{
@@ -8985,6 +8993,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len,
ssize_int (1));
+ len = fold_convert (sizetype, len);
dest = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest, len);
dest = fold_convert (type, dest);
if (expr)
@@ -10463,6 +10472,17 @@ fold_builtin_2 (tree fndecl, tree arg0, tree arg1, bool ignore)
case BUILT_IN_STRCPY:
return fold_builtin_strcpy (fndecl, arg0, arg1, NULL_TREE);
+ case BUILT_IN_STPCPY:
+ if (ignore)
+ {
+ tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
+ if (!fn)
+ break;
+
+ return build_call_expr (fn, 2, arg0, arg1);
+ }
+ break;
+
case BUILT_IN_STRCMP:
return fold_builtin_strcmp (arg0, arg1);
diff --git a/gcc/combine.c b/gcc/combine.c
index b8a43356b46..d6f7480223a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -12653,6 +12653,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
distribute_links (LOG_LINKS (tem));
SET_INSN_DELETED (tem);
+ if (tem == i2)
+ i2 = NULL_RTX;
#ifdef HAVE_cc0
/* Delete the setter too. */
@@ -12668,6 +12670,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
distribute_links (LOG_LINKS (cc0_setter));
SET_INSN_DELETED (cc0_setter);
+ if (cc0_setter == i2)
+ i2 = NULL_RTX;
}
#endif
}
diff --git a/gcc/config/i386/t-darwin64 b/gcc/config/i386/t-darwin64
index 5143e3819dc..81b4565ac72 100644
--- a/gcc/config/i386/t-darwin64
+++ b/gcc/config/i386/t-darwin64
@@ -1,2 +1,8 @@
LIB2_SIDITI_CONV_FUNCS=yes
LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c
+
+MULTILIB_OPTIONS = m32
+MULTILIB_DIRNAMES = i386
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 7815be007a8..48b82131d3f 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "toplev.h"
#include "hashtab.h"
+#include "langhooks.h"
#include "ggc.h"
#include "target.h"
@@ -258,27 +259,19 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first)
switch (TREE_CODE (decl))
{
case FUNCTION_DECL:
- if (first)
+ /* FIXME: Imported stdcall names are not modified by the Ada frontend.
+ Check and decorate the RTL name now. */
+ if (strcmp (lang_hooks.name, "GNU Ada") == 0)
{
- /* FIXME: In Ada, and perhaps other language frontends,
- imported stdcall names may not yet have been modified.
- Check and do it know. */
- tree new_id;
- tree old_id = DECL_ASSEMBLER_NAME (decl);
- const char* asm_str = IDENTIFIER_POINTER (old_id);
- /* Do not change the identifier if a verbatim asmspec
+ tree new_id;
+ tree old_id = DECL_ASSEMBLER_NAME (decl);
+ const char* asm_str = IDENTIFIER_POINTER (old_id);
+ /* Do not change the identifier if a verbatim asmspec
or if stdcall suffix already added. */
- if (*asm_str == '*' || strchr (asm_str, '@'))
- break;
- if ((new_id = i386_pe_maybe_mangle_decl_assembler_name (decl, old_id)))
- {
- /* These attributes must be present on first declaration,
- change_decl_assembler_name will warn if they are added
- later and the decl has been referenced, but duplicate_decls
- should catch the mismatch first. */
- change_decl_assembler_name (decl, new_id);
- XSTR (symbol, 0) = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- }
+ if (!(*asm_str == '*' || strchr (asm_str, '@'))
+ && (new_id = i386_pe_maybe_mangle_decl_assembler_name (decl,
+ old_id)))
+ XSTR (symbol, 0) = IDENTIFIER_POINTER (new_id);
}
break;
diff --git a/gcc/config/m68k/lb1sf68.asm b/gcc/config/m68k/lb1sf68.asm
index ebfcb88f42d..a3d96d6661e 100644
--- a/gcc/config/m68k/lb1sf68.asm
+++ b/gcc/config/m68k/lb1sf68.asm
@@ -129,30 +129,6 @@ Boston, MA 02110-1301, USA. */
#else /* __PIC__ */
- /* Common for Linux and uClinux, the latter with either
- -mid-shared-library or -msep-data. */
-
- .macro PICCALL addr
-#if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
- lea \addr-.-8,a0
- jsr pc@(a0)
-#else
- bsr \addr
-#endif
- .endm
-
- .macro PICJUMP addr
- /* ISA C has no bra.l instruction, and since this assembly file
- gets assembled into multiple object files, we avoid the
- bra instruction entirely. */
-#if defined (__mcoldfire__) && !defined (__mcfisab__)
- lea \addr-.-8,a0
- jmp pc@(a0)
-#else
- bra \addr
-#endif
- .endm
-
# if defined (__uClinux__)
/* Versions for uClinux */
@@ -171,6 +147,16 @@ Boston, MA 02110-1301, USA. */
movel \sym@GOT(\areg), sp@-
.endm
+ .macro PICCALL addr
+ PICLEA \addr,a0
+ jsr a0@
+ .endm
+
+ .macro PICJUMP addr
+ PICLEA \addr,a0
+ jmp a0@
+ .endm
+
# else /* !__ID_SHARED_LIBRARY__ */
/* Versions for -msep-data */
@@ -183,6 +169,27 @@ Boston, MA 02110-1301, USA. */
movel \sym@GOT(a5), sp@-
.endm
+ .macro PICCALL addr
+#if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
+ lea \addr-.-8,a0
+ jsr pc@(a0)
+#else
+ bsr \addr
+#endif
+ .endm
+
+ .macro PICJUMP addr
+ /* ISA C has no bra.l instruction, and since this assembly file
+ gets assembled into multiple object files, we avoid the
+ bra instruction entirely. */
+#if defined (__mcoldfire__) && !defined (__mcfisab__)
+ lea \addr-.-8,a0
+ jmp pc@(a0)
+#else
+ bra \addr
+#endif
+ .endm
+
# endif
# else /* !__uClinux__ */
@@ -201,6 +208,27 @@ Boston, MA 02110-1301, USA. */
movel \sym@GOT(\areg), sp@-
.endm
+ .macro PICCALL addr
+#if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
+ lea \addr-.-8,a0
+ jsr pc@(a0)
+#else
+ bsr \addr
+#endif
+ .endm
+
+ .macro PICJUMP addr
+ /* ISA C has no bra.l instruction, and since this assembly file
+ gets assembled into multiple object files, we avoid the
+ bra instruction entirely. */
+#if defined (__mcoldfire__) && !defined (__mcfisab__)
+ lea \addr-.-8,a0
+ jmp pc@(a0)
+#else
+ bra \addr
+#endif
+ .endm
+
# endif
#endif /* __PIC__ */
@@ -648,6 +676,7 @@ ROUND_TO_MINUS = 3 | round result towards minus infinity
.globl SYM (__negdf2)
.globl SYM (__cmpdf2)
.globl SYM (__cmpdf2_internal)
+ .hidden SYM (__cmpdf2_internal)
.text
.even
@@ -2410,7 +2439,7 @@ SYM (__cmpdf2):
movl a6@(16),sp@-
movl a6@(12),sp@-
movl a6@(8),sp@-
- bsr SYM (__cmpdf2_internal)
+ PICCALL SYM (__cmpdf2_internal)
unlk a6
rts
@@ -2562,6 +2591,7 @@ ROUND_TO_MINUS = 3 | round result towards minus infinity
.globl SYM (__negsf2)
.globl SYM (__cmpsf2)
.globl SYM (__cmpsf2_internal)
+ .hidden SYM (__cmpsf2_internal)
| These are common routines to return and signal exceptions.
@@ -3816,7 +3846,7 @@ SYM (__cmpsf2):
pea 1
movl a6@(12),sp@-
movl a6@(8),sp@-
- bsr (__cmpsf2_internal)
+ PICCALL SYM (__cmpsf2_internal)
unlk a6
rts
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index c7b3c064b8f..b73b022cb7b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -11923,8 +11923,7 @@ mips_expand_builtin_bposge (enum mips_builtin_type builtin_type, rtx target)
static rtx
mips_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED,
- int ignore ATTRIBUTE_UNUSED)
+ enum machine_mode mode, int ignore)
{
tree fndecl;
unsigned int fcode, avail;
@@ -11940,7 +11939,7 @@ mips_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
{
error ("built-in function %qs not supported for MIPS16",
IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- return const0_rtx;
+ return ignore ? const0_rtx : CONST0_RTX (mode);
}
switch (d->builtin_type)
{
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 21b76c54475..b9226c5c61d 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -644,6 +644,18 @@
(define_mode_iterator MOVECC [SI (DI "TARGET_64BIT")
(CC "TARGET_HARD_FLOAT && !TARGET_LOONGSON_2EF")])
+;; 32-bit integer moves for which we provide move patterns.
+(define_mode_iterator IMOVE32
+ [SI
+ (V2HI "TARGET_DSP")
+ (V4QI "TARGET_DSP")
+ (V2HQ "TARGET_DSP")
+ (V2UHQ "TARGET_DSP")
+ (V2HA "TARGET_DSP")
+ (V2UHA "TARGET_DSP")
+ (V4QQ "TARGET_DSP")
+ (V4UQQ "TARGET_DSP")])
+
;; 64-bit modes for which we provide move patterns.
(define_mode_iterator MOVE64
[DI DF
@@ -3936,34 +3948,34 @@
;; different predicates, because register spilling and other parts of
;; the compiler, have memoized the insn number already.
-(define_expand "movsi"
- [(set (match_operand:SI 0 "")
- (match_operand:SI 1 ""))]
+(define_expand "mov<mode>"
+ [(set (match_operand:IMOVE32 0 "")
+ (match_operand:IMOVE32 1 ""))]
""
{
- if (mips_legitimize_move (SImode, operands[0], operands[1]))
+ if (mips_legitimize_move (<MODE>mode, operands[0], operands[1]))
DONE;
})
;; The difference between these two is whether or not ints are allowed
;; in FP registers (off by default, use -mdebugh to enable).
-(define_insn "*movsi_internal"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,e,d,m,*f,*f,*d,*m,*d,*z,*a,*d,*B*C*D,*B*C*D,*d,*m")
- (match_operand:SI 1 "move_operand" "d,U,T,m,dJ,*d*J,*m,*f,*f,*z,*d,*J*d,*a,*d,*m,*B*C*D,*B*C*D"))]
+(define_insn "*mov<mode>_internal"
+ [(set (match_operand:IMOVE32 0 "nonimmediate_operand" "=d,d,e,d,m,*f,*f,*d,*m,*d,*z,*a,*d,*B*C*D,*B*C*D,*d,*m")
+ (match_operand:IMOVE32 1 "move_operand" "d,U,T,m,dJ,*d*J,*m,*f,*f,*z,*d,*J*d,*a,*d,*m,*B*C*D,*B*C*D"))]
"!TARGET_MIPS16
- && (register_operand (operands[0], SImode)
- || reg_or_0_operand (operands[1], SImode))"
+ && (register_operand (operands[0], <MODE>mode)
+ || reg_or_0_operand (operands[1], <MODE>mode))"
{ return mips_output_move (operands[0], operands[1]); }
[(set_attr "move_type" "move,const,const,load,store,mtc,fpload,mfc,fpstore,mfc,mtc,mthilo,mfhilo,mtc,fpload,mfc,fpstore")
(set_attr "mode" "SI")])
-(define_insn "*movsi_mips16"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=d,y,d,d,d,d,d,d,m,*d")
- (match_operand:SI 1 "move_operand" "d,d,y,K,N,U,kf,m,d,*a"))]
+(define_insn "*mov<mode>_mips16"
+ [(set (match_operand:IMOVE32 0 "nonimmediate_operand" "=d,y,d,d,d,d,d,d,m,*d")
+ (match_operand:IMOVE32 1 "move_operand" "d,d,y,K,N,U,kf,m,d,*a"))]
"TARGET_MIPS16
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
+ && (register_operand (operands[0], <MODE>mode)
+ || register_operand (operands[1], <MODE>mode))"
{ return mips_output_move (operands[0], operands[1]); }
[(set_attr "move_type" "move,move,move,const,constN,const,loadpool,load,store,mfhilo")
(set_attr "mode" "SI")])
@@ -4109,10 +4121,11 @@
;; address expression, not shift.
(define_insn "*lwxs"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mem:SI (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 4))
- (match_operand:SI 2 "register_operand" "d"))))]
+ [(set (match_operand:IMOVE32 0 "register_operand" "=d")
+ (mem:IMOVE32
+ (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
+ (const_int 4))
+ (match_operand:SI 2 "register_operand" "d"))))]
"ISA_HAS_LWXS"
"lwxs\t%0,%1(%2)"
[(set_attr "type" "load")
diff --git a/gcc/config/spu/float_unsdidf.c b/gcc/config/spu/float_unsdidf.c
index 9b3094915ee..41a08b09db9 100644
--- a/gcc/config/spu/float_unsdidf.c
+++ b/gcc/config/spu/float_unsdidf.c
@@ -46,10 +46,10 @@ __float_unsdidf (qword DI)
t0 = si_clz (DI);
t1 = si_shl (DI, t0);
t2 = si_ceqi (t0, 32);
- t3 = si_sf (t0, *(qword *) __didf_scale);
+ t3 = si_sf (t0, *(const qword *) __didf_scale);
t4 = si_a (t1, t1);
t5 = si_andc (t3, t2);
- t6 = si_shufb (t5, t4, *(qword *) __didf_pat);
+ t6 = si_shufb (t5, t4, *(const qword *) __didf_pat);
t7 = si_shlqbii (t6, 4);
t8 = si_shlqbyi (t7, 8);
return si_dfa (t7, t8);
diff --git a/gcc/config/spu/float_unssidf.c b/gcc/config/spu/float_unssidf.c
index 63d475b7c9d..4bdb59822be 100644
--- a/gcc/config/spu/float_unssidf.c
+++ b/gcc/config/spu/float_unssidf.c
@@ -42,6 +42,6 @@ __float_unssidf (qword SI)
t4 = si_sf (t0, t1);
t5 = si_a (t2, t2);
t6 = si_andc (t4, t3);
- t7 = si_shufb (t6, t5, *(qword *)__sidf_pat);
+ t7 = si_shufb (t6, t5, *(const qword *) __sidf_pat);
return si_shlqbii (t7, 4);
}
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index 713ae40a682..343153d4a14 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -3,21 +3,21 @@
2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
-This file is part of GCC.
+ 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 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.
+ 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/>. */
+ 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"
@@ -91,7 +91,7 @@ xstormy16_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
case CONST:
case SYMBOL_REF:
case LABEL_REF:
- *total = COSTS_N_INSNS(2);
+ *total = COSTS_N_INSNS (2);
return true;
case MULT:
@@ -120,7 +120,7 @@ xstormy16_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
natively, so the appropriate pattern is emitted directly.
2. SImode EQ and NE. These are emitted as pairs of HImode
- compare-and-branches.
+ compare-and-branches.
3. SImode LT, GE, LTU and GEU. These are emitted as a sequence
of a SImode subtract followed by a branch (not a compare-and-branch),
@@ -134,8 +134,7 @@ xstormy16_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
sbc
blt
or
- bne
-*/
+ bne. */
/* Emit a branch of kind CODE to location LOC. */
@@ -147,7 +146,7 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
rtx condition_rtx, loc_ref, branch, cy_clobber;
rtvec vec;
enum machine_mode mode;
-
+
mode = GET_MODE (op0);
gcc_assert (mode == HImode || mode == SImode);
@@ -157,7 +156,7 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
int unsigned_p = (code == GTU || code == LEU);
int gt_p = (code == GT || code == GTU);
rtx lab = NULL_RTX;
-
+
if (gt_p)
lab = gen_label_rtx ();
xstormy16_emit_cbranch (unsigned_p ? LTU : LT, gt_p ? lab : loc);
@@ -168,28 +167,28 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
emit_label (lab);
return;
}
- else if (mode == SImode
+ else if (mode == SImode
&& (code == NE || code == EQ)
&& op1 != const0_rtx)
{
rtx lab = NULL_RTX;
int num_words = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
int i;
-
+
if (code == EQ)
lab = gen_label_rtx ();
-
+
for (i = 0; i < num_words - 1; i++)
{
- xstormy16_compare_op0 = simplify_gen_subreg (word_mode, op0, mode,
+ xstormy16_compare_op0 = simplify_gen_subreg (word_mode, op0, mode,
i * UNITS_PER_WORD);
- xstormy16_compare_op1 = simplify_gen_subreg (word_mode, op1, mode,
+ xstormy16_compare_op1 = simplify_gen_subreg (word_mode, op1, mode,
i * UNITS_PER_WORD);
xstormy16_emit_cbranch (NE, code == EQ ? lab : loc);
}
- xstormy16_compare_op0 = simplify_gen_subreg (word_mode, op0, mode,
+ xstormy16_compare_op0 = simplify_gen_subreg (word_mode, op0, mode,
i * UNITS_PER_WORD);
- xstormy16_compare_op1 = simplify_gen_subreg (word_mode, op1, mode,
+ xstormy16_compare_op1 = simplify_gen_subreg (word_mode, op1, mode,
i * UNITS_PER_WORD);
xstormy16_emit_cbranch (code, loc);
@@ -214,7 +213,7 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
gen_rtx_IF_THEN_ELSE (VOIDmode, condition_rtx,
loc_ref, pc_rtx));
- cy_clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
+ cy_clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, CARRY_REGNUM));
if (mode == HImode)
vec = gen_rtvec (2, branch, cy_clobber);
@@ -246,7 +245,7 @@ xstormy16_split_cbranch (enum machine_mode mode, rtx label, rtx comparison,
rtx op1 = XEXP (comparison, 1);
rtx seq, last_insn;
rtx compare;
-
+
start_sequence ();
xstormy16_expand_arith (mode, COMPARE, dest, op0, op1);
seq = get_insns ();
@@ -286,7 +285,7 @@ xstormy16_output_cbranch_hi (rtx op, const char *label, int reversed, rtx insn)
const char *templ;
const char *operands;
enum rtx_code code;
-
+
if (! op)
{
if (need_longbranch)
@@ -323,7 +322,7 @@ xstormy16_output_cbranch_hi (rtx op, const char *label, int reversed, rtx insn)
case LTU: ccode = "c"; break;
case GTU: ccode = "hi"; break;
case LEU: ccode = "ls"; break;
-
+
default:
gcc_unreachable ();
}
@@ -333,7 +332,7 @@ xstormy16_output_cbranch_hi (rtx op, const char *label, int reversed, rtx insn)
else
templ = "b%s %s,%s";
sprintf (string, templ, ccode, operands, label);
-
+
return string;
}
@@ -357,7 +356,7 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
const char *templ;
char prevop[16];
enum rtx_code code;
-
+
code = GET_CODE (op);
/* Work out which way this really branches. */
@@ -383,9 +382,9 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
case EQ: case NE:
{
int regnum;
-
+
gcc_assert (GET_CODE (XEXP (op, 0)) == REG);
-
+
regnum = REGNO (XEXP (op, 0));
sprintf (prevop, "or %s,%s", reg_names[regnum], reg_names[regnum+1]);
}
@@ -404,7 +403,7 @@ xstormy16_output_cbranch_si (rtx op, const char *label, int reversed, rtx insn)
else
templ = "%s | b%s %s";
sprintf (string, templ, prevop, ccode, label);
-
+
return string;
}
@@ -489,6 +488,7 @@ xstormy16_preferred_reload_class (rtx x, enum reg_class rclass)
/* Predicate for symbols and addresses that reflect special 8-bit
addressing. */
+
int
xstormy16_below100_symbol (rtx x,
enum machine_mode mode ATTRIBUTE_UNUSED)
@@ -514,6 +514,7 @@ xstormy16_below100_symbol (rtx x,
/* Likewise, but only for non-volatile MEMs, for patterns where the
MEM will get split into smaller sized accesses. */
+
int
xstormy16_splittable_below100_operand (rtx x, enum machine_mode mode)
{
@@ -524,6 +525,7 @@ xstormy16_splittable_below100_operand (rtx x, enum machine_mode mode)
/* Expand an 8-bit IOR. This either detects the one case we can
actually do, or uses a 16-bit IOR. */
+
void
xstormy16_expand_iorqi3 (rtx *operands)
{
@@ -564,7 +566,9 @@ xstormy16_expand_iorqi3 (rtx *operands)
emit_move_insn (operands[0], out);
}
-/* Likewise, for AND. */
+/* Expand an 8-bit AND. This either detects the one case we can
+ actually do, or uses a 16-bit AND. */
+
void
xstormy16_expand_andqi3 (rtx *operands)
{
@@ -630,20 +634,20 @@ xstormy16_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
if (GET_CODE (x) == CONST_INT)
return 0;
}
-
+
if ((GET_CODE (x) == PRE_MODIFY
&& GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)
|| GET_CODE (x) == POST_INC
|| GET_CODE (x) == PRE_DEC)
x = XEXP (x, 0);
-
+
if (GET_CODE (x) == REG && REGNO_OK_FOR_BASE_P (REGNO (x))
&& (! strict || REGNO (x) < FIRST_PSEUDO_REGISTER))
return 1;
if (xstormy16_below100_symbol (x, mode))
return 1;
-
+
return 0;
}
@@ -657,19 +661,20 @@ xstormy16_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
operand being addressed. Some machines have other mode-dependent addresses.
Many RISC machines have no mode-dependent addresses.
- You may assume that ADDR is a valid address for the machine.
-
+ You may assume that ADDR is a valid address for the machine.
+
On this chip, this is true if the address is valid with an offset
of 0 but not of 6, because in that case it cannot be used as an
address for DImode or DFmode, or if the address is a post-increment
or pre-decrement address. */
+
int
xstormy16_mode_dependent_address_p (rtx x)
{
if (LEGITIMATE_ADDRESS_CONST_INT_P (x, 0)
&& ! LEGITIMATE_ADDRESS_CONST_INT_P (x, 6))
return 1;
-
+
if (GET_CODE (x) == PLUS
&& LEGITIMATE_ADDRESS_INTEGER_P (XEXP (x, 1), 0)
&& ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (x, 1), 6))
@@ -679,7 +684,6 @@ xstormy16_mode_dependent_address_p (rtx x)
x = XEXP (x, 0);
/* Auto-increment addresses are now treated generically in recog.c. */
-
return 0;
}
@@ -690,6 +694,7 @@ xstormy16_mode_dependent_address_p (rtx x)
target machine, it should return 1 if VALUE corresponds to the operand type
represented by the constraint letter C. If C is not defined as an extra
constraint, the value returned should be 0 regardless of VALUE. */
+
int
xstormy16_extra_constraint_p (rtx x, int c)
{
@@ -750,10 +755,9 @@ short_memory_operand (rtx x, enum machine_mode mode)
by hardware. Emit insns to copy a value of mode MODE from SRC to
DEST.
- This function is only called when reload_completed.
- */
+ This function is only called when reload_completed. */
-void
+void
xstormy16_split_move (enum machine_mode mode, rtx dest, rtx src)
{
int num_words = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
@@ -764,7 +768,7 @@ xstormy16_split_move (enum machine_mode mode, rtx dest, rtx src)
int dest_volatile = 0;
rtx mem_operand;
rtx auto_inc_reg_rtx = NULL_RTX;
-
+
/* Check initial conditions. */
gcc_assert (reload_completed
&& mode != QImode && mode != HImode
@@ -779,14 +783,14 @@ xstormy16_split_move (enum machine_mode mode, rtx dest, rtx src)
/* The general idea is to copy by words, offsetting the source and
destination. Normally the least-significant word will be copied
- first, but for pre-dec operations it's better to copy the
+ first, but for pre-dec operations it's better to copy the
most-significant word first. Only one operand can be a pre-dec
- or post-inc operand.
+ or post-inc operand.
It's also possible that the copy overlaps so that the direction
must be reversed. */
direction = 1;
-
+
if (GET_CODE (dest) == MEM)
{
mem_operand = XEXP (dest, 0);
@@ -825,20 +829,20 @@ xstormy16_split_move (enum machine_mode mode, rtx dest, rtx src)
direction = -1;
}
else if (GET_CODE (mem_operand) == PRE_DEC
- || (GET_CODE (mem_operand) == PLUS
+ || (GET_CODE (mem_operand) == PLUS
&& GET_CODE (XEXP (mem_operand, 0)) == PRE_DEC))
direction = -1;
else if (GET_CODE (src) == MEM
&& reg_overlap_mentioned_p (dest, src))
{
int regno;
-
+
gcc_assert (GET_CODE (dest) == REG);
regno = REGNO (dest);
-
+
gcc_assert (refers_to_regno_p (regno, regno + num_words,
mem_operand, 0));
-
+
if (refers_to_regno_p (regno, regno + 1, mem_operand, 0))
direction = -1;
else if (refers_to_regno_p (regno + num_words - 1, regno + num_words,
@@ -866,15 +870,15 @@ xstormy16_split_move (enum machine_mode mode, rtx dest, rtx src)
if (dest_modifies)
w_dest = gen_rtx_MEM (word_mode, mem_operand);
else
- w_dest = simplify_gen_subreg (word_mode, dest, mode,
+ w_dest = simplify_gen_subreg (word_mode, dest, mode,
i * UNITS_PER_WORD);
if (dest_volatile)
MEM_VOLATILE_P (w_dest) = 1;
-
+
/* The simplify_subreg calls must always be able to simplify. */
gcc_assert (GET_CODE (w_src) != SUBREG
&& GET_CODE (w_dest) != SUBREG);
-
+
insn = emit_insn (gen_rtx_SET (VOIDmode, w_dest, w_src));
if (auto_inc_reg_rtx)
REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC,
@@ -886,7 +890,7 @@ xstormy16_split_move (enum machine_mode mode, rtx dest, rtx src)
/* Expander for the 'move' patterns. Emit insns to copy a value of
mode MODE from SRC to DEST. */
-void
+void
xstormy16_expand_move (enum machine_mode mode, rtx dest, rtx src)
{
if ((GET_CODE (dest) == MEM) && (GET_CODE (XEXP (dest, 0)) == PRE_MODIFY))
@@ -895,8 +899,8 @@ xstormy16_expand_move (enum machine_mode mode, rtx dest, rtx src)
rtx dest_reg = XEXP (pmv, 0);
rtx dest_mod = XEXP (pmv, 1);
rtx set = gen_rtx_SET (Pmode, dest_reg, dest_mod);
- rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
-
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, CARRY_REGNUM));
+
dest = gen_rtx_MEM (mode, dest_reg);
emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
}
@@ -906,12 +910,12 @@ xstormy16_expand_move (enum machine_mode mode, rtx dest, rtx src)
rtx src_reg = XEXP (pmv, 0);
rtx src_mod = XEXP (pmv, 1);
rtx set = gen_rtx_SET (Pmode, src_reg, src_mod);
- rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
-
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, CARRY_REGNUM));
+
src = gen_rtx_MEM (mode, src_reg);
emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
}
-
+
/* There are only limited immediate-to-memory move instructions. */
if (! reload_in_progress
&& ! reload_completed
@@ -930,10 +934,9 @@ xstormy16_expand_move (enum machine_mode mode, rtx dest, rtx src)
xstormy16_split_move (mode, dest, src);
return;
}
-
+
emit_insn (gen_rtx_SET (VOIDmode, dest, src));
}
-
/* Stack Layout:
@@ -977,7 +980,8 @@ struct xstormy16_stack_layout
&& (df_regs_ever_live_p (REGNUM) || ! current_function_is_leaf)))
/* Compute the stack layout. */
-struct xstormy16_stack_layout
+
+struct xstormy16_stack_layout
xstormy16_compute_stack_layout (void)
{
struct xstormy16_stack_layout layout;
@@ -985,56 +989,57 @@ xstormy16_compute_stack_layout (void)
const int ifun = xstormy16_interrupt_function_p ();
layout.locals_size = get_frame_size ();
-
+
layout.register_save_size = 0;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (REG_NEEDS_SAVE (regno, ifun))
layout.register_save_size += UNITS_PER_WORD;
-
+
if (cfun->stdarg)
layout.stdarg_save_size = NUM_ARGUMENT_REGISTERS * UNITS_PER_WORD;
else
layout.stdarg_save_size = 0;
-
- layout.frame_size = (layout.locals_size
- + layout.register_save_size
+
+ layout.frame_size = (layout.locals_size
+ + layout.register_save_size
+ layout.stdarg_save_size);
-
+
if (crtl->args.size <= 2048 && crtl->args.size != -1)
{
- if (layout.frame_size + INCOMING_FRAME_SP_OFFSET
+ if (layout.frame_size - INCOMING_FRAME_SP_OFFSET
+ crtl->args.size <= 2048)
- layout.fp_minus_ap = layout.frame_size + INCOMING_FRAME_SP_OFFSET;
+ layout.fp_minus_ap = layout.frame_size - INCOMING_FRAME_SP_OFFSET;
else
layout.fp_minus_ap = 2048 - crtl->args.size;
}
else
- layout.fp_minus_ap = (layout.stdarg_save_size
+ layout.fp_minus_ap = (layout.stdarg_save_size
+ layout.register_save_size
- + INCOMING_FRAME_SP_OFFSET);
- layout.sp_minus_fp = (layout.frame_size + INCOMING_FRAME_SP_OFFSET
+ - INCOMING_FRAME_SP_OFFSET);
+ layout.sp_minus_fp = (layout.frame_size - INCOMING_FRAME_SP_OFFSET
- layout.fp_minus_ap);
layout.first_local_minus_ap = layout.sp_minus_fp - layout.locals_size;
return layout;
}
/* Determine how all the special registers get eliminated. */
+
int
xstormy16_initial_elimination_offset (int from, int to)
{
struct xstormy16_stack_layout layout;
int result;
-
+
layout = xstormy16_compute_stack_layout ();
if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
result = layout.sp_minus_fp - layout.locals_size;
else if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- result = -layout.locals_size;
+ result = - layout.locals_size;
else if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
- result = -layout.fp_minus_ap;
+ result = - layout.fp_minus_ap;
else if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- result = -(layout.sp_minus_fp + layout.fp_minus_ap);
+ result = - (layout.sp_minus_fp + layout.fp_minus_ap);
else
gcc_unreachable ();
@@ -1045,9 +1050,9 @@ static rtx
emit_addhi3_postreload (rtx dest, rtx src0, rtx src1)
{
rtx set, clobber, insn;
-
+
set = gen_rtx_SET (VOIDmode, dest, gen_rtx_PLUS (HImode, src0, src1));
- clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
+ clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, CARRY_REGNUM));
insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
return insn;
}
@@ -1062,6 +1067,7 @@ emit_addhi3_postreload (rtx dest, rtx src0, rtx src1)
Also any insns generated here should have RTX_FRAME_RELATED_P(insn) = 1
so that the debug info generation code can handle them properly. */
+
void
xstormy16_expand_prologue (void)
{
@@ -1070,10 +1076,10 @@ xstormy16_expand_prologue (void)
rtx insn;
rtx mem_push_rtx;
const int ifun = xstormy16_interrupt_function_p ();
-
+
mem_push_rtx = gen_rtx_POST_INC (Pmode, stack_pointer_rtx);
mem_push_rtx = gen_rtx_MEM (HImode, mem_push_rtx);
-
+
layout = xstormy16_compute_stack_layout ();
if (layout.locals_size >= 32768)
@@ -1081,7 +1087,7 @@ xstormy16_expand_prologue (void)
/* Save the argument registers if necessary. */
if (layout.stdarg_save_size)
- for (regno = FIRST_ARGUMENT_REGISTER;
+ for (regno = FIRST_ARGUMENT_REGISTER;
regno < FIRST_ARGUMENT_REGISTER + NUM_ARGUMENT_REGISTERS;
regno++)
{
@@ -1092,7 +1098,7 @@ xstormy16_expand_prologue (void)
RTX_FRAME_RELATED_P (insn) = 1;
dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2));
-
+
XVECEXP (dwarf, 0, 0) = gen_rtx_SET (VOIDmode,
gen_rtx_MEM (Pmode, stack_pointer_rtx),
reg);
@@ -1105,7 +1111,7 @@ xstormy16_expand_prologue (void)
RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 0)) = 1;
RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 1)) = 1;
}
-
+
/* Push each of the registers to save. */
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (REG_NEEDS_SAVE (regno, ifun))
@@ -1117,7 +1123,7 @@ xstormy16_expand_prologue (void)
RTX_FRAME_RELATED_P (insn) = 1;
dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2));
-
+
XVECEXP (dwarf, 0, 0) = gen_rtx_SET (VOIDmode,
gen_rtx_MEM (Pmode, stack_pointer_rtx),
reg);
@@ -1134,7 +1140,10 @@ xstormy16_expand_prologue (void)
/* It's just possible that the SP here might be what we need for
the new FP... */
if (frame_pointer_needed && layout.sp_minus_fp == layout.locals_size)
- emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
+ {
+ insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
/* Allocate space for local variables. */
if (layout.locals_size)
@@ -1148,19 +1157,24 @@ xstormy16_expand_prologue (void)
if (frame_pointer_needed && layout.sp_minus_fp != layout.locals_size)
{
insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
+ RTX_FRAME_RELATED_P (insn) = 1;
if (layout.sp_minus_fp)
- emit_addhi3_postreload (hard_frame_pointer_rtx,
- hard_frame_pointer_rtx,
- GEN_INT (-layout.sp_minus_fp));
+ {
+ insn = emit_addhi3_postreload (hard_frame_pointer_rtx,
+ hard_frame_pointer_rtx,
+ GEN_INT (- layout.sp_minus_fp));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
}
}
/* Do we need an epilogue at all? */
+
int
direct_return (void)
{
- return (reload_completed
+ return (reload_completed
&& xstormy16_compute_stack_layout ().frame_size == 0);
}
@@ -1179,10 +1193,10 @@ xstormy16_expand_epilogue (void)
rtx mem_pop_rtx, insn;
int regno;
const int ifun = xstormy16_interrupt_function_p ();
-
+
mem_pop_rtx = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx);
mem_pop_rtx = gen_rtx_MEM (HImode, mem_pop_rtx);
-
+
layout = xstormy16_compute_stack_layout ();
/* Pop the stack for the locals. */
@@ -1191,36 +1205,19 @@ xstormy16_expand_epilogue (void)
if (frame_pointer_needed && layout.sp_minus_fp == layout.locals_size)
emit_move_insn (stack_pointer_rtx, hard_frame_pointer_rtx);
else
- {
- insn = emit_addhi3_postreload (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (- layout.locals_size));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
+ emit_addhi3_postreload (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (- layout.locals_size));
}
/* Restore any call-saved registers. */
for (regno = FIRST_PSEUDO_REGISTER - 1; regno >= 0; regno--)
if (REG_NEEDS_SAVE (regno, ifun))
- {
- rtx dwarf;
+ emit_move_insn (gen_rtx_REG (HImode, regno), mem_pop_rtx);
- insn = emit_move_insn (gen_rtx_REG (HImode, regno), mem_pop_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
- dwarf = gen_rtx_SET (Pmode, stack_pointer_rtx,
- plus_constant (stack_pointer_rtx,
- -GET_MODE_SIZE (Pmode)));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
- dwarf,
- REG_NOTES (insn));
- }
-
/* Pop the stack for the stdarg save area. */
if (layout.stdarg_save_size)
- {
- insn = emit_addhi3_postreload (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (- layout.stdarg_save_size));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
+ emit_addhi3_postreload (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (- layout.stdarg_save_size));
/* Return. */
if (ifun)
@@ -1245,7 +1242,6 @@ xstormy16_function_profiler (void)
{
sorry ("function_profiler support");
}
-
/* Return an updated summarizer variable CUM to advance past an
argument in the argument list. The values MODE, TYPE and NAMED
@@ -1258,6 +1254,7 @@ xstormy16_function_profiler (void)
stack space used for arguments without any special help. However,
it makes life easier for xstormy16_build_va_list if it does update
the word count. */
+
CUMULATIVE_ARGS
xstormy16_function_arg_advance (CUMULATIVE_ARGS cum, enum machine_mode mode,
tree type, int named ATTRIBUTE_UNUSED)
@@ -1268,9 +1265,9 @@ xstormy16_function_arg_advance (CUMULATIVE_ARGS cum, enum machine_mode mode,
if (cum < NUM_ARGUMENT_REGISTERS
&& cum + XSTORMY16_WORD_SIZE (type, mode) > NUM_ARGUMENT_REGISTERS)
cum = NUM_ARGUMENT_REGISTERS;
-
+
cum += XSTORMY16_WORD_SIZE (type, mode);
-
+
return cum;
}
@@ -1282,7 +1279,7 @@ xstormy16_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode,
return const0_rtx;
if (targetm.calls.must_pass_in_stack (mode, type)
|| cum + XSTORMY16_WORD_SIZE (type, mode) > NUM_ARGUMENT_REGISTERS)
- return 0;
+ return NULL_RTX;
return gen_rtx_REG (mode, cum + 2);
}
@@ -1291,7 +1288,7 @@ xstormy16_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode,
For this chip, va_list is a record containing a counter and a pointer.
The counter is of type 'int' and indicates how many bytes
have been used to date. The pointer indicates the stack position
- for arguments that have not been passed in registers.
+ for arguments that have not been passed in registers.
To keep the layout nice, the pointer is first in the structure. */
static tree
@@ -1304,7 +1301,7 @@ xstormy16_build_builtin_va_list (void)
f_1 = build_decl (FIELD_DECL, get_identifier ("base"),
ptr_type_node);
- f_2 = build_decl (FIELD_DECL, get_identifier ("count"),
+ f_2 = build_decl (FIELD_DECL, get_identifier ("count"),
unsigned_type_node);
DECL_FIELD_CONTEXT (f_1) = record;
@@ -1324,6 +1321,7 @@ xstormy16_build_builtin_va_list (void)
is stdarg.h instead of varargs.h. VALIST is the tree of the va_list
variable to initialize. NEXTARG is the machine independent notion of the
'next' argument after the variable arguments. */
+
static void
xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
{
@@ -1333,23 +1331,23 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
if (xstormy16_interrupt_function_p ())
error ("cannot use va_start in interrupt function");
-
+
f_base = TYPE_FIELDS (va_list_type_node);
f_count = TREE_CHAIN (f_base);
-
+
base = build3 (COMPONENT_REF, TREE_TYPE (f_base), valist, f_base, NULL_TREE);
count = build3 (COMPONENT_REF, TREE_TYPE (f_count), valist, f_count,
NULL_TREE);
t = make_tree (TREE_TYPE (base), virtual_incoming_args_rtx);
- u = build_int_cst (NULL_TREE, INCOMING_FRAME_SP_OFFSET);
+ u = build_int_cst (NULL_TREE, - INCOMING_FRAME_SP_OFFSET);
u = fold_convert (TREE_TYPE (count), u);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base), t, u);
t = build2 (MODIFY_EXPR, TREE_TYPE (base), base, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- t = build2 (MODIFY_EXPR, TREE_TYPE (count), count,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (count), count,
build_int_cst (NULL_TREE,
crtl->args.info * UNITS_PER_WORD));
TREE_SIDE_EFFECTS (t) = 1;
@@ -1359,7 +1357,7 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
/* Implement the stdarg/varargs va_arg macro. VALIST is the variable
of type va_list as a tree, TYPE is the type passed to va_arg.
Note: This algorithm is documented in stormy-abi. */
-
+
static tree
xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
gimple_seq *post_p ATTRIBUTE_UNUSED)
@@ -1373,7 +1371,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
f_base = TYPE_FIELDS (va_list_type_node);
f_count = TREE_CHAIN (f_base);
-
+
base = build3 (COMPONENT_REF, TREE_TYPE (f_base), valist, f_base, NULL_TREE);
count = build3 (COMPONENT_REF, TREE_TYPE (f_count), valist, f_count,
NULL_TREE);
@@ -1381,7 +1379,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
must_stack = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
size_tree = round_up (size_in_bytes (type), UNITS_PER_WORD);
gimplify_expr (&size_tree, pre_p, NULL, is_gimple_val, fb_rvalue);
-
+
size_of_reg_args = NUM_ARGUMENT_REGISTERS * UNITS_PER_WORD;
count_tmp = get_initialized_tmp_var (count, pre_p, NULL);
@@ -1411,7 +1409,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
t = build1 (LABEL_EXPR, void_type_node, lab_fromstack);
gimplify_and_add (t, pre_p);
}
-
+
/* Arguments larger than a word might need to skip over some
registers, since arguments are either passed entirely in
registers or entirely on the stack. */
@@ -1430,7 +1428,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
}
t = size_int (NUM_ARGUMENT_REGISTERS * UNITS_PER_WORD
- - INCOMING_FRAME_SP_OFFSET);
+ + INCOMING_FRAME_SP_OFFSET);
t = fold_convert (TREE_TYPE (count), t);
t = build2 (MINUS_EXPR, TREE_TYPE (count), count_tmp, t);
t = build2 (PLUS_EXPR, TREE_TYPE (count), t,
@@ -1446,7 +1444,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
t = fold_convert (TREE_TYPE (count), size_tree);
t = build2 (PLUS_EXPR, TREE_TYPE (count), count_tmp, t);
gimplify_assign (count, t, pre_p);
-
+
addr = fold_convert (build_pointer_type (type), addr);
return build_va_arg_indirect_ref (addr);
}
@@ -1455,6 +1453,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
the address of the trampoline; FNADDR is an RTX for the address of
the nested function; STATIC_CHAIN is an RTX for the static chain
value that should be passed to the function when it is called. */
+
void
xstormy16_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
{
@@ -1464,7 +1463,7 @@ xstormy16_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
rtx reg_addr_mem;
reg_addr_mem = gen_rtx_MEM (HImode, reg_addr);
-
+
emit_move_insn (reg_addr, addr);
emit_move_insn (temp, GEN_INT (0x3130 | STATIC_CHAIN_REGNUM));
emit_move_insn (reg_addr_mem, temp);
@@ -1527,11 +1526,11 @@ xstormy16_asm_output_mi_thunk (FILE *file,
tree function)
{
int regnum = FIRST_ARGUMENT_REGISTER;
-
+
/* There might be a hidden first argument for a returned structure. */
if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
regnum += 1;
-
+
fprintf (file, "\tadd %s,#0x%x\n", reg_names[regnum], (int) delta & 0xFFFF);
fputs ("\tjmpf ", file);
assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
@@ -1544,6 +1543,7 @@ xstormy16_asm_output_mi_thunk (FILE *file,
.bss_below100. We can't just use a section override (like we do
for .data_below100), because that makes them initialized rather
than uninitialized. */
+
void
xstormy16_asm_output_aligned_common (FILE *stream,
tree decl,
@@ -1554,7 +1554,7 @@ xstormy16_asm_output_aligned_common (FILE *stream,
{
rtx mem = DECL_RTL (decl);
rtx symbol;
-
+
if (mem != NULL_RTX
&& GET_CODE (mem) == MEM
&& GET_CODE (symbol = XEXP (mem, 0)) == SYMBOL_REF
@@ -1617,18 +1617,19 @@ xstormy16_encode_section_info (tree decl, rtx r, int first)
|| lookup_attribute ("BELOW100", DECL_ATTRIBUTES (decl))))
{
rtx symbol = XEXP (r, 0);
-
+
gcc_assert (GET_CODE (symbol) == SYMBOL_REF);
SYMBOL_REF_FLAGS (symbol) |= SYMBOL_FLAG_XSTORMY16_BELOW100;
}
}
-/* Output constructors and destructors. Just like
- default_named_section_asm_out_* but don't set the sections writable. */
#undef TARGET_ASM_CONSTRUCTOR
-#define TARGET_ASM_CONSTRUCTOR xstormy16_asm_out_constructor
+#define TARGET_ASM_CONSTRUCTOR xstormy16_asm_out_constructor
#undef TARGET_ASM_DESTRUCTOR
-#define TARGET_ASM_DESTRUCTOR xstormy16_asm_out_destructor
+#define TARGET_ASM_DESTRUCTOR xstormy16_asm_out_destructor
+
+/* Output constructors and destructors. Just like
+ default_named_section_asm_out_* but don't set the sections writable. */
static void
xstormy16_asm_out_destructor (rtx symbol, int priority)
@@ -1675,6 +1676,7 @@ xstormy16_asm_out_constructor (rtx symbol, int priority)
}
/* Print a memory address as an operand to reference that memory location. */
+
void
xstormy16_print_operand_address (FILE *file, rtx address)
{
@@ -1687,17 +1689,15 @@ xstormy16_print_operand_address (FILE *file, rtx address)
fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (address) & 0xFFFF);
return;
}
-
+
if (CONSTANT_P (address) || GET_CODE (address) == CODE_LABEL)
{
output_addr_const (file, address);
return;
}
-
- /* Otherwise, it's hopefully something of the form
- (plus:HI (pre_dec:HI (reg:HI ...)) (const_int ...))
- */
+ /* Otherwise, it's hopefully something of the form
+ (plus:HI (pre_dec:HI (reg:HI ...)) (const_int ...)). */
if (GET_CODE (address) == PLUS)
{
gcc_assert (GET_CODE (XEXP (address, 1)) == CONST_INT);
@@ -1711,7 +1711,7 @@ xstormy16_print_operand_address (FILE *file, rtx address)
post_inc = (GET_CODE (address) == POST_INC);
if (pre_dec || post_inc)
address = XEXP (address, 0);
-
+
gcc_assert (GET_CODE (address) == REG);
fputc ('(', file);
@@ -1726,6 +1726,7 @@ xstormy16_print_operand_address (FILE *file, rtx address)
}
/* Print an operand to an assembler instruction. */
+
void
xstormy16_print_operand (FILE *file, rtx x, int code)
{
@@ -1743,7 +1744,7 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
xx = INTVAL (x);
else
output_operand_lossage ("'B' operand is not constant");
-
+
/* GCC sign-extends masks with the MSB set, so we have to
detect all the cases that differ only in sign extension
beyond the bits we care about. Normally, the predicates
@@ -1770,7 +1771,7 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
if (l == -1)
output_operand_lossage ("'B' operand has multiple bits set");
-
+
fprintf (file, IMMEDIATE_PREFIX HOST_WIDE_INT_PRINT_DEC, l);
return;
}
@@ -1787,19 +1788,19 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
case 'o':
case 'O':
- /* Print the immediate operand less one, preceded by '#'.
+ /* Print the immediate operand less one, preceded by '#'.
For 'O', negate it first. */
{
HOST_WIDE_INT xx = 0;
-
+
if (GET_CODE (x) == CONST_INT)
xx = INTVAL (x);
else
output_operand_lossage ("'o' operand is not constant");
-
+
if (code == 'O')
xx = -xx;
-
+
fprintf (file, IMMEDIATE_PREFIX HOST_WIDE_INT_PRINT_DEC, xx - 1);
return;
}
@@ -1814,9 +1815,9 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
xx = INTVAL (x);
else
output_operand_lossage ("'B' operand is not constant");
-
+
l = 7 - xx;
-
+
fputs (IMMEDIATE_PREFIX, file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, l);
return;
@@ -1825,7 +1826,7 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
case 0:
/* Handled below. */
break;
-
+
default:
output_operand_lossage ("xstormy16_print_operand: unknown code");
return;
@@ -1851,7 +1852,6 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
return;
}
-
/* Expander for the `casesi' pattern.
INDEX is the index of the switch statement.
@@ -1860,10 +1860,9 @@ xstormy16_print_operand (FILE *file, rtx x, int code)
RANGE is the number of table entries.
TABLE is an ADDR_VEC that is the jump table.
DEFAULT_LABEL is the address to branch to if INDEX is outside the
- range LOWER_BOUND to LOWER_BOUND+RANGE-1.
-*/
+ range LOWER_BOUND to LOWER_BOUND + RANGE - 1. */
-void
+void
xstormy16_expand_casesi (rtx index, rtx lower_bound, rtx range,
rtx table, rtx default_label)
{
@@ -1873,7 +1872,7 @@ xstormy16_expand_casesi (rtx index, rtx lower_bound, rtx range,
/* This code uses 'br', so it can deal only with tables of size up to
8192 entries. */
if (range_i >= 8192)
- sorry ("switch statement of size %lu entries too large",
+ sorry ("switch statement of size %lu entries too large",
(unsigned long) range_i);
index = expand_binop (SImode, sub_optab, index, lower_bound, NULL_RTX, 0,
@@ -1895,9 +1894,9 @@ xstormy16_expand_casesi (rtx index, rtx lower_bound, rtx range,
void
xstormy16_output_addr_vec (FILE *file, rtx label ATTRIBUTE_UNUSED, rtx table)
-{
+{
int vlen, idx;
-
+
switch_to_section (current_function_section ());
vlen = XVECLEN (table, 0);
@@ -1908,7 +1907,6 @@ xstormy16_output_addr_vec (FILE *file, rtx label ATTRIBUTE_UNUSED, rtx table)
fputc ('\n', file);
}
}
-
/* Expander for the `call' patterns.
INDEX is the index of the switch statement.
@@ -1917,10 +1915,9 @@ xstormy16_output_addr_vec (FILE *file, rtx label ATTRIBUTE_UNUSED, rtx table)
RANGE is the number of table entries.
TABLE is an ADDR_VEC that is the jump table.
DEFAULT_LABEL is the address to branch to if INDEX is outside the
- range LOWER_BOUND to LOWER_BOUND+RANGE-1.
-*/
+ range LOWER_BOUND to LOWER_BOUND + RANGE - 1. */
-void
+void
xstormy16_expand_call (rtx retval, rtx dest, rtx counter)
{
rtx call, temp;
@@ -1932,7 +1929,7 @@ xstormy16_expand_call (rtx retval, rtx dest, rtx counter)
if (! CONSTANT_P (dest)
&& GET_CODE (dest) != REG)
dest = force_reg (Pmode, dest);
-
+
if (retval == NULL)
mode = VOIDmode;
else
@@ -1942,7 +1939,7 @@ xstormy16_expand_call (rtx retval, rtx dest, rtx counter)
counter);
if (retval)
call = gen_rtx_SET (VOIDmode, retval, call);
-
+
if (! CONSTANT_P (dest))
{
temp = gen_reg_rtx (HImode);
@@ -1950,8 +1947,8 @@ xstormy16_expand_call (rtx retval, rtx dest, rtx counter)
}
else
temp = const0_rtx;
-
- call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call,
+
+ call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call,
gen_rtx_USE (VOIDmode, temp)));
emit_call_insn (call);
}
@@ -1961,11 +1958,11 @@ xstormy16_expand_call (rtx retval, rtx dest, rtx counter)
/* Expander for arithmetic operations; emit insns to compute
(set DEST (CODE:MODE SRC0 SRC1))
-
+
When CODE is COMPARE, a branch template is generated
(this saves duplicating code in xstormy16_split_cbranch). */
-void
+void
xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
rtx dest, rtx src0, rtx src1)
{
@@ -1975,13 +1972,13 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
if (code == NEG)
emit_move_insn (src0, const0_rtx);
-
+
for (i = 0; i < num_words; i++)
{
rtx w_src0, w_src1, w_dest;
rtx insn;
-
- w_src0 = simplify_gen_subreg (word_mode, src0, mode,
+
+ w_src0 = simplify_gen_subreg (word_mode, src0, mode,
i * UNITS_PER_WORD);
w_src1 = simplify_gen_subreg (word_mode, src1, mode, i * UNITS_PER_WORD);
w_dest = simplify_gen_subreg (word_mode, dest, mode, i * UNITS_PER_WORD);
@@ -1992,7 +1989,7 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
if (firstloop
&& GET_CODE (w_src1) == CONST_INT && INTVAL (w_src1) == 0)
continue;
-
+
if (firstloop)
insn = gen_addchi4 (w_dest, w_src0, w_src1);
else
@@ -2005,12 +2002,12 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
if (code == COMPARE && i == num_words - 1)
{
rtx branch, sub, clobber, sub_1;
-
- sub_1 = gen_rtx_MINUS (HImode, w_src0,
- gen_rtx_ZERO_EXTEND (HImode, gen_rtx_REG (BImode, 16)));
+
+ sub_1 = gen_rtx_MINUS (HImode, w_src0,
+ gen_rtx_ZERO_EXTEND (HImode, gen_rtx_REG (BImode, CARRY_REGNUM)));
sub = gen_rtx_SET (VOIDmode, w_dest,
gen_rtx_MINUS (HImode, sub_1, w_src1));
- clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
+ clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, CARRY_REGNUM));
branch = gen_rtx_SET (VOIDmode, pc_rtx,
gen_rtx_IF_THEN_ELSE (VOIDmode,
gen_rtx_EQ (HImode,
@@ -2034,10 +2031,10 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
case IOR:
case XOR:
case AND:
- if (GET_CODE (w_src1) == CONST_INT
+ if (GET_CODE (w_src1) == CONST_INT
&& INTVAL (w_src1) == -(code == AND))
continue;
-
+
insn = gen_rtx_SET (VOIDmode, w_dest, gen_rtx_fmt_ee (code, mode,
w_src0, w_src1));
break;
@@ -2049,7 +2046,7 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
default:
gcc_unreachable ();
}
-
+
firstloop = 0;
emit (insn);
}
@@ -2061,12 +2058,12 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
}
/* The shift operations are split at output time for constant values;
- variable-width shifts get handed off to a library routine.
+ variable-width shifts get handed off to a library routine.
Generate an output string to do (set X (CODE:MODE X SIZE_R))
SIZE_R will be a CONST_INT, X will be a hard register. */
-const char *
+const char *
xstormy16_output_shift (enum machine_mode mode, enum rtx_code code,
rtx x, rtx size_r, rtx temp)
{
@@ -2103,7 +2100,7 @@ xstormy16_output_shift (enum machine_mode mode, enum rtx_code code,
}
return r;
}
-
+
/* For large shifts, there are easy special cases. */
if (size == 16)
{
@@ -2128,15 +2125,15 @@ xstormy16_output_shift (enum machine_mode mode, enum rtx_code code,
switch (code)
{
case ASHIFT:
- sprintf (r, "mov %s,%s | mov %s,#0 | shl %s,#%d",
+ sprintf (r, "mov %s,%s | mov %s,#0 | shl %s,#%d",
r1, r0, r0, r1, (int) size - 16);
break;
case ASHIFTRT:
- sprintf (r, "mov %s,%s | asr %s,#15 | asr %s,#%d",
+ sprintf (r, "mov %s,%s | asr %s,#15 | asr %s,#%d",
r0, r1, r1, r0, (int) size - 16);
break;
case LSHIFTRT:
- sprintf (r, "mov %s,%s | mov %s,#0 | shr %s,#%d",
+ sprintf (r, "mov %s,%s | mov %s,#0 | shr %s,#%d",
r0, r1, r1, r0, (int) size - 16);
break;
default:
@@ -2151,21 +2148,21 @@ xstormy16_output_shift (enum machine_mode mode, enum rtx_code code,
switch (code)
{
case ASHIFT:
- sprintf (r,
- "mov %s,%s | shl %s,#%d | shl %s,#%d | shr %s,#%d | or %s,%s",
- rt, r0, r0, (int) size, r1, (int) size, rt, (int) (16-size),
+ sprintf (r,
+ "mov %s,%s | shl %s,#%d | shl %s,#%d | shr %s,#%d | or %s,%s",
+ rt, r0, r0, (int) size, r1, (int) size, rt, (int) (16 - size),
r1, rt);
break;
case ASHIFTRT:
- sprintf (r,
- "mov %s,%s | asr %s,#%d | shr %s,#%d | shl %s,#%d | or %s,%s",
- rt, r1, r1, (int) size, r0, (int) size, rt, (int) (16-size),
+ sprintf (r,
+ "mov %s,%s | asr %s,#%d | shr %s,#%d | shl %s,#%d | or %s,%s",
+ rt, r1, r1, (int) size, r0, (int) size, rt, (int) (16 - size),
r0, rt);
break;
case LSHIFTRT:
- sprintf (r,
- "mov %s,%s | shr %s,#%d | shr %s,#%d | shl %s,#%d | or %s,%s",
- rt, r1, r1, (int) size, r0, (int) size, rt, (int) (16-size),
+ sprintf (r,
+ "mov %s,%s | shr %s,#%d | shr %s,#%d | shl %s,#%d | or %s,%s",
+ rt, r1, r1, (int) size, r0, (int) size, rt, (int) (16 - size),
r0, rt);
break;
default:
@@ -2177,11 +2174,12 @@ xstormy16_output_shift (enum machine_mode mode, enum rtx_code code,
/* Attribute handling. */
/* Return nonzero if the function is an interrupt function. */
+
int
xstormy16_interrupt_function_p (void)
{
tree attributes;
-
+
/* The dwarf2 mechanism asks for INCOMING_FRAME_SP_OFFSET before
any functions are declared, which is demonstrably wrong, but
it is worked around here. FIXME. */
@@ -2192,8 +2190,9 @@ xstormy16_interrupt_function_p (void)
return lookup_attribute ("interrupt", attributes) != NULL_TREE;
}
-#undef TARGET_ATTRIBUTE_TABLE
-#define TARGET_ATTRIBUTE_TABLE xstormy16_attribute_table
+#undef TARGET_ATTRIBUTE_TABLE
+#define TARGET_ATTRIBUTE_TABLE xstormy16_attribute_table
+
static tree xstormy16_handle_interrupt_attribute
(tree *, tree, tree, int, bool *);
static tree xstormy16_handle_below100_attribute
@@ -2201,7 +2200,7 @@ static tree xstormy16_handle_below100_attribute
static const struct attribute_spec xstormy16_attribute_table[] =
{
- /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+ /* name, min_len, max_len, decl_req, type_req, fn_type_req, handler. */
{ "interrupt", 0, 0, false, true, true, xstormy16_handle_interrupt_attribute },
{ "BELOW100", 0, 0, false, false, false, xstormy16_handle_below100_attribute },
{ "below100", 0, 0, false, false, false, xstormy16_handle_below100_attribute },
@@ -2210,6 +2209,7 @@ static const struct attribute_spec xstormy16_attribute_table[] =
/* Handle an "interrupt" attribute;
arguments as in struct attribute_spec.handler. */
+
static tree
xstormy16_handle_interrupt_attribute (tree *node, tree name,
tree args ATTRIBUTE_UNUSED,
@@ -2228,6 +2228,7 @@ xstormy16_handle_interrupt_attribute (tree *node, tree name,
/* Handle an "below" attribute;
arguments as in struct attribute_spec.handler. */
+
static tree
xstormy16_handle_below100_attribute (tree *node,
tree name ATTRIBUTE_UNUSED,
@@ -2252,26 +2253,29 @@ xstormy16_handle_below100_attribute (tree *node,
*no_add_attrs = true;
}
}
-
+
return NULL_TREE;
}
-#undef TARGET_INIT_BUILTINS
-#define TARGET_INIT_BUILTINS xstormy16_init_builtins
-#undef TARGET_EXPAND_BUILTIN
-#define TARGET_EXPAND_BUILTIN xstormy16_expand_builtin
-
-static struct {
- const char *name;
- int md_code;
- const char *arg_ops; /* 0..9, t for temp register, r for return value */
- const char *arg_types; /* s=short,l=long, upper case for unsigned */
-} s16builtins[] = {
+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS xstormy16_init_builtins
+#undef TARGET_EXPAND_BUILTIN
+#define TARGET_EXPAND_BUILTIN xstormy16_expand_builtin
+
+static struct
+{
+ const char * name;
+ int md_code;
+ const char * arg_ops; /* 0..9, t for temp register, r for return value. */
+ const char * arg_types; /* s=short,l=long, upper case for unsigned. */
+}
+ s16builtins[] =
+{
{ "__sdivlh", CODE_FOR_sdivlh, "rt01", "sls" },
{ "__smodlh", CODE_FOR_sdivlh, "tr01", "sls" },
{ "__udivlh", CODE_FOR_udivlh, "rt01", "SLS" },
{ "__umodlh", CODE_FOR_udivlh, "tr01", "SLS" },
- { 0, 0, 0, 0 }
+ { NULL, 0, NULL, NULL }
};
static void
@@ -2282,10 +2286,10 @@ xstormy16_init_builtins (void)
ret_type = void_type_node;
- for (i=0; s16builtins[i].name; i++)
+ for (i = 0; s16builtins[i].name; i++)
{
args = void_list_node;
- for (a=strlen (s16builtins[i].arg_types)-1; a>=0; a--)
+ for (a = strlen (s16builtins[i].arg_types) - 1; a >= 0; a--)
{
switch (s16builtins[i].arg_types[a])
{
@@ -2373,10 +2377,10 @@ xstormy16_expand_builtin (tree exp, rtx target,
return retval;
}
-
/* Look for combinations of insns that can be converted to BN or BP
opcodes. This is, unfortunately, too complex to do with MD
patterns. */
+
static void
combine_bnp (rtx insn)
{
@@ -2431,7 +2435,7 @@ combine_bnp (rtx insn)
&& rtx_equal_p (SET_DEST (PATTERN (and)), reg)
&& rtx_equal_p (XEXP (SET_SRC (PATTERN (and)), 0), qireg))
break;
-
+
if (and_code == CODE_FOR_movhi_internal
&& rtx_equal_p (SET_DEST (PATTERN (and)), reg))
{
@@ -2457,7 +2461,7 @@ combine_bnp (rtx insn)
&& rtx_equal_p (SET_DEST (PATTERN (and)), reg)
&& rtx_equal_p (XEXP (SET_SRC (PATTERN (and)), 0), reg))
break;
-
+
if (reg_mentioned_p (reg, and))
return;
@@ -2475,7 +2479,7 @@ combine_bnp (rtx insn)
(clobber (reg:BI carry))]
(set (reg:HI r7) (and:HI (reg:HI r7) (const_int 1)))
-
+
Attempt to detect this here. */
for (shift = prev_real_insn (and); shift; shift = prev_real_insn (shift))
{
@@ -2483,7 +2487,7 @@ combine_bnp (rtx insn)
&& rtx_equal_p (SET_DEST (XVECEXP (PATTERN (shift), 0, 0)), reg)
&& rtx_equal_p (XEXP (SET_SRC (XVECEXP (PATTERN (shift), 0, 0)), 0), reg))
break;
-
+
if (reg_mentioned_p (reg, shift)
|| (GET_CODE (shift) != NOTE
&& GET_CODE (shift) != INSN))
@@ -2601,7 +2605,6 @@ xstormy16_reorg (void)
combine_bnp (insn);
}
}
-
/* Worker function for TARGET_RETURN_IN_MEMORY. */
@@ -2612,45 +2615,45 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
return (size == -1 || size > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS);
}
-#undef TARGET_ASM_ALIGNED_HI_OP
+#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
-#undef TARGET_ASM_ALIGNED_SI_OP
+#undef TARGET_ASM_ALIGNED_SI_OP
#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
-#undef TARGET_ENCODE_SECTION_INFO
+#undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO xstormy16_encode_section_info
-/* select_section doesn't handle .bss_below100. */
+/* Select_section doesn't handle .bss_below100. */
#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS false
-#undef TARGET_ASM_OUTPUT_MI_THUNK
+#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK xstormy16_asm_output_mi_thunk
-#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
#define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
-#undef TARGET_RTX_COSTS
+#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS xstormy16_rtx_costs
-#undef TARGET_ADDRESS_COST
+#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST xstormy16_address_cost
-#undef TARGET_BUILD_BUILTIN_VA_LIST
+#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST xstormy16_build_builtin_va_list
-#undef TARGET_EXPAND_BUILTIN_VA_START
+#undef TARGET_EXPAND_BUILTIN_VA_START
#define TARGET_EXPAND_BUILTIN_VA_START xstormy16_expand_builtin_va_start
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
+#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR xstormy16_gimplify_va_arg_expr
-#undef TARGET_PROMOTE_FUNCTION_ARGS
+#undef TARGET_PROMOTE_FUNCTION_ARGS
#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
+#undef TARGET_PROMOTE_FUNCTION_RETURN
#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
-#undef TARGET_PROMOTE_PROTOTYPES
+#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
-#undef TARGET_RETURN_IN_MEMORY
+#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY xstormy16_return_in_memory
-#undef TARGET_MACHINE_DEPENDENT_REORG
+#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG xstormy16_reorg
struct gcc_target targetm = TARGET_INITIALIZER;
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index 973726ebae5..2a7338106ee 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -352,7 +352,7 @@ enum reg_class
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-4)))
-#define INCOMING_FRAME_SP_OFFSET (xstormy16_interrupt_function_p () ? 6 : 4)
+#define INCOMING_FRAME_SP_OFFSET (xstormy16_interrupt_function_p () ? -6 : -4)
/* Register That Address the Stack Frame. */
@@ -730,7 +730,8 @@ do { \
/* Assembler Commands for Exception Regions. */
-#define DWARF2_UNWIND_INFO 0
+#define DWARF2_UNWIND_INFO 0
+#define DWARF_CIE_DATA_ALIGNMENT 1
/* Don't use __builtin_setjmp for unwinding, since it's tricky to get
at the high 16 bits of an address. */
diff --git a/gcc/config/stormy16/stormy16.md b/gcc/config/stormy16/stormy16.md
index c16a8c3422c..285a82f5dca 100644
--- a/gcc/config/stormy16/stormy16.md
+++ b/gcc/config/stormy16/stormy16.md
@@ -49,8 +49,6 @@
(CARRY_REG 16)
]
)
-
-
;; ::::::::::::::::::::
;; ::
@@ -59,11 +57,11 @@
;; ::::::::::::::::::::
; Categorize branches for the conditional in the length attribute.
-(define_attr "branch_class" "notdirectbranch,br12,bcc12,bcc8p2,bcc8p4"
+(define_attr "branch_class" "notdirectbranch,br12,bcc12,bcc8p2,bcc8p4"
(const_string "notdirectbranch"))
; The length of an instruction, used for branch shortening.
-(define_attr "length" ""
+(define_attr "length" ""
(cond
[(eq_attr "branch_class" "br12")
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -2046))
@@ -135,7 +133,9 @@
[(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "")
(match_operand:QI 1 "general_operand" ""))]
""
- "{ xstormy16_expand_move (QImode, operands[0], operands[1]); DONE; }")
+ { xstormy16_expand_move (QImode, operands[0], operands[1]);
+ DONE;
+ })
(define_insn "movqi_internal"
[(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,e")
@@ -151,7 +151,7 @@
mov.b %0,%1
mov.b %0,%1
mov.b %0,%1"
- [(set_attr_alternative "length"
+ [(set_attr_alternative "length"
[(const_int 2)
(if_then_else (match_operand:QI 0 "short_memory_operand" "")
(const_int 2)
@@ -187,7 +187,9 @@
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "")
(match_operand:HI 1 "xs_hi_general_operand" ""))]
""
- "{ xstormy16_expand_move (HImode, operands[0], operands[1]); DONE; }")
+ { xstormy16_expand_move (HImode, operands[0], operands[1]);
+ DONE;
+ })
(define_insn "movhi_internal"
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,e")
@@ -203,7 +205,7 @@
mov.w %0,%1
mov.w %0,%1
mov.w %0,%1"
- [(set_attr_alternative "length"
+ [(set_attr_alternative "length"
[(const_int 2)
(if_then_else (match_operand:QI 0 "short_memory_operand" "")
(const_int 2)
@@ -223,7 +225,9 @@
[(set (match_operand:SI 0 "nonimmediate_operand" "")
(match_operand:SI 1 "general_operand" ""))]
""
- "{ xstormy16_expand_move (SImode, operands[0], operands[1]); DONE; }")
+ { xstormy16_expand_move (SImode, operands[0], operands[1]);
+ DONE;
+ })
(define_insn_and_split "*movsi_internal"
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,Q,r,m,e,&e,e,r,S")
@@ -232,8 +236,10 @@
"#"
"reload_completed"
[(pc)]
- "{ xstormy16_split_move (SImode, operands[0], operands[1]); DONE; }"
- [(set_attr_alternative "length"
+ { xstormy16_split_move (SImode, operands[0], operands[1]);
+ DONE;
+ }
+ [(set_attr_alternative "length"
[(const_int 4)
(const_int 4)
(const_int 4)
@@ -249,7 +255,6 @@
(const_int 4)
(const_int 8)
(const_int 8)])])
-
;; ::::::::::::::::::::
;; ::
@@ -274,7 +279,6 @@
(set_attr_alternative "length"
[(const_int 4)
(const_int 8)])])
-
;; ::::::::::::::::::::
;; ::
@@ -332,22 +336,6 @@
add %0,%2"
[(set_attr "length" "2,2,0,2,2,2,2,4")])
-;; ; Reload can generate addition operations. The SECONDARY_RELOAD_CLASS
-;; ; macro causes it to allocate the carry register; this pattern
-;; ; shows it how to place the register in RTL to make the addition work.
-;; (define_expand "reload_inhi"
-;; [(parallel [(set (match_operand:HI 0 "register_operand" "=r")
-;; (match_operand:HI 1 "xstormy16_carry_plus_operand" ""))
-;; (clobber (reg:BI CARRY_REG))])]
-;; ""
-;; "if (! rtx_equal_p (operands[0], XEXP (operands[1], 0)))
-;; {
-;; emit_insn (gen_rtx_SET (VOIDmode, operands[0], XEXP (operands[1], 0)));
-;; operands[1] = gen_rtx_PLUS (GET_MODE (operands[1]), operands[0],
-;; XEXP (operands[1], 1));
-;; }
-;; ")
-
(define_insn "addchi4"
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0")
@@ -368,8 +356,8 @@
(plus:HI (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0")
(zero_extend:HI (reg:BI CARRY_REG)))
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
- (set (reg:BI CARRY_REG)
- (truncate:BI (lshiftrt:SI (plus:SI (plus:SI
+ (set (reg:BI CARRY_REG)
+ (truncate:BI (lshiftrt:SI (plus:SI (plus:SI
(zero_extend:SI (match_dup 1))
(zero_extend:SI (reg:BI CARRY_REG)))
(zero_extend:SI (match_dup 2)))
@@ -407,7 +395,7 @@
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0")
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
- (set (reg:BI CARRY_REG)
+ (set (reg:BI CARRY_REG)
(truncate:BI (lshiftrt:SI (minus:SI (zero_extend:SI (match_dup 1))
(zero_extend:SI (match_dup 2)))
(const_int 16))))]
@@ -421,10 +409,10 @@
(define_insn "subchi5"
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(minus:HI (minus:HI (match_operand:HI 1 "register_operand" "0,0,0")
- (zero_extend:HI (reg:BI CARRY_REG)))
+ (zero_extend:HI (reg:BI CARRY_REG)))
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
- (set (reg:BI CARRY_REG)
- (truncate:BI (lshiftrt:SI (minus:SI (minus:SI
+ (set (reg:BI CARRY_REG)
+ (truncate:BI (lshiftrt:SI (minus:SI (minus:SI
(zero_extend:SI (match_dup 1))
(zero_extend:SI (reg:BI CARRY_REG)))
(zero_extend:SI (match_dup 2)))
@@ -516,7 +504,6 @@
(clobber (reg:BI CARRY_REG))])]
""
"")
-
;; ::::::::::::::::::::
;; ::
@@ -550,7 +537,6 @@
(clobber (reg:BI CARRY_REG))]
""
"shr %0,%2")
-
;; ::::::::::::::::::::
;; ::
@@ -580,13 +566,12 @@
[(set (match_dup 3)
(and:QI (match_dup 4)
(match_dup 5)))]
- "{ int s = ((INTVAL (operands[2]) & 0xff) == 0xff) ? 1 : 0;
- operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, s);
- operands[4] = simplify_gen_subreg (QImode, operands[1], HImode, s);
- operands[5] = simplify_gen_subreg (QImode, operands[2], HImode, s);
- operands[5] = GEN_INT (INTVAL (operands[5]) | ~(HOST_WIDE_INT)0xff);
- }
-")
+ { int s = ((INTVAL (operands[2]) & 0xff) == 0xff) ? 1 : 0;
+ operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, s);
+ operands[4] = simplify_gen_subreg (QImode, operands[1], HImode, s);
+ operands[5] = simplify_gen_subreg (QImode, operands[2], HImode, s);
+ operands[5] = GEN_INT (INTVAL (operands[5]) | ~ (HOST_WIDE_INT) 0xff);
+ })
;; Inclusive OR, 16-bit integers
(define_insn "iorhi3"
@@ -610,13 +595,12 @@
[(set (match_dup 3)
(ior:QI (match_dup 4)
(match_dup 5)))]
- "{ int s = ((INTVAL (operands[2]) & 0xff) == 0x00) ? 1 : 0;
- operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, s);
- operands[4] = simplify_gen_subreg (QImode, operands[1], HImode, s);
- operands[5] = simplify_gen_subreg (QImode, operands[2], HImode, s);
- operands[5] = GEN_INT (INTVAL (operands[5]) & 0xff);
- }
-")
+ { int s = ((INTVAL (operands[2]) & 0xff) == 0x00) ? 1 : 0;
+ operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, s);
+ operands[4] = simplify_gen_subreg (QImode, operands[1], HImode, s);
+ operands[5] = simplify_gen_subreg (QImode, operands[2], HImode, s);
+ operands[5] = GEN_INT (INTVAL (operands[5]) & 0xff);
+ })
;; Exclusive OR, 16-bit integers
(define_insn "xorhi3"
@@ -636,7 +620,6 @@
(not:HI (match_operand:HI 1 "register_operand" "0")))]
""
"not %0")
-
;; ::::::::::::::::::::
;; ::
@@ -654,8 +637,10 @@
"#"
"reload_completed"
[(pc)]
- "{ xstormy16_expand_arith (SImode, PLUS, operands[0], operands[1],
- operands[2]); DONE; } "
+ { xstormy16_expand_arith (SImode, PLUS, operands[0], operands[1],
+ operands[2]);
+ DONE;
+ }
[(set_attr "length" "4")])
;; Subtraction
@@ -668,8 +653,10 @@
"#"
"reload_completed"
[(pc)]
- "{ xstormy16_expand_arith (SImode, MINUS, operands[0], operands[1],
- operands[2]); DONE; } "
+ { xstormy16_expand_arith (SImode, MINUS, operands[0], operands[1],
+ operands[2]);
+ DONE;
+ }
[(set_attr "length" "4")])
(define_expand "negsi2"
@@ -677,7 +664,7 @@
(neg:SI (match_operand:SI 1 "register_operand" "")))
(clobber (reg:BI CARRY_REG))])]
""
- "{ operands[2] = gen_reg_rtx (HImode); }")
+ { operands[2] = gen_reg_rtx (HImode); })
(define_insn_and_split "*negsi2_internal"
[(set (match_operand:SI 0 "register_operand" "=&r")
@@ -687,8 +674,10 @@
"#"
"reload_completed"
[(pc)]
- "{ xstormy16_expand_arith (SImode, NEG, operands[0], operands[0],
- operands[1]); DONE; }")
+ { xstormy16_expand_arith (SImode, NEG, operands[0], operands[0],
+ operands[1]);
+ DONE;
+ })
;; ::::::::::::::::::::
;; ::
@@ -704,9 +693,10 @@
(clobber (reg:BI CARRY_REG))
(clobber (match_dup 3))])]
""
- " if (! const_int_operand (operands[2], SImode))
+ { if (! const_int_operand (operands[2], SImode))
FAIL;
- operands[3] = gen_reg_rtx (HImode); ")
+ operands[3] = gen_reg_rtx (HImode);
+ })
;; Arithmetic Shift Right
(define_expand "ashrsi3"
@@ -716,9 +706,10 @@
(clobber (reg:BI CARRY_REG))
(clobber (match_dup 3))])]
""
- " if (! const_int_operand (operands[2], SImode))
+ { if (! const_int_operand (operands[2], SImode))
FAIL;
- operands[3] = gen_reg_rtx (HImode); ")
+ operands[3] = gen_reg_rtx (HImode);
+ })
;; Logical Shift Right
(define_expand "lshrsi3"
@@ -728,9 +719,10 @@
(clobber (reg:BI CARRY_REG))
(clobber (match_dup 3))])]
""
- " if (! const_int_operand (operands[2], SImode))
+ { if (! const_int_operand (operands[2], SImode))
FAIL;
- operands[3] = gen_reg_rtx (HImode); ")
+ operands[3] = gen_reg_rtx (HImode);
+ })
(define_insn "*shiftsi"
[(set (match_operand:SI 0 "register_operand" "=r,r")
@@ -740,11 +732,10 @@
(clobber (reg:BI CARRY_REG))
(clobber (match_operand:HI 3 "" "=X,r"))]
""
- "* return xstormy16_output_shift (SImode, GET_CODE (operands[4]),
+ "* return xstormy16_output_shift (SImode, GET_CODE (operands[4]),
operands[0], operands[2], operands[3]);"
[(set_attr "length" "6,10")
(set_attr "psw_operand" "clobber,clobber")])
-
;; ::::::::::::::::::::
;; ::
@@ -761,12 +752,11 @@
(compare (match_operand:HI 0 "register_operand" "")
(match_operand:HI 1 "nonmemory_operand" "")))]
""
- "
-{
- xstormy16_compare_op0 = operands[0];
- xstormy16_compare_op1 = operands[1];
- DONE;
-}")
+ {
+ xstormy16_compare_op0 = operands[0];
+ xstormy16_compare_op1 = operands[1];
+ DONE;
+ })
; There are no real SImode comparisons, but some can be emulated
; by performing a SImode subtract and looking at the condition flags.
@@ -775,13 +765,11 @@
(compare (match_operand:SI 0 "register_operand" "")
(match_operand:SI 1 "nonmemory_operand" "")))]
""
- "
-{
- xstormy16_compare_op0 = operands[0];
- xstormy16_compare_op1 = operands[1];
- DONE;
-}")
-
+ {
+ xstormy16_compare_op0 = operands[0];
+ xstormy16_compare_op1 = operands[1];
+ DONE;
+ })
;; ::::::::::::::::::::
;; ::
@@ -792,58 +780,57 @@
(define_expand "beq"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (EQ, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (EQ, operands[0]); DONE; })
(define_expand "bne"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (NE, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (NE, operands[0]); DONE; })
(define_expand "bge"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (GE, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (GE, operands[0]); DONE; })
(define_expand "bgt"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (GT, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (GT, operands[0]); DONE; })
(define_expand "ble"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (LE, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (LE, operands[0]); DONE; })
(define_expand "blt"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (LT, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (LT, operands[0]); DONE; })
(define_expand "bgeu"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (GEU, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (GEU, operands[0]); DONE; })
(define_expand "bgtu"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (GTU, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (GTU, operands[0]); DONE; })
(define_expand "bleu"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (LEU, operands[0]); DONE; }")
+ { xstormy16_emit_cbranch (LEU, operands[0]); DONE; })
(define_expand "bltu"
[(use (match_operand 0 "" ""))]
""
- "{ xstormy16_emit_cbranch (LTU, operands[0]); DONE; }")
-
+ { xstormy16_emit_cbranch (LTU, operands[0]); DONE; })
(define_insn "cbranchhi"
- [(set (pc)
+ [(set (pc)
(if_then_else (match_operator:HI 1 "comparison_operator"
- [(match_operand:HI 2 "nonmemory_operand"
+ [(match_operand:HI 2 "nonmemory_operand"
"r,e,L")
(match_operand:HI 3 "nonmemory_operand"
"r,L,e")])
@@ -859,9 +846,9 @@
(set_attr "psw_operand" "0,0,1")])
(define_insn "cbranchhi_neg"
- [(set (pc)
+ [(set (pc)
(if_then_else (match_operator:HI 1 "comparison_operator"
- [(match_operand:HI 2 "nonmemory_operand"
+ [(match_operand:HI 2 "nonmemory_operand"
"r,e,L")
(match_operand:HI 3 "nonmemory_operand"
"r,L,e")])
@@ -879,7 +866,7 @@
(define_insn "*eqbranchsi"
[(set (pc)
(if_then_else (match_operator:SI 1 "equality_operator"
- [(match_operand:SI 2 "register_operand"
+ [(match_operand:SI 2 "register_operand"
"r")
(const_int 0)])
(label_ref (match_operand 0 "" ""))
@@ -896,9 +883,9 @@
(define_insn_and_split "*ineqbranchsi"
[(set (pc)
(if_then_else (match_operator:SI 1 "xstormy16_ineqsi_operator"
- [(match_operand:SI 2 "register_operand"
+ [(match_operand:SI 2 "register_operand"
"r")
- (match_operand:SI 3 "nonmemory_operand"
+ (match_operand:SI 3 "nonmemory_operand"
"ri")])
(label_ref (match_operand 0 "" ""))
(pc)))
@@ -908,7 +895,7 @@
"#"
"reload_completed"
[(pc)]
- "{ xstormy16_split_cbranch (SImode, operands[0], operands[1], operands[2]); DONE; }"
+ { xstormy16_split_cbranch (SImode, operands[0], operands[1], operands[2]); DONE; }
[(set_attr "length" "8")])
(define_insn "*ineqbranch_1"
@@ -930,7 +917,6 @@
}"
[(set_attr "branch_class" "bcc8p2,bcc8p2,bcc8p4")
(set_attr "psw_operand" "2,2,2")])
-
;; ::::::::::::::::::::
;; ::
@@ -1055,13 +1041,12 @@
}")
(define_insn "tablejump_pcrel"
- [(set (pc) (mem:HI (plus:HI (pc)
+ [(set (pc) (mem:HI (plus:HI (pc)
(match_operand:HI 0 "register_operand" "r"))))
(use (label_ref:SI (match_operand 1 "" "")))]
""
"br %0"
[(set_attr "psw_operand" "nop")])
-
;; ::::::::::::::::::::
;; ::
@@ -1079,11 +1064,10 @@
(define_expand "prologue"
[(const_int 1)]
""
- "
-{
- xstormy16_expand_prologue ();
- DONE;
-}")
+ {
+ xstormy16_expand_prologue ();
+ DONE;
+ })
;; Called after register allocation to add any instructions needed for
;; the epilogue. Using an epilogue insn is favored compared to putting
@@ -1095,12 +1079,10 @@
(define_expand "epilogue"
[(const_int 2)]
""
- "
-{
- xstormy16_expand_epilogue ();
- DONE;
-}")
-
+ {
+ xstormy16_expand_epilogue ();
+ DONE;
+ })
;; ::::::::::::::::::::
;; ::
@@ -1131,11 +1113,10 @@
(match_operand:QI 1 "xstormy16_below100_or_register" "")
(match_operand:QI 2 "nonmemory_operand" "")]
""
- "
-{
- xstormy16_expand_iorqi3 (operands);
- DONE;
-}")
+ {
+ xstormy16_expand_iorqi3 (operands);
+ DONE;
+ })
(define_insn "iorqi3_internal"
[(set (match_operand:QI 0 "xstormy16_below100_or_register" "=Wr")
@@ -1171,11 +1152,10 @@
(match_operand:QI 1 "xstormy16_below100_or_register" "")
(match_operand:QI 2 "nonmemory_operand" "")]
""
- "
-{
- xstormy16_expand_andqi3 (operands);
- DONE;
-}")
+ {
+ xstormy16_expand_andqi3 (operands);
+ DONE;
+ })
(define_insn "andqi3_internal"
[(set (match_operand:QI 0 "xstormy16_below100_or_register" "=Wr")
@@ -1225,7 +1205,7 @@
;; we have to code those separately.
(define_insn "*bclrx"
- [(set (pc)
+ [(set (pc)
(if_then_else (eq:HI (and:QI (match_operand:QI 1 "xstormy16_below100_operand" "W")
(match_operand:HI 2 "immediate_operand" "i"))
(const_int 0))
@@ -1238,7 +1218,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bclrx2"
- [(set (pc)
+ [(set (pc)
(if_then_else (zero_extract:HI
(xor:HI (subreg:HI
(match_operand:QI 1 "xstormy16_below100_operand" "W") 0)
@@ -1254,7 +1234,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bclrx3"
- [(set (pc)
+ [(set (pc)
(if_then_else (eq:HI (and:HI (zero_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W"))
(match_operand:HI 2 "immediate_operand" "i"))
(const_int 0))
@@ -1267,7 +1247,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bclr7"
- [(set (pc)
+ [(set (pc)
(if_then_else (xor:HI (lshiftrt:HI (subreg:HI
(match_operand:QI 1 "xstormy16_below100_operand" "W") 0)
(const_int 7))
@@ -1281,7 +1261,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bclr15"
- [(set (pc)
+ [(set (pc)
(if_then_else (ge:HI (sign_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W"))
(const_int 0))
(label_ref (match_operand 0 "" ""))
@@ -1293,7 +1273,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bsetx"
- [(set (pc)
+ [(set (pc)
(if_then_else (ne:HI (and:QI (match_operand:QI 1 "xstormy16_below100_operand" "W")
(match_operand:HI 2 "immediate_operand" "i"))
(const_int 0))
@@ -1306,7 +1286,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bsetx2"
- [(set (pc)
+ [(set (pc)
(if_then_else (zero_extract:HI (match_operand:QI 1 "xstormy16_below100_operand" "W")
(const_int 1)
(match_operand:HI 2 "immediate_operand" "i"))
@@ -1319,7 +1299,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bsetx3"
- [(set (pc)
+ [(set (pc)
(if_then_else (ne:HI (and:HI (zero_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W"))
(match_operand:HI 2 "immediate_operand" "i"))
(const_int 0))
@@ -1332,7 +1312,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bset7"
- [(set (pc)
+ [(set (pc)
(if_then_else (lshiftrt:HI (subreg:HI (match_operand:QI 1 "xstormy16_below100_operand" "W") 0)
(const_int 7))
(label_ref (match_operand 0 "" ""))
@@ -1344,7 +1324,7 @@
(set_attr "psw_operand" "nop")])
(define_insn "*bset15"
- [(set (pc)
+ [(set (pc)
(if_then_else (lt:HI (sign_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W"))
(const_int 0))
(label_ref (match_operand 0 "" ""))
diff --git a/gcc/configure b/gcc/configure
index 7a5d7056781..4645a9850d4 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -458,7 +458,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP ppllibs pplinc ltdllibs ltdlinc ltdl_ldflags gdbmlibs gdbminc gdbm_ldflags COMPILER_PROBE_OBJECT BASILYSMELT_OBJECT loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP ppllibs pplinc ltdllibs ltdlinc ltdl_ldflags gdbmlibs gdbminc gdbm_ldflags COMPILER_PROBE_OBJECT BASILYSMELT_OBJECT loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS'
ac_subst_files='language_hooks'
ac_pwd=`pwd`
@@ -21613,6 +21613,76 @@ else
echo "${ECHO_T}$gcc_cv_objdump" >&6
fi
+# Figure out what readelf we will be using.
+if test "${gcc_cv_readelf+set}" = set; then
+ :
+else
+
+if test -f $gcc_cv_binutils_srcdir/configure.in \
+ && test -f ../binutils/Makefile \
+ && test x$build = x$host; then
+ # Single tree build which includes binutils.
+ gcc_cv_readelf=../binutils/readelf$build_exeext
+elif test -x readelf$build_exeext; then
+ gcc_cv_readelf=./readelf$build_exeext
+else
+ # Extract the first word of "readelf", so it can be a program name with args.
+set dummy readelf; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_gcc_cv_readelf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $gcc_cv_readelf in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_gcc_cv_readelf="$gcc_cv_readelf" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_gcc_cv_readelf="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+gcc_cv_readelf=$ac_cv_path_gcc_cv_readelf
+
+if test -n "$gcc_cv_readelf"; then
+ echo "$as_me:$LINENO: result: $gcc_cv_readelf" >&5
+echo "${ECHO_T}$gcc_cv_readelf" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+fi
+
+
+echo "$as_me:$LINENO: checking what readelf to use" >&5
+echo $ECHO_N "checking what readelf to use... $ECHO_C" >&6
+if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
+ # Single tree build which includes binutils.
+ echo "$as_me:$LINENO: result: newly built readelf" >&5
+echo "${ECHO_T}newly built readelf" >&6
+elif test x$gcc_cv_readelf = x; then
+ echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6
+else
+ echo "$as_me:$LINENO: result: $gcc_cv_readelf" >&5
+echo "${ECHO_T}$gcc_cv_readelf" >&6
+fi
+
# Figure out what assembler alignment features are present.
echo "$as_me:$LINENO: checking assembler for .balign and .p2align" >&5
echo $ECHO_N "checking assembler for .balign and .p2align... $ECHO_C" >&6
@@ -22149,9 +22219,50 @@ fi
echo "$as_me:$LINENO: result: $gcc_cv_as_cfi_directive" >&5
echo "${ECHO_T}$gcc_cv_as_cfi_directive" >&6
+if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_readelf != x; then
+echo "$as_me:$LINENO: checking assembler for working cfi advance" >&5
+echo $ECHO_N "checking assembler for working cfi advance... $ECHO_C" >&6
+if test "${gcc_cv_as_cfi_advance_working+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_cfi_advance_working=no
+ if test x$gcc_cv_as != x; then
+ echo ' .text
+ .cfi_startproc
+ .cfi_adjust_cfa_offset 64
+ .skip 512, 0
+ .cfi_adjust_cfa_offset 128
+ .cfi_endproc' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+
+if $gcc_cv_readelf -wf conftest.o 2>/dev/null \
+ | grep 'DW_CFA_advance_loc[12]:[ ][ ]*512[ ]' >/dev/null; then
+ gcc_cv_as_cfi_advance_working=yes
+fi
+
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_cfi_advance_working" >&5
+echo "${ECHO_T}$gcc_cv_as_cfi_advance_working" >&6
+
+else
+ gcc_cv_as_cfi_advance_working=yes
+fi
cat >>confdefs.h <<_ACEOF
-#define HAVE_GAS_CFI_DIRECTIVE `if test $gcc_cv_as_cfi_directive = yes; then echo 1; else echo 0; fi`
+#define HAVE_GAS_CFI_DIRECTIVE `if test $gcc_cv_as_cfi_directive = yes \
+ && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`
_ACEOF
@@ -26089,6 +26200,7 @@ s,@ORIGINAL_LD_FOR_TARGET@,$ORIGINAL_LD_FOR_TARGET,;t t
s,@gcc_cv_nm@,$gcc_cv_nm,;t t
s,@ORIGINAL_NM_FOR_TARGET@,$ORIGINAL_NM_FOR_TARGET,;t t
s,@gcc_cv_objdump@,$gcc_cv_objdump,;t t
+s,@gcc_cv_readelf@,$gcc_cv_readelf,;t t
s,@libgcc_visibility@,$libgcc_visibility,;t t
s,@GGC@,$GGC,;t t
s,@zlibdir@,$zlibdir,;t t
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 39761c44e2d..2b8a36bf1f1 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2312,6 +2312,29 @@ else
AC_MSG_RESULT($gcc_cv_objdump)
fi
+# Figure out what readelf we will be using.
+AS_VAR_SET_IF(gcc_cv_readelf,, [
+if test -f $gcc_cv_binutils_srcdir/configure.in \
+ && test -f ../binutils/Makefile \
+ && test x$build = x$host; then
+ # Single tree build which includes binutils.
+ gcc_cv_readelf=../binutils/readelf$build_exeext
+elif test -x readelf$build_exeext; then
+ gcc_cv_readelf=./readelf$build_exeext
+else
+ AC_PATH_PROG(gcc_cv_readelf, readelf)
+fi])
+
+AC_MSG_CHECKING(what readelf to use)
+if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
+ # Single tree build which includes binutils.
+ AC_MSG_RESULT(newly built readelf)
+elif test x$gcc_cv_readelf = x; then
+ AC_MSG_RESULT(not found)
+else
+ AC_MSG_RESULT($gcc_cv_readelf)
+fi
+
# Figure out what assembler alignment features are present.
gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
[2,6,0],,
@@ -2541,8 +2564,29 @@ gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
gcc_cv_as_cfi_directive=yes
;;
esac])
+if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_readelf != x; then
+gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
+ ,,
+[ .text
+ .cfi_startproc
+ .cfi_adjust_cfa_offset 64
+ .skip 512, 0
+ .cfi_adjust_cfa_offset 128
+ .cfi_endproc],
+[
+changequote(,)dnl
+if $gcc_cv_readelf -wf conftest.o 2>/dev/null \
+ | grep 'DW_CFA_advance_loc[12]:[ ][ ]*512[ ]' >/dev/null; then
+ gcc_cv_as_cfi_advance_working=yes
+fi
+changequote([,])dnl
+])
+else
+ gcc_cv_as_cfi_advance_working=yes
+fi
AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
- [`if test $gcc_cv_as_cfi_directive = yes; then echo 1; else echo 0; fi`],
+ [`if test $gcc_cv_as_cfi_directive = yes \
+ && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`],
[Define 0/1 if your assembler supports CFI directives.])
gcc_GAS_CHECK_FEATURE([cfi personality directive],
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 438b3e0d309..0c6ecf81314 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,36 @@
+2008-12-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/38232
+ * init.c (build_value_init): Do initial zero-initialization
+ of a class with an implicitly-defined constructor using
+ build_zero_init rather than in build_value_init.
+ (build_value_init_1): Fold into build_value_init.
+
+ PR c++/38256
+ * parser.c (cp_parser_conversion_type_id): Diagnose
+ 'operator auto' here.
+ * decl.c (grokdeclarator): Not here.
+
+ PR c++/38380
+ * decl.c (grokdeclarator): Only set DECL_NONCONVERTING_P
+ on explicit constructors.
+ * pt.c (tsubst_copy_and_build) [CONSTRUCTOR]: Propagate
+ CONSTRUCTOR_IS_DIRECT_INIT.
+
+2008-12-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/35782, c++/37860
+ * call.c (build_user_type_conversion_1): Remember
+ list-initialization.
+ (convert_like_real): Likewise.
+ (build_over_call): Don't require the copy constructor
+ for copy-list-initialization.
+ * cp-tree.h (TARGET_EXPR_LIST_INIT_P): New macro.
+
+ PR c++/37234
+ * decl.c (cp_finish_decl): Handle =default and =delete for
+ templates, too.
+
2008-12-01 Jakub Jelinek <jakub@redhat.com>
PR c++/38257
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index bbd6a222d90..273599eddfc 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2871,6 +2871,10 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
build_identity_conv (TREE_TYPE (expr), expr));
conv->cand = cand;
+ /* Remember that this was a list-initialization. */
+ if (flags & LOOKUP_NO_NARROWING)
+ conv->check_narrowing = true;
+
/* Combine it with the second conversion sequence. */
cand->second_conv = merge_conversion_sequences (conv,
cand->second_conv);
@@ -4579,7 +4583,13 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
/* If this is a constructor or a function returning an aggr type,
we need to build up a TARGET_EXPR. */
if (DECL_CONSTRUCTOR_P (convfn))
- expr = build_cplus_new (totype, expr);
+ {
+ expr = build_cplus_new (totype, expr);
+
+ /* Remember that this was list-initialization. */
+ if (convs->check_narrowing)
+ TARGET_EXPR_LIST_INIT_P (expr) = true;
+ }
return expr;
}
@@ -5314,9 +5324,15 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
else
arg = cp_build_indirect_ref (arg, 0, complain);
+ if (TREE_CODE (arg) == TARGET_EXPR
+ && TARGET_EXPR_LIST_INIT_P (arg))
+ {
+ /* Copy-list-initialization doesn't require the copy constructor
+ to be defined. */
+ }
/* [class.copy]: the copy constructor is implicitly defined even if
the implementation elided its use. */
- if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)))
+ else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)))
{
mark_used (fn);
already_used = true;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index a03fe9bfae5..7f33ff139b4 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -89,6 +89,7 @@ framework extensions, you must include this file before toplev.h, not after.
DECL_INITIALIZED_P (in VAR_DECL)
TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
STMT_IS_FULL_EXPR_P (in _STMT)
+ TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR)
2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
ICS_THIS_FLAG (in _CONV)
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
@@ -3463,6 +3464,11 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define TARGET_EXPR_IMPLICIT_P(NODE) \
TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE))
+/* True if this TARGET_EXPR is the result of list-initialization of a
+ temporary. */
+#define TARGET_EXPR_LIST_INIT_P(NODE) \
+ TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE))
+
/* An enumeration of the kind of tags that C++ accepts. */
enum tag_types {
none_type = 0, /* Not a tag type. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 997c580038c..f2e12b3c772 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5504,6 +5504,25 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
}
}
+ if (init && TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ if (init == ridpointers[(int)RID_DELETE])
+ {
+ /* FIXME check this is 1st decl. */
+ DECL_DELETED_FN (decl) = 1;
+ DECL_DECLARED_INLINE_P (decl) = 1;
+ DECL_INITIAL (decl) = error_mark_node;
+ init = NULL_TREE;
+ }
+ else if (init == ridpointers[(int)RID_DEFAULT])
+ {
+ if (!defaultable_fn_p (decl))
+ error ("%qD cannot be defaulted", decl);
+ else
+ DECL_DEFAULTED_FN (decl) = 1;
+ }
+ }
+
if (processing_template_decl)
{
bool type_dependent_p;
@@ -5765,25 +5784,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
{
if (init)
{
- if (init == ridpointers[(int)RID_DELETE])
- {
- /* fixme check this is 1st decl */
- DECL_DELETED_FN (decl) = 1;
- DECL_DECLARED_INLINE_P (decl) = 1;
- DECL_INITIAL (decl) = error_mark_node;
- }
- else if (init == ridpointers[(int)RID_DEFAULT])
+ if (init == ridpointers[(int)RID_DEFAULT])
{
- if (!defaultable_fn_p (decl))
- error ("%qD cannot be defaulted", decl);
- else
- {
- /* An out-of-class default definition is defined at
- the point where it is explicitly defaulted. */
- DECL_DEFAULTED_FN (decl) = 1;
- if (DECL_INITIAL (decl) == error_mark_node)
- synthesize_method (decl);
- }
+ /* An out-of-class default definition is defined at
+ the point where it is explicitly defaulted. */
+ if (DECL_INITIAL (decl) == error_mark_node)
+ synthesize_method (decl);
}
else
error ("function %q#D is initialized like a variable", decl);
@@ -8252,12 +8258,7 @@ grokdeclarator (const cp_declarator *declarator,
{
if (type_uses_auto (type))
{
- if (sfk == sfk_conversion)
- {
- error ("invalid use of %<auto%> in conversion operator");
- return error_mark_node;
- }
- else if (!declarator->u.function.late_return_type)
+ if (!declarator->u.function.late_return_type)
{
error ("%qs function uses %<auto%> type specifier without"
" late return type", name);
@@ -9093,15 +9094,6 @@ grokdeclarator (const cp_declarator *declarator,
is called a converting constructor. */
if (explicitp == 2)
DECL_NONCONVERTING_P (decl) = 1;
- else if (DECL_CONSTRUCTOR_P (decl))
- {
- /* A constructor with no parms is not a conversion.
- Ignore any compiler-added parms. */
- tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (decl);
-
- if (arg_types == void_list_node)
- DECL_NONCONVERTING_P (decl) = 1;
- }
}
else if (TREE_CODE (type) == METHOD_TYPE)
{
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 39d87e3669f..d71b68badaa 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -267,12 +267,10 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
}
/* Return a suitable initializer for value-initializing an object of type
- TYPE, as described in [dcl.init]. If HAVE_CTOR is true, the initializer
- for an enclosing object is already calling the constructor for this
- object. */
+ TYPE, as described in [dcl.init]. */
-static tree
-build_value_init_1 (tree type, bool have_ctor)
+tree
+build_value_init (tree type)
{
/* [dcl.init]
@@ -300,17 +298,38 @@ build_value_init_1 (tree type, bool have_ctor)
if (CLASS_TYPE_P (type))
{
- if (type_has_user_provided_constructor (type) && !have_ctor)
+ if (type_has_user_provided_constructor (type))
return build_aggr_init_expr
(type,
build_special_member_call (NULL_TREE, complete_ctor_identifier,
NULL_TREE, type, LOOKUP_NORMAL,
tf_warning_or_error));
+ else if (TREE_CODE (type) != UNION_TYPE && TYPE_NEEDS_CONSTRUCTING (type))
+ {
+ /* This is a class that needs constructing, but doesn't have
+ a user-provided constructor. So we need to zero-initialize
+ the object and then call the implicitly defined ctor.
+ Implement this by sticking the zero-initialization inside
+ the TARGET_EXPR for the constructor call;
+ cp_gimplify_init_expr will know how to handle it. */
+ tree init = build_zero_init (type, NULL_TREE,
+ /*static_storage_p=*/false);
+ tree ctor = build_special_member_call
+ (NULL_TREE, complete_ctor_identifier,
+ NULL_TREE, type, LOOKUP_NORMAL, tf_warning_or_error);
+
+ ctor = build_cplus_new (type, ctor);
+ init = build2 (INIT_EXPR, void_type_node,
+ TARGET_EXPR_SLOT (ctor), init);
+ init = build2 (COMPOUND_EXPR, void_type_node, init,
+ TARGET_EXPR_INITIAL (ctor));
+ TARGET_EXPR_INITIAL (ctor) = init;
+ return ctor;
+ }
else if (TREE_CODE (type) != UNION_TYPE)
{
- tree field, init;
+ tree field;
VEC(constructor_elt,gc) *v = NULL;
- bool call_ctor = !have_ctor && TYPE_NEEDS_CONSTRUCTING (type);
/* Iterate over the fields, building initializations. */
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
@@ -335,35 +354,14 @@ build_value_init_1 (tree type, bool have_ctor)
corresponding to base classes as well. Thus, iterating
over TYPE_FIELDs will result in correct initialization of
all of the subobjects. */
- value = build_value_init_1 (ftype, have_ctor || call_ctor);
+ value = build_value_init (ftype);
if (value)
CONSTRUCTOR_APPEND_ELT(v, field, value);
}
/* Build a constructor to contain the zero- initializations. */
- init = build_constructor (type, v);
- if (call_ctor)
- {
- /* This is a class that needs constructing, but doesn't have
- a user-defined constructor. So we need to zero-initialize
- the object and then call the implicitly defined ctor.
- Implement this by sticking the zero-initialization inside
- the TARGET_EXPR for the constructor call;
- cp_gimplify_init_expr will know how to handle it. */
- tree ctor = build_special_member_call
- (NULL_TREE, complete_ctor_identifier,
- NULL_TREE, type, LOOKUP_NORMAL, tf_warning_or_error);
-
- ctor = build_cplus_new (type, ctor);
- init = build2 (INIT_EXPR, void_type_node,
- TARGET_EXPR_SLOT (ctor), init);
- init = build2 (COMPOUND_EXPR, void_type_node, init,
- TARGET_EXPR_INITIAL (ctor));
- TARGET_EXPR_INITIAL (ctor) = init;
- return ctor;
- }
- return init;
+ return build_constructor (type, v);
}
}
else if (TREE_CODE (type) == ARRAY_TYPE)
@@ -395,7 +393,7 @@ build_value_init_1 (tree type, bool have_ctor)
ce->index = build2 (RANGE_EXPR, sizetype, size_zero_node,
max_index);
- ce->value = build_value_init_1 (TREE_TYPE (type), have_ctor);
+ ce->value = build_value_init (TREE_TYPE (type));
/* The gimplifier can't deal with a RANGE_EXPR of TARGET_EXPRs. */
gcc_assert (TREE_CODE (ce->value) != TARGET_EXPR
@@ -409,15 +407,6 @@ build_value_init_1 (tree type, bool have_ctor)
return build_zero_init (type, NULL_TREE, /*static_storage_p=*/false);
}
-/* Return a suitable initializer for value-initializing an object of type
- TYPE, as described in [dcl.init]. */
-
-tree
-build_value_init (tree type)
-{
- return build_value_init_1 (type, false);
-}
-
/* Initialize MEMBER, a FIELD_DECL, with INIT, a TREE_LIST of
arguments. If TREE_LIST is void_type_node, an empty initializer
list was given; if NULL_TREE no initializer was given. */
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 275a7f3b4d3..45abd2414d5 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8966,6 +8966,16 @@ cp_parser_conversion_type_id (cp_parser* parser)
/*initialized=*/0, &attributes);
if (attributes)
cplus_decl_attributes (&type_specified, attributes, /*flags=*/0);
+
+ /* Don't give this error when parsing tentatively. This happens to
+ work because we always parse this definitively once. */
+ if (! cp_parser_uncommitted_to_tentative_parse_p (parser)
+ && type_uses_auto (type_specified))
+ {
+ error ("invalid use of %<auto%> in conversion operator");
+ return error_mark_node;
+ }
+
return type_specified;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8de27a6a913..db81942eb00 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11612,6 +11612,7 @@ tsubst_copy_and_build (tree t,
}
r = build_constructor (init_list_type_node, n);
+ CONSTRUCTOR_IS_DIRECT_INIT (r) = CONSTRUCTOR_IS_DIRECT_INIT (t);
if (TREE_HAS_CONSTRUCTOR (t))
return finish_compound_literal (type, r);
diff --git a/gcc/cse.c b/gcc/cse.c
index e6ff6308c2a..f52f0a9c93d 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3651,7 +3651,7 @@ equiv_constant (rtx x)
if (REG_P (SUBREG_REG (x))
&& (new_rtx = equiv_constant (SUBREG_REG (x))) != 0)
- return simplify_subreg (GET_MODE (x), SUBREG_REG (x),
+ return simplify_subreg (GET_MODE (x), new_rtx,
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
return 0;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index ced4e58b160..0738f384497 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3620,7 +3620,8 @@ add_insn_before (rtx insn, rtx before, basic_block bb)
/* Replace insn with an deleted instruction note. */
-void set_insn_deleted (rtx insn)
+void
+set_insn_deleted (rtx insn)
{
df_insn_delete (BLOCK_FOR_INSN (insn), INSN_UID (insn));
PUT_CODE (insn, NOTE);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8dddca19c08..41779e576bb 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -11457,7 +11457,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
case RSHIFT_EXPR:
/* Optimize -1 >> x for arithmetic right shifts. */
- if (integer_all_onesp (arg0) && !TYPE_UNSIGNED (type))
+ if (integer_all_onesp (arg0) && !TYPE_UNSIGNED (type)
+ && tree_expr_nonnegative_p (arg1))
return omit_one_operand (type, arg0, arg1);
/* ... fall through ... */
@@ -13363,9 +13364,11 @@ recursive_label:
expr = (tree) &buf;
}
else if (TREE_CODE_CLASS (code) == tcc_type
- && (TYPE_POINTER_TO (expr) || TYPE_REFERENCE_TO (expr)
+ && (TYPE_POINTER_TO (expr)
+ || TYPE_REFERENCE_TO (expr)
|| TYPE_CACHED_VALUES_P (expr)
- || TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr)))
+ || TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr)
+ || TYPE_NEXT_VARIANT (expr)))
{
/* Allow these fields to be modified. */
tree tmp;
@@ -13374,6 +13377,7 @@ recursive_label:
TYPE_CONTAINS_PLACEHOLDER_INTERNAL (tmp) = 0;
TYPE_POINTER_TO (tmp) = NULL;
TYPE_REFERENCE_TO (tmp) = NULL;
+ TYPE_NEXT_VARIANT (tmp) = NULL;
if (TYPE_CACHED_VALUES_P (tmp))
{
TYPE_CACHED_VALUES_P (tmp) = 0;
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 732b0f7a497..819113b3802 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,24 @@
+2008-12-02 Jakub Jelinek <jakub@redhat.com>
+ Diego Novillo <dnovillo@google.com>
+
+ * Make-lang.in (install-finclude-dir): Use mkinstalldirs
+ and don't remove the finclude directory beforehand.
+
+2008-12-02 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/36704
+ PR fortran/38290
+ * decl.c (match_result): Result may be a standard variable or a
+ procedure pointer.
+ * expr.c (gfc_check_pointer_assign): Additional checks for procedure
+ pointer assignments.
+ * primary.c (gfc_match_rvalue): Bugfix for procedure pointer
+ assignments.
+ * resolve.c (resolve_function): Check for attr.subroutine.
+ * symbol.c (check_conflict): Addtional checks for RESULT statements.
+ * trans-types.c (gfc_sym_type,gfc_get_function_type): Support procedure
+ pointers as function result.
+
2008-12-01 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/38252
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 0335a212144..62887329347 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -211,9 +211,7 @@ doc/gfc-internals.pdf: $(GFC_INTERNALS_TEXI)
# Create or recreate the gfortran private include file directory.
install-finclude-dir: installdirs
- -rm -rf $(DESTDIR)$(libsubdir)/finclude
- mkdir $(DESTDIR)$(libsubdir)/finclude
- -chmod a+rx $(DESTDIR)$(libsubdir)/finclude
+ $(mkinstalldirs) -m a+rx $(DESTDIR)$(libsubdir)/finclude
#
# Install hooks:
# f951 is installed elsewhere as part of $(COMPILERS).
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 14ccb6081a8..f6677fe42e0 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -3974,8 +3974,7 @@ match_result (gfc_symbol *function, gfc_symbol **result)
if (gfc_get_symbol (name, NULL, &r))
return MATCH_ERROR;
- if (gfc_add_flavor (&r->attr, FL_VARIABLE, r->name, NULL) == FAILURE
- || gfc_add_result (&r->attr, r->name, NULL) == FAILURE)
+ if (gfc_add_result (&r->attr, r->name, NULL) == FAILURE)
return MATCH_ERROR;
*result = r;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 4017cf91f33..b94e5ac0b87 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3112,9 +3112,30 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
if (rvalue->expr_type == EXPR_NULL && rvalue->ts.type == BT_UNKNOWN)
return SUCCESS;
- /* TODO checks on rvalue for a procedure pointer assignment. */
+ /* Checks on rvalue for procedure pointer assignments. */
if (lvalue->symtree->n.sym->attr.proc_pointer)
- return SUCCESS;
+ {
+ attr = gfc_expr_attr (rvalue);
+ if (!((rvalue->expr_type == EXPR_NULL)
+ || (rvalue->expr_type == EXPR_FUNCTION && attr.proc_pointer)
+ || (rvalue->expr_type == EXPR_VARIABLE
+ && attr.flavor == FL_PROCEDURE)))
+ {
+ gfc_error ("Invalid procedure pointer assignment at %L",
+ &rvalue->where);
+ return FAILURE;
+ }
+ if (rvalue->expr_type == EXPR_VARIABLE
+ && lvalue->symtree->n.sym->attr.if_source != IFSRC_UNKNOWN
+ && !gfc_compare_interfaces (lvalue->symtree->n.sym,
+ rvalue->symtree->n.sym, 0))
+ {
+ gfc_error ("Interfaces don't match "
+ "in procedure pointer assignment at %L", &rvalue->where);
+ return FAILURE;
+ }
+ return SUCCESS;
+ }
if (!gfc_compare_types (&lvalue->ts, &rvalue->ts))
{
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index f3e1b038918..032fa9024b4 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2509,11 +2509,10 @@ gfc_match_rvalue (gfc_expr **result)
if (gfc_matching_procptr_assignment)
{
gfc_gobble_whitespace ();
- if (sym->attr.function && gfc_peek_ascii_char () == '(')
+ if (gfc_peek_ascii_char () == '(')
/* Parse functions returning a procptr. */
goto function0;
- if (sym->attr.flavor == FL_UNKNOWN) sym->attr.flavor = FL_PROCEDURE;
if (gfc_is_intrinsic (sym, 0, gfc_current_locus)
|| gfc_is_intrinsic (sym, 1, gfc_current_locus))
sym->attr.intrinsic = 1;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6ccbe12859a..0b6fe4c13a9 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -2327,7 +2327,7 @@ resolve_function (gfc_expr *expr)
return FAILURE;
}
- if (sym && sym->attr.flavor == FL_VARIABLE)
+ if (sym && (sym->attr.flavor == FL_VARIABLE || sym->attr.subroutine))
{
gfc_error ("'%s' at %L is not a function", sym->name, &expr->where);
return FAILURE;
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 4e81b89e2b0..7c79ef80afa 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -618,7 +618,10 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
break;
case FL_VARIABLE:
+ break;
+
case FL_NAMELIST:
+ conf2 (result);
break;
case FL_PROCEDURE:
@@ -672,6 +675,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (function);
conf2 (subroutine);
conf2 (threadprivate);
+ conf2 (result);
if (attr->intent != INTENT_UNKNOWN)
{
@@ -698,6 +702,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf2 (threadprivate);
conf2 (value);
conf2 (is_bind_c);
+ conf2 (result);
break;
default:
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index de629646ec8..e1ff5aadde5 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1613,8 +1613,8 @@ gfc_sym_type (gfc_symbol * sym)
tree type;
int byref;
- /* Procedure Pointers inside COMMON blocks. */
- if (sym->attr.proc_pointer && sym->attr.in_common)
+ /* Procedure Pointers inside COMMON blocks or as function result. */
+ if (sym->attr.proc_pointer && (sym->attr.in_common || sym->attr.result))
{
/* Unset proc_pointer as gfc_get_function_type calls gfc_sym_type. */
sym->attr.proc_pointer = 0;
@@ -2143,6 +2143,9 @@ gfc_get_function_type (gfc_symbol * sym)
type = gfc_typenode_for_spec (&sym->ts);
sym->ts.kind = gfc_default_real_kind;
}
+ else if (sym->result && sym->result->attr.proc_pointer)
+ /* Procedure pointer return values. */
+ type = gfc_sym_type (sym->result);
else
type = gfc_sym_type (sym);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 20003137554..09f130ecc7e 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -656,13 +656,8 @@ static bool
is_gimple_mem_or_call_rhs (tree t)
{
/* If we're dealing with a renamable type, either source or dest must be
- a renamed variable. Also force a temporary if the type doesn't need
- to be stored in memory, since it's cheap and prevents erroneous
- tailcalls (PR 17526). */
- if (is_gimple_reg_type (TREE_TYPE (t))
- || (TYPE_MODE (TREE_TYPE (t)) != BLKmode
- && (TREE_CODE (t) != CALL_EXPR
- || ! aggregate_value_p (t, t))))
+ a renamed variable. */
+ if (is_gimple_reg_type (TREE_TYPE (t)))
return is_gimple_val (t);
else
return is_gimple_formal_tmp_or_call_rhs (t);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 440872d08d4..e54d5eabefe 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,94 @@
+2008-12-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/union-4.c: New test.
+
+2008-12-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * g++.old-deja/g++.eh/badalloc1.C: Add the missing "}".
+
+2008-12-03 Janis Johnson <janis187@us.ibm.com>
+
+ * g++.old-deja/g++.eh/badalloc1.C: Reinstate XFAIL for Darwin 3-7.
+
+2008-12-03 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * g++.old-deja/g++.eh/badalloc1.C: Omit XFAIL on obsolete Darwin.
+
+2008-12-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/38232
+ * g++.dg/init/value5.C: New test.
+
+ PR c++/38256
+ * g++.dg/cpp0x/auto11.C: New test.
+
+ PR c++/38380
+ * g++.dg/cpp0x/initlist10.C: New test.
+ * g++.old-deja/g++.eh/ctor1.C: Default ctor is a candidate too.
+ * g++.dg/tc1/dr152.C: Likewise.
+
+2008-12-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38360
+ * gcc.c-torture/compile/pr38360.c: New test.
+
+2008-12-03 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/36326
+ * gcc.dg/tree-ssa/pr36326.c: New testcase.
+
+2008-12-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/37716
+ * g++.dg/torture/pr37716.C: New test.
+
+2008-12-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/torture/pr37868.c: Skip on the SPARC.
+
+2008-12-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/compile/20081203-1.c: New test.
+
+2008-12-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/35782, c++/37860
+ * g++.dg/cpp0x/initlist9.C: New test.
+
+ PR c++/37234
+ * g++.dg/cpp0x/defaulted5.C: New test.
+
+2008-12-02 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * gcc.misc-tests/linkage.exp: Correct file type check for Darwin.
+
+2008-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38343
+ * gcc.c-torture/compile/pr38343-2.c: New test.
+
+2008-12-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/38359
+ * gcc.c-torture/compile/pr38359.c: New testcase.
+ * gcc.c-torture/execute/shiftopt-1.c: Adjust.
+
+2008-12-02 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/36704
+ PR fortran/38290
+ * gfortran.dg/entry_7.f90: Modified.
+ * gfortran.dg/proc_ptr_2.f90: Extended.
+ * gfortran.dg/proc_ptr_3.f90: Modified.
+ * gfortran.dg/proc_ptr_11.f90: New.
+ * gfortran.dg/proc_ptr_12.f90: New.
+ * gfortran.dg/result_1.f90: New.
+
+2008-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38343
+ * gcc.c-torture/compile/pr38343.c: New test.
+
2008-12-01 Janis Johnson <janis187@us.ibm.com>
* gcc.target/powerpc/pr18096-1.c: Adjust location of expected error.
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto11.C b/gcc/testsuite/g++.dg/cpp0x/auto11.C
new file mode 100644
index 00000000000..bd21daef0c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto11.C
@@ -0,0 +1,12 @@
+// PR c++/38256
+// { dg-options "-std=c++0x" }
+
+template<int> struct A
+{
+ template<typename T> operator T();
+};
+
+void foo()
+{
+ A<0>().operator auto(); // { dg-error "auto.*conversion" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted5.C b/gcc/testsuite/g++.dg/cpp0x/defaulted5.C
new file mode 100644
index 00000000000..b7bd16b4063
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted5.C
@@ -0,0 +1,20 @@
+// PR c++/37234
+// { dg-do link }
+// { dg-options "-std=c++0x" }
+
+template <typename T>
+class foo {
+ public:
+ foo() =default;
+ ~foo();
+};
+
+template <typename T>
+foo<T>::~foo() =default;
+
+int main() {
+
+ foo<int> fi;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist10.C b/gcc/testsuite/g++.dg/cpp0x/initlist10.C
new file mode 100644
index 00000000000..bf955f513e3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist10.C
@@ -0,0 +1,53 @@
+// PR c++/38380
+// { dg-options "-std=gnu++0x" }
+
+namespace std
+{
+ struct atomic_bool
+ {
+ bool _M_i;
+
+ atomic_bool() = default;
+ ~atomic_bool() = default;
+ atomic_bool(const atomic_bool&) = delete;
+ atomic_bool& operator=(const atomic_bool&) = delete;
+
+ explicit atomic_bool(bool __i) { _M_i = __i; }
+
+ operator bool() const volatile
+ { return true; }
+ };
+}
+
+namespace __gnu_test
+{
+ struct direct_list_initializable
+ {
+ template<typename _Ttype, typename _Tvalue>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ _Ttype __v1 = { }; // default ctor
+ _Ttype __v2 { __a }; // single-argument ctor
+ }
+
+ _Tvalue __a;
+ };
+
+ void (_Concept::*__x)() __attribute__((unused))
+ = &_Concept::__constraint;
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::direct_list_initializable test;
+
+ test.operator()<std::atomic_bool, bool>();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist9.C b/gcc/testsuite/g++.dg/cpp0x/initlist9.C
new file mode 100644
index 00000000000..2bc2d1782f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist9.C
@@ -0,0 +1,29 @@
+// PR c++/37860
+// { dg-options "-std=c++0x" }
+
+struct b
+{
+ bool t;
+
+ b() = default;
+ ~b() = default;
+ b& operator=(const b&) = delete;
+ b(const b&) = delete; // { dg-error "deleted" }
+
+ b(bool _t): t (_t) { }
+};
+
+int main()
+{
+ // copy list initialization
+ b tst1 = { false };
+
+ // copy initialization.
+ b tst2 = false; // { dg-error "used here" }
+
+ // direct list initialization
+ b tst3 { false };
+
+ // default initialization
+ b tst4;
+}
diff --git a/gcc/testsuite/g++.dg/init/value5.C b/gcc/testsuite/g++.dg/init/value5.C
new file mode 100644
index 00000000000..d705f87b68e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/value5.C
@@ -0,0 +1,17 @@
+// PR c++/38232
+
+class base {
+ public:
+ base();
+ virtual ~base();
+
+ private:
+ int& int_ref; // initialized by base ctor, not visible here
+};
+
+class derived : public base {
+};
+
+base *make_derived() {
+ return new derived();
+}
diff --git a/gcc/testsuite/g++.dg/tc1/dr152.C b/gcc/testsuite/g++.dg/tc1/dr152.C
index a635213b3a7..cac7aacc0eb 100644
--- a/gcc/testsuite/g++.dg/tc1/dr152.C
+++ b/gcc/testsuite/g++.dg/tc1/dr152.C
@@ -4,7 +4,7 @@
namespace N1 {
struct X {
- X();
+ X(); // { dg-message "candidate" }
explicit X(const X&);
};
void f(X);
@@ -19,7 +19,7 @@ namespace N1 {
namespace N2 {
template <class T>
struct X {
- X();
+ X(); // { dg-message "candidate" }
explicit X(const X&);
};
diff --git a/gcc/testsuite/g++.dg/torture/pr37716.C b/gcc/testsuite/g++.dg/torture/pr37716.C
new file mode 100644
index 00000000000..13b98d68a40
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37716.C
@@ -0,0 +1,56 @@
+// PR tree-optimization/37716
+// { dg-do compile }
+
+struct A
+{
+ struct B
+ {
+ int a, b, c, d;
+ void *e[1];
+ };
+ B *d;
+ inline void **f1 (int i) const
+ {
+ return d->e + d->c + i;
+ }
+};
+
+template <typename T>
+struct C
+{
+ struct D
+ {
+ void *v;
+ inline T & f3 ()
+ {
+ return *reinterpret_cast <T *> (this);
+ }
+ };
+ union
+ {
+ A p;
+ A::B *d;
+ };
+ T & operator[](int i)
+ {
+ if (d->a != 1)
+ f2 ();
+ return reinterpret_cast <D *> (p.f1 (i))->f3 ();
+ }
+ void f2 ();
+ void f3 (int i, const T & t);
+};
+
+class E
+{
+ int e, f;
+};
+
+C <E> c;
+
+void
+foo (int x)
+{
+ E e = c[x];
+ c.f3 (x, e);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
index b2e7f62b9b3..28eb36c8985 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
@@ -2,7 +2,7 @@
// __cxa_allocate_exception's emergency buffer mutex will
// itself call malloc(), and will fail if there is no more
// memory available.
-// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[1-7]* } || vxworks_rtp } } }
+// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[3-7]* } || vxworks_rtp } } }
// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
index ac2f24f60ce..1cd71c4d82a 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
@@ -1,7 +1,7 @@
// { dg-do assemble }
struct A
{
- A();
+ A(); // { dg-message "" } candidate
A(A&); // { dg-message "candidates" } referenced below
};
diff --git a/gcc/testsuite/gcc.c-torture/compile/20081203-1.c b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c
new file mode 100644
index 00000000000..713235ff50f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/38281 */
+/* Reporter: John Regehr <regehr@cs.utah.edu> */
+/* Testcase by Jakub Jelinek <jakub@redhat.com> */
+
+inline unsigned short
+foo (unsigned short x, unsigned short y)
+{
+ if (y == 0)
+ return x;
+ return x / y;
+}
+
+unsigned short a, b, c;
+
+extern int baz (int, int);
+
+void
+bar (void)
+{
+ int d = 0x3D75D162;
+ a = foo (b > d, baz (0, 1));
+ for (c = 0; c; c = 1)
+ ;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c
new file mode 100644
index 00000000000..8444cc78f06
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c
@@ -0,0 +1,12 @@
+/* PR middle-end/38343 */
+
+static struct S
+{
+ char f[6];
+} s[] = { {"01000"} };
+
+char *
+foo (void)
+{
+ return __builtin_stpcpy (s[0].f, "S0022");
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343.c b/gcc/testsuite/gcc.c-torture/compile/pr38343.c
new file mode 100644
index 00000000000..589ba33a255
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr38343.c
@@ -0,0 +1,12 @@
+/* PR middle-end/38343 */
+
+static struct A
+{
+ char f[6];
+} a[] = { {"01000"} };
+
+void
+foo (void)
+{
+ __builtin_stpcpy (a[0].f, "S0022");
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38359.c b/gcc/testsuite/gcc.c-torture/compile/pr38359.c
new file mode 100644
index 00000000000..cb77b71dd27
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr38359.c
@@ -0,0 +1,17 @@
+unsigned _ov_64_seek_lap (_Bool x1, _Bool x2, _Bool x3)
+{
+ unsigned ltmp_3978_7__PHI_TEMPORARY;
+ signed ltmp_4011_7;
+
+ if (!x1 || !x2)
+ while (1) ;
+
+ if (x3)
+ ltmp_3978_7__PHI_TEMPORARY = 0xffffff7e;
+ else
+ ltmp_3978_7__PHI_TEMPORARY = 1;
+
+ ltmp_4011_7 = -1;
+ return ltmp_4011_7 >> ltmp_3978_7__PHI_TEMPORARY;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38360.c b/gcc/testsuite/gcc.c-torture/compile/pr38360.c
new file mode 100644
index 00000000000..463218d1156
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr38360.c
@@ -0,0 +1,9 @@
+/* PR middle-end/38360 */
+
+int
+main ()
+{
+ fputs ("");
+ fputs_unlocked ("");
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c b/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c
index fa9517a73db..8c855b88895 100644
--- a/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c
@@ -43,12 +43,6 @@ stest (int x)
if (0 >> x != 0)
link_error ();
-
- if (-1 >> x != -1)
- link_error ();
-
- if (~0 >> x != ~0)
- link_error ();
}
int
diff --git a/gcc/testsuite/gcc.dg/darwin-comm.c b/gcc/testsuite/gcc.dg/darwin-comm.c
index 74d50867c7f..8c8619c87a6 100644
--- a/gcc/testsuite/gcc.dg/darwin-comm.c
+++ b/gcc/testsuite/gcc.dg/darwin-comm.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target *-*-darwin9* } } */
+/* { dg-do compile { target *-*-darwin[912]* } } */
/* { dg-final { scan-assembler ".comm _foo,1,15" } } */
char foo __attribute__ ((aligned(32768)));
diff --git a/gcc/testsuite/gcc.dg/torture/pr37868.c b/gcc/testsuite/gcc.dg/torture/pr37868.c
index 85c2b5072ae..50fa903008f 100644
--- a/gcc/testsuite/gcc.dg/torture/pr37868.c
+++ b/gcc/testsuite/gcc.dg/torture/pr37868.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-fno-strict-aliasing" } */
+/* { dg-skip-if "unaligned access" { sparc*-*-* } "*" "" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr36326.c b/gcc/testsuite/gcc.dg/tree-ssa/pr36326.c
new file mode 100644
index 00000000000..0611f7d8499
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr36326.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-gimple" } */
+
+union X { int i; double x; };
+
+int foo (union X *p)
+{
+ union X x = *p;
+ return x.x;
+}
+
+/* { dg-final { scan-tree-dump-not "x.0" "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c b/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c
new file mode 100644
index 00000000000..79039066808
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-distribution" } */
+
+typedef long unsigned int size_t;
+typedef struct {
+ long dat[2];
+} gsl_complex_long_double;
+typedef struct {
+ size_t size;
+ size_t stride;
+ long *data;
+} gsl_vector_complex_long_double;
+
+void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v)
+{
+ long * const data = v->data;
+ const size_t n = v->size;
+ const size_t stride = v->stride;
+ const gsl_complex_long_double zero = { { 0,0} } ;
+ size_t i;
+ for (i = 0; i < n; i++)
+ *(gsl_complex_long_double *) (data + 2 * i * stride) = zero;
+}
+
diff --git a/gcc/testsuite/gcc.dg/union-4.c b/gcc/testsuite/gcc.dg/union-4.c
new file mode 100644
index 00000000000..df9f36da09b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/union-4.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-rtl-cse1" } */
+
+extern void abort(void);
+
+typedef unsigned int uint32;
+typedef unsigned long long uint64;
+
+typedef union {
+ uint32 i32;
+ uint64 i64;
+} u64;
+
+void foo(void)
+{
+ u64 data;
+ data.i64 = 1;
+ if (data.i32 != 1)
+ abort ();
+}
+
+/* { dg-final { scan-rtl-dump-not "abort" "cse1" { target i?86-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "cse1" } } */
diff --git a/gcc/testsuite/gcc.misc-tests/linkage.exp b/gcc/testsuite/gcc.misc-tests/linkage.exp
index dc051a0a2ea..85aadb3daf7 100644
--- a/gcc/testsuite/gcc.misc-tests/linkage.exp
+++ b/gcc/testsuite/gcc.misc-tests/linkage.exp
@@ -73,14 +73,21 @@ if { [isnative] && ![is_remote host] } then {
} elseif [ string match "*32-bit*" $file_string ] {
set native_cflags "-m32"
}
- } elseif [istarget "*-*-darwin*"] {
+ } elseif [istarget "powerpc*-*-darwin*"] {
set file_string [exec file "linkage-x.o"]
- if [ string match "*64-bit*" $file_string ] {
+ if [ string match "*ppc64" $file_string ] {
set native_cflags "-m64"
- } elseif [ string match "*32-bit*" $file_string ] {
+ } elseif [ string match "*ppc" $file_string ] {
set native_cflags "-m32"
}
- }
+ } elseif [istarget "*86*-*-darwin*"] {
+ set file_string [exec file "linkage-x.o"]
+ if [ string match "*x86_64" $file_string ] {
+ set native_cflags "-m64"
+ } elseif [ string match "*i386" $file_string ] {
+ set native_cflags "-m32"
+ }
+ }
if [file exists "linkage-y.o"] then {
file delete "linkage-y.o"
diff --git a/gcc/testsuite/gfortran.dg/entry_7.f90 b/gcc/testsuite/gfortran.dg/entry_7.f90
index fbe4b8e2af1..52940984551 100644
--- a/gcc/testsuite/gfortran.dg/entry_7.f90
+++ b/gcc/testsuite/gfortran.dg/entry_7.f90
@@ -9,7 +9,7 @@
MODULE TT
CONTAINS
FUNCTION K(I) RESULT(J)
- ENTRY J() ! { dg-error "conflicts with PROCEDURE attribute" }
+ ENTRY J() ! { dg-error "conflicts with RESULT attribute" }
END FUNCTION K
integer function foo ()
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90
new file mode 100644
index 00000000000..a5cdbb54890
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+!
+! PR 38290: Procedure pointer assignment checking.
+!
+! Test case found at http://de.wikibooks.org/wiki/Fortran:_Fortran_2003:_Zeiger
+! Adapted by Janus Weil <janus@gcc.gnu.org>
+
+program bsp
+ implicit none
+
+ abstract interface
+ subroutine up()
+ end subroutine up
+ end interface
+
+ procedure( up ) , pointer :: pptr
+
+ pptr => add ! { dg-error "Interfaces don't match" }
+
+ print *, pptr() ! { dg-error "is not a function" }
+
+ contains
+
+ function add( a, b )
+ integer :: add
+ integer, intent( in ) :: a, b
+ add = a + b
+ end function add
+
+end program bsp
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_12.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_12.f90
new file mode 100644
index 00000000000..325703f499d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_12.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+!
+! PR 36704: Procedure pointer as function result
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+procedure(integer),pointer :: p
+p => foo()
+if (p(-1)/=1) call abort
+contains
+ function foo() result(bar)
+ procedure(integer),pointer :: bar
+ bar => iabs
+ end function
+end
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_2.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_2.f90
index d19b81d6e47..6224dc5980b 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_2.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_2.f90
@@ -6,8 +6,11 @@
PROCEDURE(REAL), POINTER :: ptr
PROCEDURE(REAL), SAVE :: noptr ! { dg-error "attribute conflicts with" }
+REAL :: x
-ptr => cos(4.0) ! { dg-error "Invalid character" }
+ptr => cos(4.0) ! { dg-error "Invalid procedure pointer assignment" }
+ptr => x ! { dg-error "Invalid procedure pointer assignment" }
+ptr => sin(x) ! { dg-error "Invalid procedure pointer assignment" }
ALLOCATE(ptr) ! { dg-error "must be ALLOCATABLE" }
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_3.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_3.f90
index 34d4f1625fb..5c4233d60e4 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_3.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_3.f90
@@ -6,14 +6,12 @@
real function e1(x)
real :: x
- print *,'e1!',x
e1 = x * 3.0
end function
subroutine e2(a,b)
real, intent(inout) :: a
real, intent(in) :: b
- print *,'e2!',a,b
a = a + b
end subroutine
@@ -29,7 +27,15 @@ interface
end subroutine sp
end interface
-external :: e1,e2
+external :: e1
+
+interface
+ subroutine e2(a,b)
+ real, intent(inout) :: a
+ real, intent(in) :: b
+ end subroutine e2
+end interface
+
real :: c = 1.2
fp => e1
diff --git a/gcc/testsuite/gfortran.dg/result_1.f90 b/gcc/testsuite/gfortran.dg/result_1.f90
new file mode 100644
index 00000000000..162ffaf5857
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/result_1.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR 36704: Procedure pointer as function result
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+function f() result(r)
+real, parameter :: r = 5.0 ! { dg-error "attribute conflicts" }
+end function
+
+function g() result(s)
+real :: a,b,c
+namelist /s/ a,b,c ! { dg-error "attribute conflicts" }
+end function
+
+function h() result(t)
+type t ! { dg-error "attribute conflicts" }
+end function
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 4f1a9fddb43..2715339219e 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -667,9 +667,9 @@ canonicalize_base_object_address (tree addr)
}
/* Analyzes the behavior of the memory reference DR in the innermost loop that
- contains it. */
+ contains it. Returns true if analysis succeed or false otherwise. */
-void
+bool
dr_analyze_innermost (struct data_reference *dr)
{
gimple stmt = DR_STMT (dr);
@@ -693,7 +693,7 @@ dr_analyze_innermost (struct data_reference *dr)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "failed: bit offset alignment.\n");
- return;
+ return false;
}
base = build_fold_addr_expr (base);
@@ -701,7 +701,7 @@ dr_analyze_innermost (struct data_reference *dr)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "failed: evolution of base is not affine.\n");
- return;
+ return false;
}
if (!poffset)
{
@@ -712,7 +712,7 @@ dr_analyze_innermost (struct data_reference *dr)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "failed: evolution of offset is not affine.\n");
- return;
+ return false;
}
init = ssize_int (pbitpos / BITS_PER_UNIT);
@@ -735,6 +735,8 @@ dr_analyze_innermost (struct data_reference *dr)
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "success.\n");
+
+ return true;
}
/* Determines the base object and the list of indices of memory reference
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index bd36d237e7e..3c2f1b28836 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -381,7 +381,7 @@ DEF_VEC_O (data_ref_loc);
DEF_VEC_ALLOC_O (data_ref_loc, heap);
bool get_references_in_stmt (gimple, VEC (data_ref_loc, heap) **);
-void dr_analyze_innermost (struct data_reference *);
+bool dr_analyze_innermost (struct data_reference *);
extern bool compute_data_dependences_for_loop (struct loop *, bool,
VEC (data_reference_p, heap) **,
VEC (ddr_p, heap) **);
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index bd6a9322500..062ab48ee7e 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -216,13 +216,30 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
return true;
}
+/* Build size argument. */
+
+static inline tree
+build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list)
+{
+ tree nb_bytes;
+ gimple_seq stmts = NULL;
+
+ nb_bytes = fold_build2 (MULT_EXPR, TREE_TYPE (nb_iter),
+ nb_iter, TYPE_SIZE_UNIT (TREE_TYPE (op)));
+ nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL);
+ gimple_seq_add_seq (stmt_list, stmts);
+
+ return nb_bytes;
+}
+
/* Generate a call to memset. Return true when the operation succeeded. */
static bool
generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
gimple_stmt_iterator bsi)
{
- tree t, nb_bytes, addr_base;
+ tree t, addr_base;
+ tree nb_bytes = NULL;
bool res = false;
gimple_seq stmts = NULL, stmt_list = NULL;
gimple fn_call;
@@ -231,14 +248,10 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
ssa_op_iter iter;
struct data_reference *dr = XCNEW (struct data_reference);
- nb_bytes = fold_build2 (MULT_EXPR, TREE_TYPE (nb_iter),
- nb_iter, TYPE_SIZE_UNIT (TREE_TYPE (op0)));
- nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL);
- gimple_seq_add_seq (&stmt_list, stmts);
-
DR_STMT (dr) = stmt;
DR_REF (dr) = op0;
- dr_analyze_innermost (dr);
+ if (!dr_analyze_innermost (dr))
+ goto end;
/* Test for a positive stride, iterating over every element. */
if (integer_zerop (fold_build2 (MINUS_EXPR, integer_type_node, DR_STEP (dr),
@@ -253,6 +266,7 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
TYPE_SIZE_UNIT (TREE_TYPE (op0)),
DR_STEP (dr))))
{
+ nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
addr_base = size_binop (PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr));
addr_base = fold_build2 (MINUS_EXPR, sizetype, addr_base, nb_bytes);
addr_base = force_gimple_operand (addr_base, &stmts, true, NULL);
@@ -272,6 +286,8 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
fntype = TREE_TYPE (fndecl);
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
+ if (!nb_bytes)
+ nb_bytes = build_size_arg (nb_iter, op0, &stmt_list);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index b6ccfd79cc8..54e0b7fe160 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1026,9 +1026,6 @@ valid_initializer_p (struct data_reference *ref,
aff_tree diff, base, step;
double_int off;
- if (!DR_BASE_ADDRESS (ref))
- return false;
-
/* Both REF and ROOT must be accessing the same object. */
if (!operand_equal_p (DR_BASE_ADDRESS (ref), DR_BASE_ADDRESS (root), 0))
return false;
@@ -1115,7 +1112,8 @@ find_looparound_phi (struct loop *loop, dref ref, dref root)
memset (&init_dr, 0, sizeof (struct data_reference));
DR_REF (&init_dr) = init_ref;
DR_STMT (&init_dr) = phi;
- dr_analyze_innermost (&init_dr);
+ if (!dr_analyze_innermost (&init_dr))
+ return NULL;
if (!valid_initializer_p (&init_dr, ref->distance + 1, root->ref))
return NULL;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 60330b14bc5..3225d103854 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2158,9 +2158,10 @@ sra_build_assignment (tree dst, tree src)
if (scalar_bitfield_p (src))
{
tree var, shift, width;
- tree utype, stype, stmp, utmp, dtmp;
+ tree utype, stype;
bool unsignedp = (INTEGRAL_TYPE_P (TREE_TYPE (src))
? TYPE_UNSIGNED (TREE_TYPE (src)) : true);
+ struct gimplify_ctx gctx;
var = TREE_OPERAND (src, 0);
width = TREE_OPERAND (src, 1);
@@ -2191,28 +2192,15 @@ sra_build_assignment (tree dst, tree src)
else if (!TYPE_UNSIGNED (utype))
utype = unsigned_type_for (utype);
- stmp = make_rename_temp (stype, "SR");
-
/* Convert the base var of the BIT_FIELD_REF to the scalar type
we use for computation if we cannot use it directly. */
- if (!useless_type_conversion_p (stype, TREE_TYPE (var)))
- {
- if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
- stmt = gimple_build_assign (stmp, fold_convert (stype, var));
- else
- stmt = gimple_build_assign (stmp, fold_build1 (VIEW_CONVERT_EXPR,
- stype, var));
- gimple_seq_add_stmt (&seq, stmt);
- var = stmp;
- }
+ if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
+ var = fold_convert (stype, var);
+ else
+ var = fold_build1 (VIEW_CONVERT_EXPR, stype, var);
if (!integer_zerop (shift))
- {
- stmt = gimple_build_assign (stmp, fold_build2 (RSHIFT_EXPR, stype,
- var, shift));
- gimple_seq_add_stmt (&seq, stmt);
- var = stmp;
- }
+ var = fold_build2 (RSHIFT_EXPR, stype, var, shift);
/* If we need a masking operation, produce one. */
if (TREE_INT_CST_LOW (width) == TYPE_PRECISION (stype))
@@ -2222,24 +2210,11 @@ sra_build_assignment (tree dst, tree src)
tree one = build_int_cst_wide (stype, 1, 0);
tree mask = int_const_binop (LSHIFT_EXPR, one, width, 0);
mask = int_const_binop (MINUS_EXPR, mask, one, 0);
-
- stmt = gimple_build_assign (stmp, fold_build2 (BIT_AND_EXPR, stype,
- var, mask));
- gimple_seq_add_stmt (&seq, stmt);
- var = stmp;
+ var = fold_build2 (BIT_AND_EXPR, stype, var, mask);
}
/* After shifting and masking, convert to the target type. */
- utmp = stmp;
- if (!useless_type_conversion_p (utype, stype))
- {
- utmp = make_rename_temp (utype, "SR");
-
- stmt = gimple_build_assign (utmp, fold_convert (utype, var));
- gimple_seq_add_stmt (&seq, stmt);
-
- var = utmp;
- }
+ var = fold_convert (utype, var);
/* Perform sign extension, if required.
??? This should never be necessary. */
@@ -2250,40 +2225,29 @@ sra_build_assignment (tree dst, tree src)
size_binop (MINUS_EXPR, width,
bitsize_int (1)), 0);
- stmt = gimple_build_assign (utmp, fold_build2 (BIT_XOR_EXPR, utype,
- var, signbit));
- gimple_seq_add_stmt (&seq, stmt);
-
- stmt = gimple_build_assign (utmp, fold_build2 (MINUS_EXPR, utype,
- utmp, signbit));
- gimple_seq_add_stmt (&seq, stmt);
-
- var = utmp;
+ var = fold_build2 (BIT_XOR_EXPR, utype, var, signbit);
+ var = fold_build2 (MINUS_EXPR, utype, var, signbit);
}
/* fold_build3 (BIT_FIELD_REF, ...) sometimes returns a cast. */
STRIP_NOPS (dst);
/* Finally, move and convert to the destination. */
- if (!useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (var)))
- {
- if (INTEGRAL_TYPE_P (TREE_TYPE (dst)))
- var = fold_convert (TREE_TYPE (dst), var);
- else
- var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var);
+ if (INTEGRAL_TYPE_P (TREE_TYPE (dst)))
+ var = fold_convert (TREE_TYPE (dst), var);
+ else
+ var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var);
- /* If the destination is not a register the conversion needs
- to be a separate statement. */
- if (!is_gimple_reg (dst))
- {
- dtmp = make_rename_temp (TREE_TYPE (dst), "SR");
- stmt = gimple_build_assign (dtmp, var);
- gimple_seq_add_stmt (&seq, stmt);
- var = dtmp;
- }
- }
- stmt = gimple_build_assign (dst, var);
- gimple_seq_add_stmt (&seq, stmt);
+ push_gimplify_context (&gctx);
+ gctx.into_ssa = true;
+ gctx.allow_rhs_cond_expr = true;
+
+ gimplify_assign (dst, var, &seq);
+
+ if (gimple_referenced_vars (cfun))
+ for (var = gctx.temps; var; var = TREE_CHAIN (var))
+ add_referenced_var (var);
+ pop_gimplify_context (NULL);
return seq;
}
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index a7d5be32e31..82933f81914 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2517,6 +2517,9 @@ ccp_fold_builtin (gimple stmt)
return NULL_TREE;
}
+ if (arg_idx >= nargs)
+ return NULL_TREE;
+
/* Try to use the dataflow information gathered by the CCP process. */
visited = BITMAP_ALLOC (NULL);
bitmap_clear (visited);
@@ -2532,7 +2535,7 @@ ccp_fold_builtin (gimple stmt)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_STRLEN:
- if (val[0])
+ if (val[0] && nargs == 1)
{
tree new_val =
fold_convert (TREE_TYPE (gimple_call_lhs (stmt)), val[0]);
@@ -2564,22 +2567,24 @@ ccp_fold_builtin (gimple stmt)
break;
case BUILT_IN_FPUTS:
- result = fold_builtin_fputs (gimple_call_arg (stmt, 0),
- gimple_call_arg (stmt, 1),
- ignore, false, val[0]);
+ if (nargs == 2)
+ result = fold_builtin_fputs (gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ ignore, false, val[0]);
break;
case BUILT_IN_FPUTS_UNLOCKED:
- result = fold_builtin_fputs (gimple_call_arg (stmt, 0),
- gimple_call_arg (stmt, 1),
- ignore, true, val[0]);
+ if (nargs == 2)
+ result = fold_builtin_fputs (gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1),
+ ignore, true, val[0]);
break;
case BUILT_IN_MEMCPY_CHK:
case BUILT_IN_MEMPCPY_CHK:
case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK:
- if (val[2] && is_gimple_val (val[2]))
+ if (val[2] && is_gimple_val (val[2]) && nargs == 4)
result = fold_builtin_memory_chk (callee,
gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1),
@@ -2591,7 +2596,7 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STPCPY_CHK:
- if (val[1] && is_gimple_val (val[1]))
+ if (val[1] && is_gimple_val (val[1]) && nargs == 3)
result = fold_builtin_stxcpy_chk (callee,
gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1),
@@ -2601,7 +2606,7 @@ ccp_fold_builtin (gimple stmt)
break;
case BUILT_IN_STRNCPY_CHK:
- if (val[2] && is_gimple_val (val[2]))
+ if (val[2] && is_gimple_val (val[2]) && nargs == 4)
result = fold_builtin_strncpy_chk (gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1),
gimple_call_arg (stmt, 2),
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index b19879f7909..bfd7146d490 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -613,19 +613,27 @@ forward_propagate_addr_into_variable_array_index (tree offset,
tree index;
gimple offset_def, use_stmt = gsi_stmt (*use_stmt_gsi);
- /* Try to find an expression for a proper index. This is either
- a multiplication expression by the element size or just the
- ssa name we came along in case the element size is one. */
+ /* Get the offset's defining statement. */
+ offset_def = SSA_NAME_DEF_STMT (offset);
+
+ /* Try to find an expression for a proper index. This is either a
+ multiplication expression by the element size or just the ssa name we came
+ along in case the element size is one. In that case, however, we do not
+ allow multiplications because they can be computing index to a higher
+ level dimension (PR 37861). */
if (integer_onep (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (def_rhs)))))
- index = offset;
- else
{
- /* Get the offset's defining statement. */
- offset_def = SSA_NAME_DEF_STMT (offset);
+ if (is_gimple_assign (offset_def)
+ && gimple_assign_rhs_code (offset_def) == MULT_EXPR)
+ return false;
+ index = offset;
+ }
+ else
+ {
/* The statement which defines OFFSET before type conversion
must be a simple GIMPLE_ASSIGN. */
- if (gimple_code (offset_def) != GIMPLE_ASSIGN)
+ if (!is_gimple_assign (offset_def))
return false;
/* The RHS of the statement which defines OFFSET must be a
@@ -805,9 +813,6 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
array_ref = TREE_OPERAND (def_rhs, 0);
if (TREE_CODE (array_ref) != ARRAY_REF
|| TREE_CODE (TREE_TYPE (TREE_OPERAND (array_ref, 0))) != ARRAY_TYPE
- /* Avoid accessing hidden multidimensional arrays in this way or VRP
- might give out bogus warnings (see PR 37861) */
- || TREE_CODE (TREE_OPERAND (array_ref, 0)) == INDIRECT_REF
|| !integer_zerop (TREE_OPERAND (array_ref, 1)))
return false;
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index d881bf3961c..7773fe96b6f 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3224,7 +3224,7 @@ do_regular_insertion (basic_block block, basic_block dom)
basic_block bprime;
pre_expr eprime = NULL;
edge_iterator ei;
- pre_expr edoubleprime;
+ pre_expr edoubleprime = NULL;
val = get_expr_value_id (expr);
if (bitmap_set_contains_value (PHI_GEN (block), val))
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index e6ec30e843e..005ef71715c 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,14 @@
+2008-12-04 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * configure.ac: Add double brackets on darwin[912].
+ * configure: Regenerate.
+
+2008-12-02 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ * configure.ac: Expand to darwin10 and later.
+ * configure: Regenerate.
+ * testsuite/lib/libjava.exp: Expand to darwin10 and later.
+
2008-11-12 Steve Ellcey <sje@cup.hp.com>
* configure: Regenerate to get new GCC_CHECK_UNWIND_GETIPINFO.
diff --git a/libjava/configure b/libjava/configure
index 30ffc88e988..7d960920f3f 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -20608,7 +20608,7 @@ case "${host}" in
# on Darwin -single_module speeds up loading of the dynamic libraries.
extra_ldflags_libjava=-Wl,-single_module
;;
-*-*-darwin[9]*)
+*-*-darwin[912]*)
extra_gij_ldflags=-Wl,-allow_stack_execute
;;
arm*linux*eabi)
diff --git a/libjava/configure.ac b/libjava/configure.ac
index ade98b9c976..6844057beac 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -867,7 +867,7 @@ case "${host}" in
# on Darwin -single_module speeds up loading of the dynamic libraries.
extra_ldflags_libjava=-Wl,-single_module
;;
-*-*-darwin[[9]]*)
+*-*-darwin[[912]]*)
extra_gij_ldflags=-Wl,-allow_stack_execute
;;
arm*linux*eabi)
diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp
index 332c07270c8..a31c2bc63d3 100644
--- a/libjava/testsuite/lib/libjava.exp
+++ b/libjava/testsuite/lib/libjava.exp
@@ -430,7 +430,7 @@ proc libjava_arguments {{mode compile}} {
lappend args "additional_flags=-bind_at_load"
lappend args "additional_flags=-multiply_defined suppress"
}
- if { [istarget "*-*-darwin9*"] } {
+ if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] || [istarget "*-*-darwin2*"] } {
lappend args "additional_flags=-Wl,-allow_stack_execute"
}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ee5100f546c..e7a587d8741 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,18 @@
+2008-12-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/38365 (cont)
+ * src/localename.cc (locale::locale(const locale&, const locale&,
+ category)): Revert last changes.
+ (locale::_Impl::_M_replace_categories(const _Impl*, category)):
+ Fix here instead; rework.
+
+2008-12-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/38365
+ * src/localename.cc (locale::locale(const locale&, const locale&,
+ category)): Fix.
+ * testsuite/22_locale/locale/cons/38365.cc: New.
+
2008-12-01 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/38080
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index 5394d9a99c6..5f5ec5f62e9 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -1,5 +1,5 @@
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007
+// 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -267,29 +267,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_replace_categories(const _Impl* __imp, category __cat)
{
category __mask = 1;
- const bool __have_names = _M_names[0] && __imp->_M_names[0];
- for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
+ if (!_M_names[0] || !__imp->_M_names[0])
{
- if (__mask & __cat)
+ if (_M_names[0])
{
- // Need to replace entry in _M_facets with other locale's info.
- _M_replace_category(__imp, _S_facet_categories[__ix]);
- // If both have names, go ahead and mangle.
- if (__have_names)
+ delete [] _M_names[0];
+ _M_names[0] = 0; // Unnamed.
+ }
+
+ for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
+ {
+ if (__mask & __cat)
+ // Need to replace entry in _M_facets with other locale's info.
+ _M_replace_category(__imp, _S_facet_categories[__ix]);
+ }
+ }
+ else
+ {
+ if (!_M_names[1])
+ {
+ // A full set of _M_names must be prepared, all identical
+ // to _M_names[0] to begin with. Then, below, a few will
+ // be replaced by the corresponding __imp->_M_names. I.e.,
+ // not a "simple" locale anymore (see locale::operator==).
+ const size_t __len = std::strlen(_M_names[0]) + 1;
+ for (size_t __i = 1; __i < _S_categories_size; ++__i)
{
- if (!_M_names[1])
- {
- // A full set of _M_names must be prepared, all identical
- // to _M_names[0] to begin with. Then, below, a few will
- // be replaced by the corresponding __imp->_M_names. I.e.,
- // not a "simple" locale anymore (see locale::operator==).
- const size_t __len = std::strlen(_M_names[0]) + 1;
- for (size_t __i = 1; __i < _S_categories_size; ++__i)
- {
- _M_names[__i] = new char[__len];
- std::memcpy(_M_names[__i], _M_names[0], __len);
- }
- }
+ _M_names[__i] = new char[__len];
+ std::memcpy(_M_names[__i], _M_names[0], __len);
+ }
+ }
+
+ for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
+ {
+ if (__mask & __cat)
+ {
+ // Need to replace entry in _M_facets with other locale's info.
+ _M_replace_category(__imp, _S_facet_categories[__ix]);
// FIXME: Hack for libstdc++/29217: the numerical encodings
// of the time and collate categories are swapped vs the
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
new file mode 100644
index 00000000000..18225941121
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/38365.cc
@@ -0,0 +1,45 @@
+// { dg-require-namedlocale "" }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 22.1.1.2 locale constructors and destructors [lib.locale.cons]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/38365
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale other(locale("C"));
+ locale one(locale("en_US"), new ctype<char>());
+ locale loc(other, one, locale::collate);
+
+ VERIFY( one.name() == "*" );
+ VERIFY( other.name() == "C" );
+ VERIFY( loc.name() == "*" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}