aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2008-07-02 19:54:35 +0000
committerH.J. Lu <hongjiu.lu@intel.com>2008-07-02 19:54:35 +0000
commit01831cdd0f60f69b94890823770e3450de1a05ab (patch)
tree29a7354cbcee51e874ef7c8054b60031ee49d6f5
parent6bc3e25c0e3da8d76d808f8fd02291ebe1fcf8f8 (diff)
Merged with trunk at revision 137380.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ix86/avx@137390 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog4
-rw-r--r--MAINTAINERS1
-rw-r--r--gcc/ChangeLog271
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in6
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/decl.c37
-rw-r--r--gcc/auto-inc-dec.c3
-rw-r--r--gcc/bb-reorder.c5
-rw-r--r--gcc/bitmap.c25
-rw-r--r--gcc/bitmap.h8
-rw-r--r--gcc/builtins.c6
-rw-r--r--gcc/c-common.c14
-rw-r--r--gcc/c-common.h1
-rw-r--r--gcc/c-typeck.c5
-rw-r--r--gcc/calls.c15
-rw-r--r--gcc/cfgexpand.c10
-rw-r--r--gcc/cfglayout.c3
-rw-r--r--gcc/cfgrtl.c9
-rw-r--r--gcc/combine.c9
-rw-r--r--gcc/common.opt4
-rw-r--r--gcc/config.gcc15
-rw-r--r--gcc/config/alpha/alpha.c4
-rw-r--r--gcc/config/darwin-driver.c4
-rw-r--r--gcc/config/i386/i386.c76
-rw-r--r--gcc/config/i386/libgcc-glibc.ver (renamed from gcc/config/i386/libgcc-x86_64-glibc.ver)85
-rw-r--r--gcc/config/i386/linux.h6
-rw-r--r--gcc/config/i386/linux64.h2
-rw-r--r--gcc/config/i386/mingw32.h3
-rw-r--r--gcc/config/i386/netware.c4
-rw-r--r--gcc/config/i386/sfp-machine.h144
-rw-r--r--gcc/config/i386/t-darwin3
-rw-r--r--gcc/config/i386/t-darwin643
-rw-r--r--gcc/config/i386/t-fprules-softfp (renamed from gcc/config/i386/t-fprules-softfp64)0
-rw-r--r--gcc/config/i386/t-linux5
-rw-r--r--gcc/config/i386/t-linux649
-rw-r--r--gcc/config/ia64/ia64.c2
-rw-r--r--gcc/config/libgcc-glibc.ver14
-rw-r--r--gcc/config/m32r/libgcc-glibc.ver10
-rw-r--r--gcc/config/pa/pa.c3
-rw-r--r--gcc/config/rs6000/rs6000.c1
-rw-r--r--gcc/config/s390/libgcc-glibc.ver24
-rw-r--r--gcc/config/sh/libgcc-glibc.ver11
-rw-r--r--gcc/config/sh/sh.c10
-rw-r--r--gcc/config/sparc/libgcc-sparc-glibc.ver14
-rw-r--r--gcc/cp/ChangeLog80
-rw-r--r--gcc/cp/call.c368
-rw-r--r--gcc/cp/cp-tree.h30
-rw-r--r--gcc/cp/cvt.c6
-rw-r--r--gcc/cp/decl.c176
-rw-r--r--gcc/cp/error.c18
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/name-lookup.c3
-rw-r--r--gcc/cp/parser.c307
-rw-r--r--gcc/cp/pt.c37
-rw-r--r--gcc/cp/rtti.c14
-rw-r--r--gcc/cp/semantics.c34
-rw-r--r--gcc/cp/tree.c8
-rw-r--r--gcc/cp/typeck.c15
-rw-r--r--gcc/cp/typeck2.c85
-rw-r--r--gcc/df-problems.c2
-rw-r--r--gcc/doc/install.texi39
-rw-r--r--gcc/doc/invoke.texi19
-rw-r--r--gcc/emit-rtl.c41
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/final.c3
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/iresolve.c2
-rw-r--r--gcc/function.c79
-rw-r--r--gcc/gcse.c5
-rw-r--r--gcc/haifa-sched.c6
-rw-r--r--gcc/java/ChangeLog11
-rw-r--r--gcc/java/Make-lang.in19
-rw-r--r--gcc/java/gcj.texi91
-rw-r--r--gcc/jump.c3
-rw-r--r--gcc/libgcc-std.ver4
-rw-r--r--gcc/loop-doloop.c17
-rw-r--r--gcc/loop-unswitch.c4
-rw-r--r--gcc/lower-subreg.c3
-rw-r--r--gcc/mkmap-symver.awk16
-rw-r--r--gcc/optabs.c3
-rw-r--r--gcc/opts.c1
-rw-r--r--gcc/params.def9
-rw-r--r--gcc/params.h2
-rw-r--r--gcc/passes.c1
-rw-r--r--gcc/predict.c14
-rw-r--r--gcc/recog.c12
-rw-r--r--gcc/reg-stack.c7
-rw-r--r--gcc/regmove.c5
-rw-r--r--gcc/reload.c4
-rw-r--r--gcc/reload1.c14
-rw-r--r--gcc/reorg.c11
-rw-r--r--gcc/resource.c5
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/rtlanal.c28
-rw-r--r--gcc/testsuite/ChangeLog132
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle24.C1
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle25.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist1.C69
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist2.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist3.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist4.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist5.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist6.C30
-rw-r--r--gcc/testsuite/g++.dg/inherit/error4.C6
-rw-r--r--gcc/testsuite/g++.dg/init/brace2.C2
-rw-r--r--gcc/testsuite/g++.dg/init/brace6.C6
-rw-r--r--gcc/testsuite/g++.dg/opt/temp1.C5
-rw-r--r--gcc/testsuite/g++.dg/other/opaque-1.C2
-rw-r--r--gcc/testsuite/g++.dg/other/opaque-2.C2
-rw-r--r--gcc/testsuite/g++.dg/other/opaque-3.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/crash36.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/ctor3.C2
-rw-r--r--gcc/testsuite/g++.dg/torture/type-generic-1.C1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20001226-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr36666.c22
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030222-1.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c9
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x5
-rw-r--r--gcc/testsuite/gcc.dg/builtin-inf-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/builtins-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/builtins-43.c5
-rw-r--r--gcc/testsuite/gcc.dg/builtins-44.c7
-rw-r--r--gcc/testsuite/gcc.dg/builtins-45.c10
-rw-r--r--gcc/testsuite/gcc.dg/const-float128-ped.c2
-rw-r--r--gcc/testsuite/gcc.dg/const-float128.c2
-rw-r--r--gcc/testsuite/gcc.dg/const-float80-ped.c1
-rw-r--r--gcc/testsuite/gcc.dg/const-float80.c1
-rw-r--r--gcc/testsuite/gcc.dg/float-range-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/float-range-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/float-range-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/float-range-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/fold-overflow-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/lower-subreg-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/memcpy-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/nrv3.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr15784-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr27095.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr28796-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-logb-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-math-2.c35
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-modf-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c3
-rw-r--r--gcc/testsuite/gcc.dg/torture/type-generic-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cswtch.c81
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr32191.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr32268.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/quad-sse.c21
-rw-r--r--gcc/testsuite/gfortran.dg/count_mask_1.f908
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_51.f9027
-rw-r--r--gcc/testsuite/gnat.dg/pack10.adb34
-rw-r--r--gcc/testsuite/lib/compat.exp9
-rw-r--r--gcc/testsuite/lib/target-supports.exp35
-rw-r--r--gcc/timevar.def1
-rw-r--r--gcc/tree-pass.h1
-rw-r--r--gcc/tree-ssa-forwprop.c31
-rw-r--r--gcc/tree-ssa-structalias.c279
-rw-r--r--gcc/tree-switch-conversion.c880
-rw-r--r--gcc/tree.c20
-rw-r--r--gcc/tree.h7
-rw-r--r--gcc/vmsdbgout.c18
-rw-r--r--libgcc/ChangeLog55
-rw-r--r--libgcc/Makefile.in2
-rw-r--r--libgcc/config.host18
-rw-r--r--libgcc/config/i386/32/sfp-machine.h217
-rw-r--r--libgcc/config/i386/32/t-fprules-softfp8
-rw-r--r--libgcc/config/i386/32/tf-signs.c64
-rw-r--r--libgcc/config/i386/64/_divtc3-compat.c14
-rw-r--r--libgcc/config/i386/64/_multc3-compat.c14
-rw-r--r--libgcc/config/i386/64/_powitf2-compat.c14
-rw-r--r--libgcc/config/i386/64/eqtf2.c13
-rw-r--r--libgcc/config/i386/64/getf2.c13
-rw-r--r--libgcc/config/i386/64/letf2.c13
-rw-r--r--libgcc/config/i386/64/sfp-machine.h143
-rw-r--r--libgcc/config/i386/64/t-softfp-compat12
-rw-r--r--libgcc/configure15
-rw-r--r--libgcc/configure.ac15
-rw-r--r--libgcc/shared-object.mk4
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/io/list_read.c4
-rw-r--r--libjava/ChangeLog33
-rw-r--r--libjava/Makefile.am146
-rw-r--r--libjava/Makefile.in223
-rwxr-xr-xlibjava/configure402
-rw-r--r--libjava/configure.ac206
-rw-r--r--libjava/contrib/aot-compile-rpm.in97
-rw-r--r--libjava/contrib/aot-compile.in88
-rw-r--r--libjava/contrib/aotcompile.py.in412
-rw-r--r--libjava/contrib/classfile.py221
-rw-r--r--libjava/contrib/rebuild-gcj-db.in27
-rw-r--r--libjava/gcj/Makefile.in27
-rw-r--r--libjava/include/Makefile.in27
-rw-r--r--libjava/testsuite/Makefile.in27
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/bits/stl_map.h13
-rw-r--r--libstdc++-v3/libsupc++/initializer_list64
213 files changed, 6311 insertions, 1012 deletions
diff --git a/ChangeLog b/ChangeLog
index ef4f77cd1e0..67913947421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-02 Xuepeng Guo <xuepeng.guo@intel.com>
+
+ * MAINTAINERS (Write After Approval): Add myself.
+
2008-06-29 Andrew Jenner <andrew@codesourcery.com>
* MAINTAINERS (Write After Approval): Add myself.
diff --git a/MAINTAINERS b/MAINTAINERS
index b0034e56dcf..b578e25accc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -315,6 +315,7 @@ Doug Gregor doug.gregor@gmail.com
Jon Grimm jgrimm2@us.ibm.com
Tobias Grosser grosser@fim.uni-passau.de
Laurent Guerby laurent@guerby.net
+Xuepeng Guo xuepeng.guo@intel.com
Mostafa Hagog hagog@gcc.gnu.org
Olivier Hainque hainque@act-europe.fr
Stuart Hastings stuart@apple.com
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aaf1d083447..fce6036e027 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,21 +1,272 @@
-2008-06-30 Uros Bizjak <ubizjak@gmail.com>
+2008-07-02 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * resource.c (mark_referenced_resources): Look inside
+ UNSPEC_VOLATILEs and ASM_INPUTs.
+
+2008-07-02 Ian Lance Taylor <iant@google.com>
+
+ * rtlanal.c (add_reg_note): New function.
+ * rtl.h (add_reg_note): Declare.
+ * auto-inc-dec.c (attempt_change): Use add_reg_note.
+ * bb-reorder.c (add_reg_crossing_jump_notes): Likewise.
+ * builtins.c (expand_builtin_longjmp): Likewise.
+ (expand_builtin_nonlocal_goto): Likewise.
+ * calls.c (emit_call_1, expand_call): Likewise.
+ * cfgexpand.c (add_reg_br_prob_note): Likewise.
+ * cfglayout.c (fixup_reorder_chain): Likewise.
+ * cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
+ (commit_one_edge_insertion): Likewise.
+ * combine.c (move_deaths, distribute_notes): Likewise.
+ * df-problems.c (df_set_note): Likewise.
+ * emit-rtl.c (link_cc0_insns, try_split): Likewise.
+ (set_unique_reg_note): Likewise.
+ (emit_copy_of_insn_after): Likewise.
+ * expr.c (expand_expr_real): Likewise.
+ * gcse.c (add_label_notes): Likewise.
+ * haifa-sched.c (create_check_block_twin): Likewise.
+ * jump.c (mark_jump_label_1): Likewise.
+ * loop-doloop.c (add_test, doloop_modify): Likewise.
+ * loop-unswitch.c (compare_and_jump_seq): Likewise.
+ * lower-subreg.c (move_eh_region_note): Likewise.
+ * optabs.c (emit_libcall_block): Likewise.
+ * predict.c (predict_insn): Likewise.
+ (combine_predictions_for_insn): Likewise.
+ * recog.c (peephole2_optimize): Likewise.
+ * regmove.c (try_auto_increment): Likewise.
+ * reg-stack.c (emit_pop_insn, move_for_stack_reg): Likewise.
+ * reload.c (find_reloads): Likewise.
+ * reload1.c (fixup_eh_region_note): Likewise.
+ (reload_as_needed, add_auto_inc_notes, copy_eh_notes): Likewise.
+ * reorg.c (delete_prior_computation): Likewise.
+ (delete_computation, dbr_schedule): Likewise.
+ * config/pa/pa.c (legitimize_pic_address): Likewise.
+ * config/sh/sh.c (sh_reorg): Likewise.
+
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/36669
+ * config/libgcc-glibc.ver: Add %exclude.
+ * config/m32r/libgcc-glibc.ver: Likwise.
+ * config/s390/libgcc-glibc.ver: Likwise.
+ * config/sh/libgcc-glibc.ver: Likwise.
+ * config/sparc/libgcc-sparc-glibc.ver: Likwise.
+
+ * config/i386/libgcc-glibc.ver: New.
+
+ * config/i386/libgcc-x86_64-glibc.ver: Removed.
+
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.gcc: Remove i386/t-fprules-softfp64 soft-fp/t-softfp
+ from tmake_file from i[34567]86-*-darwin*, x86_64-*-darwin*,
+ i[34567]86-*-linux*, x86_64-*-linux*. Add
+ i386/t-fprules-softfp and soft-fp/t-softfp to tmake_file for
+ i[34567]86-*-darwin*, x86_64-*-darwin*, i[34567]86-*-linux*,
+ x86_64-*-linux*. Add i386/t-linux to tmake_file for
+ i[34567]86-*-linux*, x86_64-*-linux*.
+
+ * libgcc-std.ver: Add empty GCC_4.4.0.
+
+ * mkmap-symver.awk: Support multiple versions per symbol.
+
+ * config/i386/i386.c (ix86_init_builtins): Always define
+ __builtin_fabsq and __builtin_copysignq with fallbacks.
+ (ix86_expand_builtin): Emit normal call for __builtin_fabsq
+ and __builtin_copysignq if SSE2 isn't available.
+
+ * config/i386/linux.h (LIBGCC2_HAS_TF_MODE): Defined.
+ (LIBGCC2_TF_CEXT): Likwise.
+ (TF_SIZE): Likwise.
+
+ * config/i386/linux64.h (LIBGCC2_HAS_TF_MODE): Defined as 1.
+
+ * config/i386/sfp-machine.h: Moved to libgcc.
+
+ * config/i386/sfp-machine.h: New.
+ * config/i386/t-linux: Likwise.
+
+ * config/i386/t-darwin: Remove softfp_wrap_start and
+ softfp_wrap_end.
+ * config/i386/t-darwin64: Likewise.
+
+ * config/i386/t-fprules-softfp64: Renamed to ...
+ * config/i386/t-fprules-softfp: This.
+
+ * config/i386/t-linux64: Remove SHLIB_MAPFILES, softfp_wrap_start
+ and softfp_wrap_end.
+
+2008-07-02 Jason Merrill <jason@redhat.com>
+
+ * tree.c (ctor_to_list): New fn.
+ * tree.h: Declare it.
+ (CONSTRUCTOR_ELT): New macro.
+ (CONSTRUCTOR_NELTS): New macro.
+
+2008-07-02 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-structalias.c (struct variable_info): Reorder
+ to fill padding on 64bit hosts. Make collapsed_to an int.
+ (get_varinfo_fc): Deal with that.
+ (new_var_info): Likewise.
+ (collapse_rest_of_var): Likewise.
+
+2008-07-02 Joshua Sumali <jsumali@redhat.com>
+
+ * doc/install.texi (--enable-java-home): Document.
+ (--enable-aot-compile-rpm): Likewise.
+ (--with-arch-directory): Likewise.
+ (--with-os-directory): Likewise.
+ (--with-origin-name): Likewise.
+ (--with-arch-suffix): Likewise.
+ (--with-jvm-root-dir): Likewise.
+ (--with-jvm-jar-dir): Likewise.
+ (--with-python-dir): Likewise.
+
+2008-07-02 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-forwprop.c (can_propagate_from): Exclude loads
+ from decls explicitly. Merge operand checking from tuples.
+
+2008-07-02 Martin Jambor <mjambor@suse.cz>
+
+ * tree-switch-conversion.c: Included timevar.h which I forgot before.
+
+2008-07-02 Martin Jambor <mjambor@suse.cz>
+
+ * tree-switch-conversion.c: Included timevar.h
+ (pass_convert_switch): Added a timevar id (TV_TREE_SWITCH_CONVERSION).
+
+ * timevar.def: Added TV_TREE_SWITCH_CONVERSION.
+
+2008-07-02 Martin Jambor <mjambor@suse.cz>
+
+ * tree-switch-conversion.c: Corrected various comments and
+ whitespace issues
+ (build_constructors): Fixed minor formatting mistakes.
+
+ * invoke.texi (Optimize Options): Corrected the
+ switch-conversion-max-branch-ratio parameter.
+
+2008-07-02 Mark Shinwell <shinwell@codesourcery.com>
+
+ * final.c (asm_insn_count): Return zero for an empty asm body.
+
+2008-07-02 Richard Guenther <rguenther@suse.de>
+
+ * bitmap.h (bitmap_set_bit): Return bool.
+ (bitmap_clear_bit): Likewise.
+ * bitmap.c (bitmap_set_bit): Return if the bit changed. Only
+ write to the bitmap if it would.
+ (bitmap_clear_bit): Likewise.
+ * tree-ssa-structalias.c (add_implicit_graph_edge): Use
+ bitmap_set_bit return value.
+ (add_pred_graph_edge): Likewise.
+ (add_graph_edge): Likewise.
+ (do_sd_constraint): Likewise.
+ (do_ds_constraint): Likewise.
+
+2008-07-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * config/alpha/alpha.c (alpha_need_linkage, alpha_use_linkage):
+ Fix -Wc++-compat and/or -Wcast-qual warnings.
+ * config/i386/netware.c (gen_stdcall_or_fastcall_decoration,
+ gen_regparm_prefix): Likewise.
+ * vmsdbgout.c (write_modbeg, lookup_filename,
+ vmsdbgout_source_line, vmsdbgout_init): Likewise.
+
+2008-07-02 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * config/i386/mingw32.h (TARGET_USE_JCR_SECTION): Undef to let
+ defaults.h definition apply.
+
+2008-07-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * function.c (assign_parm_remove_parallels): New.
+ (assign_parm_setup_block_p): Do not return true for non-BLKmode
+ PARALLELs.
+ (assign_parm_setup_block): Do not handle them.
+ (assign_parm_setup_reg, assign_parm_setup_stack): Call
+ assign_parm_remove_parallels.
+
+2008-07-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * c-typeck.c (convert_for_assignment): Use
+ vector_targets_convertible_p.
+ * c-common.c (vector_targets_convertible_p): New.
+ * c-common.h (vector_targets_convertible_p): New prototype.
+ * config/rs6000/rs6000.c (rs6000_is_opaque_type): Do not check
+ opaque_p_V2SI_type_node.
+
+2008-07-01 Steve Ellcey <sje@cup.hp.com>
+
+ * config/ia64/ia64.c (ia64_cannot_force_const_mem): Do not allow
+ RFmode constants.
+
+2008-07-01 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (ix86_build_signbit_mask): Generate TImode and
+ TFmode constants via two element DImode vector for hosts with
+ HOST_BITS_PER_WIDE_INT < 64.
+ (ix86_init_builtins): Define __builtin_fabsq and __builtin_copysignq
+ also for HOST_BITS_PER_WIDE_INT < 64.
+
+2008-07-01 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36666
+ * tree-ssa-structalias.c (get_constraint_for_1): Declare.
+ (get_constraint_exp_from_ssa_var): Split into ...
+ (get_constraint_exp_for_temp): ... this ...
+ (get_constraint_for_ssa_var): ... and that.
+ Return constraint expressions for all touched sub-fields
+ if the results address is not taken.
+ (process_constraint): Remove assertion that aggregate
+ assignments do not happen at this place.
+ (get_constraint_for_component_ref): Add address_p argument.
+ Return constraint expressions for all touched sub-fields
+ if the results address is not taken.
+ (do_deref): Use get_constraint_exp_for_temp.
+ (get_constraint_for_1): Rename from ...
+ (get_constraint_for): ... this. Add the old function as wrapper.
+ (do_structure_copy): Use get_constraint_for_1.
+
+2008-07-01 Martin Jambor <mjambor@suse.cz>
+
+ * Makefile.in (tree-switch-conversion.o): Add.
+ (OBJS-common): Add tree-swtch-conversion.o.
+ * passes.c (init_optimization_passes): Add pass_convert_switch.
+ * tree-pass.h: (pass_convert_switch): Add.
+ * tree-switch-conversion.c: New file.
+ * gcc.dg/tree-ssa/cswtch.c: New testcase.
+ * common.opt (ftree-cswtch): New option.
+ * params.h (PARAM_SWITCH_CONVERSION_BRANCH_RATIO): New parameter.
+ * params.def (PARAM_SWITCH_CONVERSION_BRANCH_RATIO): New parameter.
+ * opts.c (decode_options): Set flag_tree_switch_conversion when
+ optimization level is >= 2.
+ * doc/invoke.texi (Optimize Options): Added description of
+ -ftree-swtch-conversion and switch-conversion-max-branch-ratio.
+
+2008-06-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * config/darwin-driver.c (darwin_default_min_version): Fix
+ -Wc++-compat warnings.
+
+2008-06-30 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*movti_rex64): Add "!" to "r" constraint
of operand 0.
2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com>
- * ifcvt.c (cond_move_process_if_block): Free vectors on false
- return.
+ * ifcvt.c (cond_move_process_if_block): Free vectors on false return.
2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com>
- * df-scan.c (df_scan_free_ref_vec, df_scan_free_mws_vec): New
- macros.
+ PR rtl-optimization/34744
+ * df-scan.c (df_scan_free_ref_vec, df_scan_free_mws_vec): New macros.
(df_scan_free_internal): Free data structures not
allocated in storage pools.
(df_mw_hardreg_chain_delete_eq_uses): Use df_scan_free_mws_vec.
- (df_refs_add_to_chains): Use df_scan_free_ref_vec and
+ (df_refs_add_to_chains): Use df_scan_free_ref_vec and
df_scan_free_mws_vec.
* dse.c (dse_step6): Free offset_map_p and offset_map_n
unconditionally.
@@ -160,7 +411,7 @@
* doc/rtl.texi (const_vector): Document const_fixed as legitimate
element type of const_vector.
-2008-06-28 Uros Bizjak <ubizjak@gmail.com>
+2008-06-28 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (addti3, adddi3, addsi3, addhi3, addqi3):
Remove FLAGS_REG clobber from expander pattern.
@@ -224,7 +475,7 @@
(init_one_libfunc): Reuse decls and SYMBOL_REFs when asked
for the same function twice.
-2008-06-27 Uros Bizjak <ubizjak@gmail.com>
+2008-06-27 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (ashlti3, ashrti3, lshrti3): Expand using
ix86_expand_binary_operator directly.
@@ -791,7 +1042,7 @@
have_similar_memory_accesses_1, ref_base_address_1): Likewise.
* tree-ssa-phiopt.c (name_to_bb_hash): Likewise.
-2008-06-25 Uros Bizjak <ubizjak@gmail.com>
+2008-06-25 Uros Bizjak <ubizjak@gmail.com>
PR target/36627
* config/i386/i386.md : Change constraints of HImode and QImode
@@ -2113,7 +2364,7 @@
* config/vax/vaxv.h: Remove.
* config/windiss.h: Remove.
-2008-06-06 Uros Bizjak <ubizjak@gmail.com>
+2008-06-06 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/36438
* cse.c (fold_rtx) [ASHIFT, LSHIFTRT, ASHIFTRT]: Break out early
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 0c2aac28c06..bc40ef40751 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20080630
+20080702
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index b29b0a8143e..a792144449a 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1176,6 +1176,7 @@ OBJS-common = \
tree-profile.o \
tree-scalar-evolution.o \
tree-sra.o \
+ tree-switch-conversion.o \
tree-ssa-address.o \
tree-ssa-alias.o \
tree-ssa-alias-warnings.o \
@@ -2629,6 +2630,11 @@ tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_GIMPLE_H) \
langhooks.h tree-pass.h $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) \
bitmap.h $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(PARAMS_H) $(TARGET_H)
+tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \
+ $(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
+ $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_GIMPLE_H) \
+ tree-pass.h $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h \
+ $(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H)
tree-complex.o : tree-complex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
$(TM_H) $(RTL_H) $(REAL_H) $(FLAGS_H) $(TREE_FLOW_H) $(TREE_GIMPLE_H) \
tree-iterator.h tree-pass.h tree-ssa-propagate.h $(DIAGNOSTIC_H)
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 15ad6dcd4a2..c2fb2dad0ae 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl.c (make_type_from_size) <INTEGER_TYPE>: Fix typo and tidy up.
+
2008-06-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ada-tree.h (SET_TYPE_LANG_SPECIFIC, SET_DECL_LANG_SPECIFIC): Fix
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index e6865d292bc..ebc2e5edd14 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -7105,41 +7105,43 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity)
/* Given a type TYPE, return a new type whose size is appropriate for SIZE.
If TYPE is the best type, return it. Otherwise, make a new type. We
- only support new integral and pointer types. BIASED_P is nonzero if
+ only support new integral and pointer types. FOR_BIASED is nonzero if
we are making a biased type. */
static tree
-make_type_from_size (tree type, tree size_tree, bool biased_p)
+make_type_from_size (tree type, tree size_tree, bool for_biased)
{
- tree new_type;
unsigned HOST_WIDE_INT size;
- bool unsigned_p;
+ bool biased_p;
+ tree new_type;
- /* If size indicates an error, just return TYPE to avoid propagating the
- error. Likewise if it's too large to represent. */
+ /* If size indicates an error, just return TYPE to avoid propagating
+ the error. Likewise if it's too large to represent. */
if (!size_tree || !host_integerp (size_tree, 1))
return type;
size = tree_low_cst (size_tree, 1);
+
switch (TREE_CODE (type))
{
case INTEGER_TYPE:
case ENUMERAL_TYPE:
- /* Only do something if the type is not already the proper size and is
- not a packed array type. */
+ biased_p = (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (type));
+
+ /* Only do something if the type is not a packed array type and
+ doesn't already have the proper size. */
if (TYPE_PACKED_ARRAY_TYPE_P (type)
- || (TYPE_PRECISION (type) == size
- && biased_p == (TREE_CODE (type) == INTEGER_CST
- && TYPE_BIASED_REPRESENTATION_P (type))))
+ || (TYPE_PRECISION (type) == size && biased_p == for_biased))
break;
- biased_p |= (TREE_CODE (type) == INTEGER_TYPE
- && TYPE_BIASED_REPRESENTATION_P (type));
- unsigned_p = TYPE_UNSIGNED (type) || biased_p;
-
+ biased_p |= for_biased;
size = MIN (size, LONG_LONG_TYPE_SIZE);
- new_type
- = unsigned_p ? make_unsigned_type (size) : make_signed_type (size);
+
+ if (TYPE_UNSIGNED (type) || biased_p)
+ new_type = make_unsigned_type (size);
+ else
+ new_type = make_signed_type (size);
TREE_TYPE (new_type) = TREE_TYPE (type) ? TREE_TYPE (type) : type;
TYPE_MIN_VALUE (new_type)
= convert (TREE_TYPE (new_type), TYPE_MIN_VALUE (type));
@@ -7164,7 +7166,6 @@ make_type_from_size (tree type, tree size_tree, bool biased_p)
if (TYPE_THIN_POINTER_P (type) && size >= POINTER_SIZE * 2)
return
build_pointer_type (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)));
-
break;
default:
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 18c1b7107da..35d6c87a696 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -621,8 +621,7 @@ attempt_change (rtx new_addr, rtx inc_reg)
}
/* Record that this insn has an implicit side effect. */
- REG_NOTES (mem_insn.insn)
- = alloc_EXPR_LIST (REG_INC, inc_reg, REG_NOTES (mem_insn.insn));
+ add_reg_note (mem_insn.insn, REG_INC, inc_reg);
if (dump_file)
{
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index b36c6c24bb3..ae24c0c3245 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1785,10 +1785,7 @@ add_reg_crossing_jump_notes (void)
FOR_EACH_EDGE (e, ei, bb->succs)
if ((e->flags & EDGE_CROSSING)
&& JUMP_P (BB_END (e->src)))
- REG_NOTES (BB_END (e->src)) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
- NULL_RTX,
- REG_NOTES (BB_END
- (e->src)));
+ add_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX);
}
/* Hot and cold basic blocks are partitioned and put in separate
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 97e60de6b3c..4fabdc915d2 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -595,9 +595,9 @@ bitmap_find_bit (bitmap head, unsigned int bit)
return element;
}
-/* Clear a single bit in a bitmap. */
+/* Clear a single bit in a bitmap. Return true if the bit changed. */
-void
+bool
bitmap_clear_bit (bitmap head, int bit)
{
bitmap_element *const ptr = bitmap_find_bit (head, bit);
@@ -606,17 +606,24 @@ bitmap_clear_bit (bitmap head, int bit)
{
unsigned bit_num = bit % BITMAP_WORD_BITS;
unsigned word_num = bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
- ptr->bits[word_num] &= ~ (((BITMAP_WORD) 1) << bit_num);
+ BITMAP_WORD bit_val = ((BITMAP_WORD) 1) << bit_num;
+ bool res = (ptr->bits[word_num] & bit_val) != 0;
+ if (res)
+ ptr->bits[word_num] &= ~bit_val;
/* If we cleared the entire word, free up the element. */
if (bitmap_element_zerop (ptr))
bitmap_element_free (head, ptr);
+
+ return res;
}
+
+ return false;
}
-/* Set a single bit in a bitmap. */
+/* Set a single bit in a bitmap. Return true if the bit changed. */
-void
+bool
bitmap_set_bit (bitmap head, int bit)
{
bitmap_element *ptr = bitmap_find_bit (head, bit);
@@ -630,9 +637,15 @@ bitmap_set_bit (bitmap head, int bit)
ptr->indx = bit / BITMAP_ELEMENT_ALL_BITS;
ptr->bits[word_num] = bit_val;
bitmap_element_link (head, ptr);
+ return true;
}
else
- ptr->bits[word_num] |= bit_val;
+ {
+ bool res = (ptr->bits[word_num] & bit_val) == 0;
+ if (res)
+ ptr->bits[word_num] |= bit_val;
+ return res;
+ }
}
/* Return whether a bit is set within a bitmap. */
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 2a3b0b4baf8..7f17dc1d361 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -136,11 +136,11 @@ extern bool bitmap_ior_and_compl (bitmap DST, const_bitmap A, const_bitmap B, co
/* A |= (B & ~C). Return true if A changes. */
extern bool bitmap_ior_and_compl_into (bitmap DST, const_bitmap B, const_bitmap C);
-/* Clear a single register in a register set. */
-extern void bitmap_clear_bit (bitmap, int);
+/* Clear a single bit in a bitmap. Return true if the bit changed. */
+extern bool bitmap_clear_bit (bitmap, int);
-/* Set a single register in a register set. */
-extern void bitmap_set_bit (bitmap, int);
+/* Set a single bit in a bitmap. Return true if the bit changed. */
+extern bool bitmap_set_bit (bitmap, int);
/* Return true if a register is set in a register set. */
extern int bitmap_bit_p (bitmap, int);
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 10af34254aa..731955b5699 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -845,8 +845,7 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
if (JUMP_P (insn))
{
- REG_NOTES (insn) = alloc_EXPR_LIST (REG_NON_LOCAL_GOTO, const0_rtx,
- REG_NOTES (insn));
+ add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx);
break;
}
else if (CALL_P (insn))
@@ -929,8 +928,7 @@ expand_builtin_nonlocal_goto (tree exp)
{
if (JUMP_P (insn))
{
- REG_NOTES (insn) = alloc_EXPR_LIST (REG_NON_LOCAL_GOTO,
- const0_rtx, REG_NOTES (insn));
+ add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx);
break;
}
else if (CALL_P (insn))
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 7bb614971d7..31c778c88b4 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1207,6 +1207,20 @@ check_main_parameter_types (tree decl)
pedwarn ("%q+D takes only zero or two arguments", decl);
}
+/* True if pointers to distinct types T1 and T2 can be converted to
+ each other without an explicit cast. Only returns true for opaque
+ vector types. */
+bool
+vector_targets_convertible_p (const_tree t1, const_tree t2)
+{
+ if (TREE_CODE (t1) == VECTOR_TYPE && TREE_CODE (t2) == VECTOR_TYPE
+ && (targetm.vector_opaque_p (t1) || targetm.vector_opaque_p (t2))
+ && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
+ return true;
+
+ return false;
+}
+
/* True if vector types T1 and T2 can be converted to each other
without an explicit cast. If EMIT_LAX_NOTE is true, and T1 and T2
can only be converted with -flax-vector-conversions yet that is not
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 3ddb44bd8d6..7fd2242c352 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -824,6 +824,7 @@ extern tree finish_label_address_expr (tree);
extern tree lookup_label (tree);
extern tree lookup_name (tree);
+extern bool vector_targets_convertible_p (const_tree t1, const_tree t2);
extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note);
extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index d5a549c9478..6b7594e6a26 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4196,10 +4196,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
if (TREE_CODE (mvr) != ARRAY_TYPE)
mvr = TYPE_MAIN_VARIANT (mvr);
/* Opaque pointers are treated like void pointers. */
- is_opaque_pointer = (targetm.vector_opaque_p (type)
- || targetm.vector_opaque_p (rhstype))
- && TREE_CODE (ttl) == VECTOR_TYPE
- && TREE_CODE (ttr) == VECTOR_TYPE;
+ is_opaque_pointer = vector_targets_convertible_p (ttl, ttr);
/* C++ does not allow the implicit conversion void* -> T*. However,
for the purpose of reducing the number of false positives, we
diff --git a/gcc/calls.c b/gcc/calls.c
index 79dc47b98fa..a4470fa1477 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -377,8 +377,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
/* If this call can't throw, attach a REG_EH_REGION reg note to that
effect. */
if (ecf_flags & ECF_NOTHROW)
- REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, const0_rtx,
- REG_NOTES (call_insn));
+ add_reg_note (call_insn, REG_EH_REGION, const0_rtx);
else
{
int rn = lookup_stmt_eh_region (fntree);
@@ -386,18 +385,15 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
/* If rn < 0, then either (1) tree-ssa not used or (2) doesn't
throw, which we already took care of. */
if (rn > 0)
- REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (rn),
- REG_NOTES (call_insn));
+ add_reg_note (call_insn, REG_EH_REGION, GEN_INT (rn));
}
if (ecf_flags & ECF_NORETURN)
- REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_NORETURN, const0_rtx,
- REG_NOTES (call_insn));
+ add_reg_note (call_insn, REG_NORETURN, const0_rtx);
if (ecf_flags & ECF_RETURNS_TWICE)
{
- REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_SETJMP, const0_rtx,
- REG_NOTES (call_insn));
+ add_reg_note (call_insn, REG_SETJMP, const0_rtx);
cfun->calls_setjmp = 1;
}
@@ -2814,8 +2810,7 @@ expand_call (tree exp, rtx target, int ignore)
/* The return value from a malloc-like function can not alias
anything else. */
last = get_last_insn ();
- REG_NOTES (last) =
- gen_rtx_EXPR_LIST (REG_NOALIAS, temp, REG_NOTES (last));
+ add_reg_note (last, REG_NOALIAS, temp);
/* Write out the sequence. */
insns = get_insns ();
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index afa3e123106..6a48e1632d7 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -67,18 +67,14 @@ add_reg_br_prob_note (rtx last, int probability)
|| NEXT_INSN (NEXT_INSN (NEXT_INSN (NEXT_INSN (last)))))
goto failed;
gcc_assert (!find_reg_note (last, REG_BR_PROB, 0));
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_BR_PROB,
- GEN_INT (REG_BR_PROB_BASE - probability),
- REG_NOTES (last));
+ add_reg_note (last, REG_BR_PROB,
+ GEN_INT (REG_BR_PROB_BASE - probability));
return;
}
if (!last || !JUMP_P (last) || !any_condjump_p (last))
goto failed;
gcc_assert (!find_reg_note (last, REG_BR_PROB, 0));
- REG_NOTES (last)
- = gen_rtx_EXPR_LIST (REG_BR_PROB,
- GEN_INT (probability), REG_NOTES (last));
+ add_reg_note (last, REG_BR_PROB, GEN_INT (probability));
return;
failed:
if (dump_file)
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 623e5bdd911..e4049d66465 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -855,8 +855,7 @@ fixup_reorder_chain (void)
&& JUMP_P (BB_END (bb))
&& !any_condjump_p (BB_END (bb))
&& (EDGE_SUCC (bb, 0)->flags & EDGE_CROSSING))
- REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
- (REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
+ add_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX);
}
}
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 8ce39006cf3..240455bca9d 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1111,11 +1111,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target)
&& JUMP_P (BB_END (jump_block))
&& !any_condjump_p (BB_END (jump_block))
&& (EDGE_SUCC (jump_block, 0)->flags & EDGE_CROSSING))
- REG_NOTES (BB_END (jump_block)) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
- NULL_RTX,
- REG_NOTES
- (BB_END
- (jump_block)));
+ add_reg_note (BB_END (jump_block), REG_CROSSING_JUMP, NULL_RTX);
/* Wire edge in. */
new_edge = make_edge (e->src, jump_block, EDGE_FALLTHRU);
@@ -1418,8 +1414,7 @@ commit_one_edge_insertion (edge e)
if (JUMP_P (BB_END (bb))
&& !any_condjump_p (BB_END (bb))
&& (single_succ_edge (bb)->flags & EDGE_CROSSING))
- REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
- (REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
+ add_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX);
}
}
}
diff --git a/gcc/combine.c b/gcc/combine.c
index 59586a8bf18..a6cff36480f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -12149,10 +12149,7 @@ move_deaths (rtx x, rtx maybe_kill_insn, int from_luid, rtx to_insn,
for (i = deadregno; i < deadend; i++)
if (i < regno || i >= ourend)
- REG_NOTES (where_dead)
- = gen_rtx_EXPR_LIST (REG_DEAD,
- regno_reg_rtx[i],
- REG_NOTES (where_dead));
+ add_reg_note (where_dead, REG_DEAD, regno_reg_rtx[i]);
}
/* If we didn't find any note, or if we found a REG_DEAD note that
@@ -12774,9 +12771,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
|| reg_bitfield_target_p (piece,
PATTERN (tem)))
{
- REG_NOTES (tem)
- = gen_rtx_EXPR_LIST (REG_UNUSED, piece,
- REG_NOTES (tem));
+ add_reg_note (tem, REG_UNUSED, piece);
break;
}
}
diff --git a/gcc/common.opt b/gcc/common.opt
index 94f2c56a362..200425d3128 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1088,6 +1088,10 @@ ftree-cselim
Common Report Var(flag_tree_cselim) Init(2) Optimization
Transform condition stores into unconditional ones
+ftree-switch-conversion
+Common Report Var(flag_tree_switch_conversion) Optimization
+Perform conversions of switch initializations.
+
ftree-dce
Common Report Var(flag_tree_dce) Optimization
Enable SSA dead code elimination optimization on trees
diff --git a/gcc/config.gcc b/gcc/config.gcc
index ce73185f8c2..b485272f361 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1006,11 +1006,11 @@ i[34567]86-*-darwin*)
# then this file using that to set --with-cpu=i386 which has no -m64
# support.
with_cpu=${with_cpu:-generic}
- tmake_file="${tmake_file} i386/t-fprules-softfp64 soft-fp/t-softfp i386/t-crtpc i386/t-crtfm"
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
;;
x86_64-*-darwin*)
with_cpu=${with_cpu:-generic}
- tmake_file="t-darwin ${cpu_type}/t-darwin64 t-slibgcc-darwin i386/t-fprules-softfp64 soft-fp/t-softfp i386/t-crtpc i386/t-crtfm"
+ tmake_file="t-darwin ${cpu_type}/t-darwin64 t-slibgcc-darwin i386/t-crtpc i386/t-crtfm"
tm_file="${tm_file} ${cpu_type}/darwin64.h"
;;
i[34567]86-*-elf*)
@@ -1069,7 +1069,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
if test x$enable_targets = xall; then
tm_file="${tm_file} i386/x86-64.h i386/linux64.h"
tm_defines="${tm_defines} TARGET_BI_ARCH=1"
- tmake_file="${tmake_file} i386/t-linux64 i386/t-fprules-softfp64 soft-fp/t-softfp"
+ tmake_file="${tmake_file} i386/t-linux64"
need_64bit_hwint=yes
case X"${with_cpu}" in
Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
@@ -1101,7 +1101,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;;
x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;;
esac
- tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm i386/t-fprules-softfp64 soft-fp/t-softfp t-dfprules"
+ tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules"
;;
i[34567]86-*-gnu*)
;;
@@ -2973,6 +2973,13 @@ case ${target} in
fi
;;
+ i[34567]86-*-darwin* | x86_64-*-darwin*)
+ tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
+ ;;
+ i[34567]86-*-linux* | x86_64-*-linux*)
+ tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp i386/t-linux"
+ ;;
+
mips*-*-*)
if test x$gnu_ld = xyes
then
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index f878e866f5f..350994234cd 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -9489,7 +9489,7 @@ alpha_need_linkage (const char *name, int is_local)
/* Construct a SYMBOL_REF for us to call. */
{
size_t name_len = strlen (name);
- char *linksym = alloca (name_len + 6);
+ char *linksym = XALLOCAVEC (char, name_len + 6);
linksym[0] = '$';
memcpy (linksym + 1, name, name_len);
memcpy (linksym + 1 + name_len, "..lk", 5);
@@ -9556,7 +9556,7 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
sprintf (buf, "$%d..%s..lk", cfaf->num, name);
buflen = strlen (buf);
- linksym = alloca (buflen + 1);
+ linksym = XALLOCAVEC (char, buflen + 1);
memcpy (linksym, buf, buflen + 1);
al->linkage = gen_rtx_SYMBOL_REF
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 524f31ec04c..02226308639 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -93,7 +93,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p)
&& macosx_deployment_target[0])
{
++*argc_p;
- *argv_p = xmalloc (sizeof (char *) * *argc_p);
+ *argv_p = XNEWVEC (char *, *argc_p);
(*argv_p)[0] = argv[0];
(*argv_p)[1] = concat ("-mmacosx-version-min=",
macosx_deployment_target, NULL);
@@ -144,7 +144,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p)
/* Add the new flag. */
++*argc_p;
- *argv_p = xmalloc (sizeof (char *) * *argc_p);
+ *argv_p = XNEWVEC (char *, *argc_p);
(*argv_p)[0] = argv[0];
(*argv_p)[1] = new_flag;
memcpy (*argv_p + 2, argv + 1, (argc - 1) * sizeof (char *));
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1848d55e2a9..2667d9e6977 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -11632,10 +11632,35 @@ ix86_build_signbit_mask (enum machine_mode mode, bool vect, bool invert)
case TImode:
case TFmode:
- imode = TImode;
vec_mode = VOIDmode;
- gcc_assert (HOST_BITS_PER_WIDE_INT >= 64);
- lo = 0, hi = (HOST_WIDE_INT)1 << shift;
+ if (HOST_BITS_PER_WIDE_INT >= 64)
+ {
+ imode = TImode;
+ lo = 0, hi = (HOST_WIDE_INT)1 << shift;
+ }
+ else
+ {
+ rtvec vec;
+
+ imode = DImode;
+ lo = 0, hi = (HOST_WIDE_INT)1 << (shift - HOST_BITS_PER_WIDE_INT);
+
+ if (invert)
+ {
+ lo = ~lo, hi = ~hi;
+ v = constm1_rtx;
+ }
+ else
+ v = const0_rtx;
+
+ mask = immed_double_const (lo, hi, imode);
+
+ vec = gen_rtvec (2, v, mask);
+ v = gen_rtx_CONST_VECTOR (V2DImode, vec);
+ v = copy_to_mode_reg (mode, gen_lowpart (mode, v));
+
+ return v;
+ }
break;
default:
@@ -21330,20 +21355,26 @@ ix86_init_builtins (void)
NULL, NULL_TREE);
ix86_builtins[(int) IX86_BUILTIN_INFQ] = decl;
- if (HOST_BITS_PER_WIDE_INT >= 64)
- {
- /* Those builtins need TImode to compile. */
- ftype = build_function_type_list (float128_type_node,
- float128_type_node,
- NULL_TREE);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ);
-
- ftype = build_function_type_list (float128_type_node,
- float128_type_node,
- float128_type_node,
- NULL_TREE);
- def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_copysignq", ftype, IX86_BUILTIN_COPYSIGNQ);
- }
+ /* We will expand them to normal call if SSE2 isn't available since
+ they are used by libgcc. */
+ ftype = build_function_type_list (float128_type_node,
+ float128_type_node,
+ NULL_TREE);
+ decl = add_builtin_function ("__builtin_fabsq", ftype,
+ IX86_BUILTIN_FABSQ, BUILT_IN_MD,
+ "__fabstf2", NULL_TREE);
+ ix86_builtins[(int) IX86_BUILTIN_FABSQ] = decl;
+ TREE_READONLY (decl) = 1;
+
+ ftype = build_function_type_list (float128_type_node,
+ float128_type_node,
+ float128_type_node,
+ NULL_TREE);
+ decl = add_builtin_function ("__builtin_copysignq", ftype,
+ IX86_BUILTIN_COPYSIGNQ, BUILT_IN_MD,
+ "__copysigntf3", NULL_TREE);
+ ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = decl;
+ TREE_READONLY (decl) = 1;
if (TARGET_MMX)
ix86_init_mmx_sse_builtins ();
@@ -22792,7 +22823,16 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
i < ARRAY_SIZE (bdesc_args);
i++, d++)
if (d->code == fcode)
- return ix86_expand_args_builtin (d, exp, target);
+ switch (fcode)
+ {
+ case IX86_BUILTIN_FABSQ:
+ case IX86_BUILTIN_COPYSIGNQ:
+ if (!TARGET_SSE2)
+ /* Emit a normal call if SSE2 isn't available. */
+ return expand_call (exp, target, ignore);
+ default:
+ return ix86_expand_args_builtin (d, exp, target);
+ }
for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
if (d->code == fcode)
diff --git a/gcc/config/i386/libgcc-x86_64-glibc.ver b/gcc/config/i386/libgcc-glibc.ver
index fa5d1a6dba2..be791745b43 100644
--- a/gcc/config/i386/libgcc-x86_64-glibc.ver
+++ b/gcc/config/i386/libgcc-glibc.ver
@@ -5,6 +5,20 @@
# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
%ifndef __x86_64__
+%exclude {
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%inherit GCC_3.0 GLIBC_2.0
GLIBC_2.0 {
# Sampling of DImode arithmetic used by (at least) i386 and m68k.
@@ -24,16 +38,18 @@ GLIBC_2.0 {
}
%endif
-% 128 bit long double support was introduced with GCC 4.3.0.
-% These lines make the symbols to get a @@GCC_4.3.0 attached.
+# 128 bit long double support was introduced with GCC 4.3.0 to 64bit
+# and with GCC 4.4.0 to 32bit. These lines make the symbols to get
+# a @@GCC_4.3.0 or @@GCC_4.4.0 attached.
-%ifdef __x86_64__
%exclude {
__addtf3
+ __divtc3
__divtf3
__eqtf2
__extenddftf2
__extendsftf2
+ __extendxftf2
__fixtfdi
__fixtfsi
__fixtfti
@@ -47,21 +63,45 @@ GLIBC_2.0 {
__floatunsitf
__floatuntitf
__getf2
+ __gttf2
__letf2
+ __lttf2
+ __multc3
__multf3
__negtf2
+ __netf2
+ __powitf2
__subtf3
__trunctfdf2
__trunctfsf2
+ __trunctfxf2
__unordtf2
}
+%ifdef __x86_64__
+# Those symbols had improper versions when they were added to gcc 4.3.0.
+# We corrected the default version to GCC_4.3.0. But we keep the old
+# version for backward binary compatibility.
+GCC_3.0 {
+ __gttf2
+ __lttf2
+ __netf2
+}
+
+GCC_4.0.0 {
+ __divtc3
+ __multc3
+ __powitf2
+}
+
GCC_4.3.0 {
__addtf3
+ __divtc3
__divtf3
__eqtf2
__extenddftf2
__extendsftf2
+ __extendxftf2
__fixtfdi
__fixtfsi
__fixtfti
@@ -75,12 +115,51 @@ GCC_4.3.0 {
__floatunsitf
__floatuntitf
__getf2
+ __gttf2
+ __letf2
+ __lttf2
+ __multc3
+ __multf3
+ __negtf2
+ __netf2
+ __powitf2
+ __subtf3
+ __trunctfdf2
+ __trunctfsf2
+ __trunctfxf2
+ __unordtf2
+}
+%else
+GCC_4.4.0 {
+ __addtf3
+ __copysigntf3
+ __divtc3
+ __divtf3
+ __eqtf2
+ __extenddftf2
+ __extendsftf2
+ __fabstf2
+ __fixtfdi
+ __fixtfsi
+ __fixunstfdi
+ __fixunstfsi
+ __floatditf
+ __floatsitf
+ __floatunditf
+ __floatunsitf
+ __getf2
+ __gttf2
__letf2
+ __lttf2
+ __multc3
__multf3
__negtf2
+ __netf2
+ __powitf2
__subtf3
__trunctfdf2
__trunctfsf2
+ __trunctfxf2
__unordtf2
}
%endif
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index ec5dc4e2230..78326b05ec0 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -189,6 +189,12 @@ along with GCC; see the file COPYING3. If not see
: "=d"(BASE))
#endif
+/* Put all *tf routines in libgcc. */
+#undef LIBGCC2_HAS_TF_MODE
+#define LIBGCC2_HAS_TF_MODE 1
+#define LIBGCC2_TF_CEXT q
+#define TF_SIZE 113
+
#undef NEED_INDICATE_EXEC_STACK
#define NEED_INDICATE_EXEC_STACK 1
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 37ede613e7d..04d12cadada 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -91,7 +91,7 @@ along with GCC; see the file COPYING3. If not see
/* Put all *tf routines in libgcc. */
#undef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE TARGET_64BIT
+#define LIBGCC2_HAS_TF_MODE 1
#define LIBGCC2_TF_CEXT q
#define TF_SIZE 113
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 7628896bc6a..f5abe789977 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -160,9 +160,8 @@ do { \
#undef TARGET_N_FORMAT_TYPES
#define TARGET_N_FORMAT_TYPES 3
-/* JCR_SECTION works on mingw32. */
+/* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */
#undef TARGET_USE_JCR_SECTION
-#define TARGET_USE_JCR_SECTION 1
#undef MINGW_ENABLE_EXECUTE_STACK
#define MINGW_ENABLE_EXECUTE_STACK \
diff --git a/gcc/config/i386/netware.c b/gcc/config/i386/netware.c
index 63c26cc7551..7f040d4b0e0 100644
--- a/gcc/config/i386/netware.c
+++ b/gcc/config/i386/netware.c
@@ -77,7 +77,7 @@ gen_stdcall_or_fastcall_decoration (tree decl, tree id, char prefix)
}
}
- new_str = alloca (1 + strlen (old_str) + 1 + 10 + 1);
+ new_str = XALLOCAVEC (char, 1 + strlen (old_str) + 1 + 10 + 1);
sprintf (new_str, "%c%s@" HOST_WIDE_INT_PRINT_UNSIGNED,
prefix, old_str, total);
@@ -132,7 +132,7 @@ gen_regparm_prefix (tree decl, tree id, unsigned int nregs)
if (nregs > total / UNITS_PER_WORD)
nregs = total / UNITS_PER_WORD;
gcc_assert (nregs <= 9);
- new_str = alloca (3 + strlen (old_str) + 1);
+ new_str = XALLOCAVEC (char, 3 + strlen (old_str) + 1);
sprintf (new_str, "_%u@%s", nregs, old_str);
return get_identifier (new_str);
diff --git a/gcc/config/i386/sfp-machine.h b/gcc/config/i386/sfp-machine.h
index 190e3cb0e81..f2df869653f 100644
--- a/gcc/config/i386/sfp-machine.h
+++ b/gcc/config/i386/sfp-machine.h
@@ -1,143 +1,5 @@
-#define _FP_W_TYPE_SIZE 64
-#define _FP_W_TYPE unsigned long
-#define _FP_WS_TYPE signed long
-#define _FP_I_TYPE long
-
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-
-#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
-
-/* The type of the result of a floating point comparison. This must
- match `__libgcc_cmp_return__' in GCC for the target. */
-typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
-#define CMPtype __gcc_CMPtype
-
-#define _FP_MUL_MEAT_Q(R,X,Y) \
- _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
-
-#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
-
-#define _FP_NANFRAC_S _FP_QNANBIT_S
-#define _FP_NANFRAC_D _FP_QNANBIT_D
-#define _FP_NANFRAC_E _FP_QNANBIT_E, 0
-#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0
-#define _FP_NANSIGN_S 1
-#define _FP_NANSIGN_D 1
-#define _FP_NANSIGN_E 1
-#define _FP_NANSIGN_Q 1
-
-#define _FP_KEEPNANFRACP 1
-
-/* Here is something Intel misdesigned: the specs don't define
- the case where we have two NaNs with same mantissas, but
- different sign. Different operations pick up different NaNs. */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
- do { \
- if (_FP_FRAC_GT_##wc(X, Y) \
- || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \
- { \
- R##_s = X##_s; \
- _FP_FRAC_COPY_##wc(R,X); \
- } \
- else \
- { \
- R##_s = Y##_s; \
- _FP_FRAC_COPY_##wc(R,Y); \
- } \
- R##_c = FP_CLS_NAN; \
- } while (0)
-
-#define FP_EX_INVALID 0x01
-#define FP_EX_DENORM 0x02
-#define FP_EX_DIVZERO 0x04
-#define FP_EX_OVERFLOW 0x08
-#define FP_EX_UNDERFLOW 0x10
-#define FP_EX_INEXACT 0x20
-
-struct fenv
-{
- unsigned short int __control_word;
- unsigned short int __unused1;
- unsigned short int __status_word;
- unsigned short int __unused2;
- unsigned short int __tags;
- unsigned short int __unused3;
- unsigned int __eip;
- unsigned short int __cs_selector;
- unsigned int __opcode:11;
- unsigned int __unused4:5;
- unsigned int __data_offset;
- unsigned short int __data_selector;
- unsigned short int __unused5;
-};
-
-#define FP_HANDLE_EXCEPTIONS \
- do { \
- if (_fex & FP_EX_INVALID) \
- { \
- float f = 0.0; \
- __asm__ __volatile__ ("divss %0, %0 " : : "x" (f)); \
- } \
- if (_fex & FP_EX_DIVZERO) \
- { \
- float f = 1.0, g = 0.0; \
- __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g)); \
- } \
- if (_fex & FP_EX_OVERFLOW) \
- { \
- struct fenv temp; \
- __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
- temp.__status_word |= FP_EX_OVERFLOW; \
- __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
- __asm__ __volatile__ ("fwait"); \
- } \
- if (_fex & FP_EX_UNDERFLOW) \
- { \
- struct fenv temp; \
- __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
- temp.__status_word |= FP_EX_UNDERFLOW; \
- __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
- __asm__ __volatile__ ("fwait"); \
- } \
- if (_fex & FP_EX_INEXACT) \
- { \
- struct fenv temp; \
- __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
- temp.__status_word |= FP_EX_INEXACT; \
- __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
- __asm__ __volatile__ ("fwait"); \
- } \
- } while (0)
-
-#define FP_RND_NEAREST 0
-#define FP_RND_ZERO 0xc00
-#define FP_RND_PINF 0x800
-#define FP_RND_MINF 0x400
-
-#define _FP_DECL_EX \
- unsigned short _fcw __attribute__ ((unused)) = FP_RND_NEAREST
-
-#define FP_INIT_ROUNDMODE \
- do { \
- __asm__ ("fnstcw %0" : "=m" (_fcw)); \
- } while (0)
-
-#define FP_ROUNDMODE (_fcw & 0xc00)
-
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-
-#define __BYTE_ORDER __LITTLE_ENDIAN
-
-/* Define ALIASNAME as a strong alias for NAME. */
-#if defined __MACH__
-/* Mach-O doesn't support aliasing. If these functions ever return
- anything but CMPtype we need to revisit this... */
-#define strong_alias(name, aliasname) \
- CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
+#ifdef __x86_64__
+#include "config/i386/64/sfp-machine.h"
#else
-# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
-# define _strong_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#include "config/i386/32/sfp-machine.h"
#endif
diff --git a/gcc/config/i386/t-darwin b/gcc/config/i386/t-darwin
index 6feb48a20a4..fb5bbe78c04 100644
--- a/gcc/config/i386/t-darwin
+++ b/gcc/config/i386/t-darwin
@@ -2,6 +2,3 @@ MULTILIB_OPTIONS = m64
MULTILIB_DIRNAMES = x86_64
LIB2_SIDITI_CONV_FUNCS=yes
LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c
-
-softfp_wrap_start := '\#ifdef __x86_64__'
-softfp_wrap_end := '\#endif'
diff --git a/gcc/config/i386/t-darwin64 b/gcc/config/i386/t-darwin64
index 2e55cb786d7..5143e3819dc 100644
--- a/gcc/config/i386/t-darwin64
+++ b/gcc/config/i386/t-darwin64
@@ -1,5 +1,2 @@
LIB2_SIDITI_CONV_FUNCS=yes
LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c
-
-softfp_wrap_start := '\#ifdef __x86_64__'
-softfp_wrap_end := '\#endif'
diff --git a/gcc/config/i386/t-fprules-softfp64 b/gcc/config/i386/t-fprules-softfp
index 0b0068f9053..0b0068f9053 100644
--- a/gcc/config/i386/t-fprules-softfp64
+++ b/gcc/config/i386/t-fprules-softfp
diff --git a/gcc/config/i386/t-linux b/gcc/config/i386/t-linux
new file mode 100644
index 00000000000..4c6bb51e3b8
--- /dev/null
+++ b/gcc/config/i386/t-linux
@@ -0,0 +1,5 @@
+# On 64bit we do not need any exports for glibc for 64-bit libgcc_s.
+# Need to support TImode for x86. Override the settings from
+# t-slibgcc-elf-ver and t-linux
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
+ $(srcdir)/config/i386/libgcc-glibc.ver
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 0490d7812e1..36378d87e0b 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -1,9 +1,3 @@
-# On x86-64 we do not need any exports for glibc for 64-bit libgcc_s,
-# override the settings
-# from t-slibgcc-elf-ver and t-linux
-SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
- $(srcdir)/config/i386/libgcc-x86_64-glibc.ver
-
# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
# /lib and /usr/lib, while other distributions install libraries into /lib64
@@ -21,6 +15,3 @@ INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o \
crtbeginT.o crtprec32.o crtprec64.o crtprec80.o \
crtfastmath.o
-
-softfp_wrap_start := '\#ifdef __x86_64__'
-softfp_wrap_end := '\#endif'
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index d1928f6b3c7..de39ab12946 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -781,6 +781,8 @@ ia64_legitimate_constant_p (rtx x)
static bool
ia64_cannot_force_const_mem (rtx x)
{
+ if (GET_MODE (x) == RFmode)
+ return true;
return tls_symbolic_operand_type (x) != 0;
}
diff --git a/gcc/config/libgcc-glibc.ver b/gcc/config/libgcc-glibc.ver
index 837c1a7ee56..264828b17c0 100644
--- a/gcc/config/libgcc-glibc.ver
+++ b/gcc/config/libgcc-glibc.ver
@@ -4,6 +4,20 @@
# maintain enough binary compatibility to allow future versions of glibc
# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
+%exclude {
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%inherit GCC_3.0 GLIBC_2.0
GLIBC_2.0 {
# Sampling of DImode arithmetic used by (at least) i386 and m68k.
diff --git a/gcc/config/m32r/libgcc-glibc.ver b/gcc/config/m32r/libgcc-glibc.ver
index 450c4b60e92..977c3346604 100644
--- a/gcc/config/m32r/libgcc-glibc.ver
+++ b/gcc/config/m32r/libgcc-glibc.ver
@@ -8,6 +8,16 @@
# because GLIBC_2.0 does not exist on this architecture, as the first
# ever glibc release on the platform was GLIBC_2.3.
+%exclude {
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%inherit GCC_3.0 GLIBC_2.3
GLIBC_2.3 {
__register_frame
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 0529a86a68c..238d35276e4 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -694,8 +694,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
orig = XEXP (XEXP (orig, 0), 0);
/* Extract CODE_LABEL. */
orig = XEXP (orig, 0);
- REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, orig,
- REG_NOTES (insn));
+ add_reg_note (insn, REG_LABEL_OPERAND, orig);
LABEL_NUSES (orig)++;
}
crtl->uses_pic_offset_table = 1;
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 4833ad76d91..214b6922b5c 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -22332,7 +22332,6 @@ rs6000_is_opaque_type (const_tree type)
{
return (type == opaque_V2SI_type_node
|| type == opaque_V2SF_type_node
- || type == opaque_p_V2SI_type_node
|| type == opaque_V4SI_type_node);
}
diff --git a/gcc/config/s390/libgcc-glibc.ver b/gcc/config/s390/libgcc-glibc.ver
index e9413d0fff1..ab6eedcf683 100644
--- a/gcc/config/s390/libgcc-glibc.ver
+++ b/gcc/config/s390/libgcc-glibc.ver
@@ -9,6 +9,20 @@
# ever glibc release on the platform was GLIBC_2.2.
%ifndef __s390x__
+%exclude {
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%inherit GCC_3.0 GLIBC_2.0
GLIBC_2.0 {
__divdi3
@@ -27,6 +41,16 @@ GLIBC_2.0 {
%endif
%ifdef __s390x__
+%exclude {
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%inherit GCC_3.0 GLIBC_2.2
GLIBC_2.2 {
__register_frame
diff --git a/gcc/config/sh/libgcc-glibc.ver b/gcc/config/sh/libgcc-glibc.ver
index 734d3d6bfe1..11ef379effa 100644
--- a/gcc/config/sh/libgcc-glibc.ver
+++ b/gcc/config/sh/libgcc-glibc.ver
@@ -8,6 +8,16 @@
# because GLIBC_2.0 does not exist on this architecture, as the first
# ever glibc release on the platform was GLIBC_2.2.
+%exclude {
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%inherit GCC_3.0 GLIBC_2.2
GLIBC_2.2 {
__register_frame
@@ -18,4 +28,3 @@ GLIBC_2.2 {
__frame_state_for
__register_frame_info_table
}
-
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 71419ec61de..380705104ee 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -4983,10 +4983,8 @@ sh_reorg (void)
or pseudo-op. */
label = gen_label_rtx ();
- REG_NOTES (link) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, label,
- REG_NOTES (link));
- REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, label,
- REG_NOTES (insn));
+ add_reg_note (link, REG_LABEL_OPERAND, label);
+ add_reg_note (insn, REG_LABEL_OPERAND, label);
if (rescan)
{
scan = link;
@@ -5000,9 +4998,7 @@ sh_reorg (void)
&& reg_mentioned_p (reg, scan))
|| ((reg2 = sfunc_uses_reg (scan))
&& REGNO (reg2) == REGNO (reg))))
- REG_NOTES (scan)
- = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, label,
- REG_NOTES (scan));
+ add_reg_note (scan, REG_LABEL_OPERAND, label);
}
while (scan != dies);
}
diff --git a/gcc/config/sparc/libgcc-sparc-glibc.ver b/gcc/config/sparc/libgcc-sparc-glibc.ver
index ed280fe05a7..8f50c0d5886 100644
--- a/gcc/config/sparc/libgcc-sparc-glibc.ver
+++ b/gcc/config/sparc/libgcc-sparc-glibc.ver
@@ -4,6 +4,20 @@
# maintain enough binary compatibility to allow future versions of glibc
# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
+%exclude {
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
%ifdef __arch64__
%define GLIBC_VER GLIBC_2.2
%else
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dd40a292005..3bf8c97596d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,83 @@
+2008-07-02 Jason Merrill <jason@redhat.com>
+
+ Implement WG21 N2672, Initializer List proposed wording
+ * cp-tree.h (enum cp_tree_index): Add CPTI_INIT_LIST_TYPE.
+ (struct lang_type_class): Add has_list_ctor bitfield.
+ (TYPE_HAS_LIST_CTOR): New macro.
+ (BRACE_ENCLOSED_INITIALIZER_P): Expect init_list_type_node.
+ (CONSTRUCTOR_IS_DIRECT_INIT): New macro.
+ (LOOKUP_NO_NARROWING): New macro.
+ (LOOKUP_NO_COPY_CTOR_CONVERSION): New macro.
+ * parser.c (cp_parse_braced_list): Split out from...
+ (cp_parser_initializer_clause): ...here.
+ (cp_parser_postfix_expression): Build up CONSTRUCTOR for compound
+ literal here.
+ (cp_lexer_next_token_is_not_keyword): New fn.
+ (cp_parser_parenthesized_expression_list): Handle { }.
+ (cp_parser_new_expression, cp_parser_new_initializer): Likewise.
+ (cp_parser_assignment_expression, cp_parser_condition): Likewise.
+ (cp_parser_jump_statement, cp_parser_simple_declaration): Likewise.
+ (cp_parser_mem_initializer, cp_parser_init_declarator): Likewise.
+ (cp_parser_initializer, cp_parser_functional_cast): Likewise.
+ (cp_parser_omp_for_loop, cp_parser_cache_group): Likewise.
+ (cp_parser_save_member_function_body): Likewise.
+ * call.c (conversion_kind): Add ck_list, ck_aggr.
+ (struct conversion): Add check_narrowing bitfield, conversion list.
+ (build_list_conv): New fn.
+ (build_aggr_conv): New fn.
+ (implicit_conversion): Call them.
+ (standard_conversion): Set check_narrowing if appropriate.
+ (add_function_candidate): Handle LOOKUP_NO_COPY_CTOR_CONVERSION.
+ (build_user_type_conversion_1): When converting from an init list,
+ we allow additional conversions except when calling a copy ctor.
+ (convert_like_real): Calling an explicit ctor for an init list is
+ ill-formed. Handle ck_list and ck_addr. Check narrowing.
+ (build_new_method_call): If CONSTRUCTOR_IS_DIRECT_INIT is set and
+ class doesn't have a list ctor, break the {} into a TREE_LIST.
+ (compare_ics): ck_list is better than other UDCs.
+ (set_up_extended_ref_temp): Split out from initialize_reference.
+ (is_std_init_list): New fn.
+ (is_list_ctor): New fn.
+ * decl.c (cxx_init_decl_processing): Create init_list_type_node.
+ (reshape_init_array_1): Pass it to build_constructor.
+ (reshape_init_class): Ditto.
+ (initialize_artificial_var): Pass the appropriate type.
+ (build_aggr_init_full_exprs): Split out from...
+ (check_initializer): ...here. Handle new semantics.
+ (build_init_list_var_init): New subroutine of check_initializer.
+ (grokdeclarator): Converting constructors can have more than one parm.
+ (grok_special_member_properties): Set TYPE_HAS_LIST_CTOR.
+ * init.c (expand_default_init): Only do digest_init for aggregates.
+ * rtti.c (tinfo_base_init): Pass init_list_type_node to
+ build_constructor_from_list.
+ (generic_initializer, ptr_initializer): Ditto.
+ (ptm_initializer, class_initializer): Ditto.
+ (get_pseudo_ti_init): Ditto.
+ * error.c (dump_type): Handle init_list_type_node.
+ (maybe_warn_cpp0x): New fn.
+ (maybe_varn_variadic_templates): Call it.
+ * cvt.c (ocp_convert): Handle conversion from { }.
+ * tree.c (build_array_of_n_type): New fn.
+ * typeck2.c (store_init_value): Use init_list_type_node.
+ (digest_init): Likewise.
+ (check_narrowing): New fn.
+ * semantics.c: (finish_compound_literal): Take CONSTRUCTOR instead
+ of vector of constructor elts. Handle non-aggregate types. Make
+ constant literals static.
+ * pt.c: (tsubst_copy_and_build): Adjust.
+ (unify): Handle { }.
+ * name-lookup.c (arg_assoc_type): Handle init_list_type_node.
+
+2008-07-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * typeck.c (comp_ptr_ttypes_real): Use vector_targets_convertible_p.
+ (comp_ptr_ttypes_const): Likewise.
+
+2008-07-01 Andrew Haley <aph@redhat.com>
+
+ * decl.c (finish_constructor_body): Don't set the return value of
+ the constructor if the constructor is that of a Java type.
+
2008-06-30 Jakub Jelinek <jakub@redhat.com>
PR c++/36662
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 7f4c0168483..d41465db638 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -54,6 +54,8 @@ typedef enum conversion_kind {
ck_ref_bind,
ck_user,
ck_ambig,
+ ck_list,
+ ck_aggr,
ck_rvalue
} conversion_kind;
@@ -96,6 +98,7 @@ struct conversion {
being bound to an lvalue expression or an rvalue reference is
being bound to an rvalue expression. */
BOOL_BITFIELD rvaluedness_matches_p: 1;
+ BOOL_BITFIELD check_narrowing: 1;
/* The type of the expression resulting from the conversion. */
tree type;
union {
@@ -107,6 +110,8 @@ struct conversion {
/* The expression at the beginning of the conversion chain. This
variant is used only if KIND is ck_identity or ck_ambig. */
tree expr;
+ /* The array of conversions for an initializer_list. */
+ conversion **list;
} u;
/* The function candidate corresponding to this conversion
sequence. This field is only used if KIND is ck_user. */
@@ -174,6 +179,7 @@ static conversion *implicit_conversion (tree, tree, tree, bool, int);
static conversion *standard_conversion (tree, tree, tree, bool, int);
static conversion *reference_binding (tree, tree, tree, bool, int);
static conversion *build_conv (conversion_kind, tree, conversion *);
+static conversion *build_list_conv (tree, tree, int);
static bool is_subseq (conversion *, conversion *);
static conversion *maybe_handle_ref_bind (conversion **);
static void maybe_handle_implicit_object (conversion **);
@@ -529,9 +535,8 @@ build_conv (conversion_kind code, tree type, conversion *from)
conversion *t;
conversion_rank rank = CONVERSION_RANK (from);
- /* We can't use buildl1 here because CODE could be USER_CONV, which
- takes two arguments. In that case, the caller is responsible for
- filling in the second argument. */
+ /* Note that the caller is responsible for filling in t->cand for
+ user-defined conversions. */
t = alloc_conversion (code);
t->type = type;
t->u.next = from;
@@ -561,6 +566,83 @@ build_conv (conversion_kind code, tree type, conversion *from)
return t;
}
+/* Represent a conversion from CTOR, a braced-init-list, to TYPE, a
+ specialization of std::initializer_list<T>, if such a conversion is
+ possible. */
+
+static conversion *
+build_list_conv (tree type, tree ctor, int flags)
+{
+ tree elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (type), 0);
+ unsigned len = CONSTRUCTOR_NELTS (ctor);
+ conversion **subconvs = alloc_conversions (len);
+ conversion *t;
+ unsigned i;
+ tree val;
+
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)
+ {
+ conversion *sub
+ = implicit_conversion (elttype, TREE_TYPE (val), val,
+ false, flags);
+ if (sub == NULL)
+ return NULL;
+
+ subconvs[i] = sub;
+ }
+
+ t = alloc_conversion (ck_list);
+ t->type = type;
+ t->u.list = subconvs;
+ t->rank = cr_exact;
+
+ for (i = 0; i < len; ++i)
+ {
+ conversion *sub = subconvs[i];
+ if (sub->rank > t->rank)
+ t->rank = sub->rank;
+ if (sub->user_conv_p)
+ t->user_conv_p = true;
+ if (sub->bad_p)
+ t->bad_p = true;
+ }
+
+ return t;
+}
+
+/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an
+ aggregate class, if such a conversion is possible. */
+
+static conversion *
+build_aggr_conv (tree type, tree ctor, int flags)
+{
+ unsigned HOST_WIDE_INT i = 0;
+ conversion *c;
+ tree field = TYPE_FIELDS (type);
+
+ for (; field; field = TREE_CHAIN (field))
+ {
+ if (TREE_CODE (field) != FIELD_DECL)
+ continue;
+ if (i < CONSTRUCTOR_NELTS (ctor))
+ {
+ constructor_elt *ce = CONSTRUCTOR_ELT (ctor, i);
+ if (!can_convert_arg (TREE_TYPE (field), TREE_TYPE (ce->value),
+ ce->value, flags))
+ return NULL;
+ }
+ else if (build_value_init (TREE_TYPE (field)) == error_mark_node)
+ return NULL;
+ }
+
+ c = alloc_conversion (ck_aggr);
+ c->type = type;
+ c->rank = cr_exact;
+ c->user_conv_p = true;
+ c->u.next = NULL;
+ return c;
+}
+
/* Build a representation of the identity conversion from EXPR to
itself. The TYPE should match the type of EXPR, if EXPR is non-NULL. */
@@ -865,6 +947,9 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
else
return NULL;
+ if (flags & LOOKUP_NO_NARROWING)
+ conv->check_narrowing = true;
+
return conv;
}
@@ -1296,6 +1381,10 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
if (conv)
return conv;
+ if (is_std_init_list (to) && expr
+ && BRACE_ENCLOSED_INITIALIZER_P (expr))
+ return build_list_conv (to, expr, flags);
+
if (expr != NULL_TREE
&& (MAYBE_CLASS_TYPE_P (from)
|| MAYBE_CLASS_TYPE_P (to))
@@ -1305,6 +1394,11 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
int convflags = ((flags & LOOKUP_NO_TEMP_BIND)
|LOOKUP_ONLYCONVERTING);
+ if (CLASS_TYPE_P (to)
+ && !CLASSTYPE_NON_AGGREGATE (complete_type (to))
+ && BRACE_ENCLOSED_INITIALIZER_P (expr))
+ return build_aggr_conv (to, expr, flags);
+
cand = build_user_type_conversion_1 (to, expr, convflags);
if (cand)
conv = cand->second_conv;
@@ -1431,6 +1525,7 @@ add_function_candidate (struct z_candidate **candidates,
if (parmnode)
{
tree parmtype = TREE_VALUE (parmnode);
+ int lflags = flags;
/* The type of the implicit object parameter ('this') for
overload resolution is not always the same as for the
@@ -1449,8 +1544,12 @@ add_function_candidate (struct z_candidate **candidates,
parmtype = build_pointer_type (parmtype);
}
+ if ((flags & LOOKUP_NO_COPY_CTOR_CONVERSION)
+ && ctype && i == 0 && DECL_COPY_CONSTRUCTOR_P (fn))
+ lflags |= LOOKUP_NO_CONVERSION;
+
t = implicit_conversion (parmtype, argtype, arg,
- /*c_cast_p=*/false, flags);
+ /*c_cast_p=*/false, lflags);
}
else
{
@@ -2607,7 +2706,18 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
ctors = BASELINK_FUNCTIONS (ctors);
t = build_int_cst (build_pointer_type (totype), 0);
- args = build_tree_list (NULL_TREE, expr);
+ if (BRACE_ENCLOSED_INITIALIZER_P (expr)
+ && !TYPE_HAS_LIST_CTOR (totype))
+ {
+ args = ctor_to_list (expr);
+ /* We still allow more conversions within an init-list. */
+ flags = ((flags & ~LOOKUP_NO_CONVERSION)
+ /* But not for the copy ctor. */
+ |LOOKUP_NO_COPY_CTOR_CONVERSION
+ |LOOKUP_NO_NARROWING);
+ }
+ else
+ args = build_tree_list (NULL_TREE, expr);
/* We should never try to call the abstract or base constructor
from here. */
gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors))
@@ -2617,7 +2727,8 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
for (; ctors; ctors = OVL_NEXT (ctors))
{
tree ctor = OVL_CURRENT (ctors);
- if (DECL_NONCONVERTING_P (ctor))
+ if (DECL_NONCONVERTING_P (ctor)
+ && !BRACE_ENCLOSED_INITIALIZER_P (expr))
continue;
if (TREE_CODE (ctor) == TEMPLATE_DECL)
@@ -4443,6 +4554,17 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
tree convfn = cand->fn;
unsigned i;
+ /* When converting from an init list we consider explicit
+ constructors, but actually trying to call one is an error. */
+ if (DECL_NONCONVERTING_P (convfn))
+ {
+ if (complain & tf_error)
+ error ("converting to %qT from initializer list would use "
+ "explicit constructor %qD", totype, convfn);
+ else
+ return error_mark_node;
+ }
+
/* Set user_conv_p on the argument conversions, so rvalue/base
handling knows not to allow any more UDCs. */
for (i = 0; i < cand->num_convs; ++i)
@@ -4478,6 +4600,44 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
return build_user_type_conversion
(totype, convs->u.expr, LOOKUP_NORMAL);
+ case ck_list:
+ {
+ /* Conversion to std::initializer_list<T>. */
+ tree elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (totype), 0);
+ tree new_ctor = build_constructor (init_list_type_node, NULL);
+ unsigned len = CONSTRUCTOR_NELTS (expr);
+ tree array, parms, val;
+ unsigned ix;
+
+ /* Convert all the elements. */
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expr), ix, val)
+ {
+ tree sub = convert_like_real (convs->u.list[ix], val, fn, argnum,
+ 1, false, false, complain);
+ if (sub == error_mark_node)
+ return sub;
+ check_narrowing (TREE_TYPE (sub), val);
+ CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_ctor), NULL_TREE, sub);
+ }
+ /* Build up the array. */
+ elttype = cp_build_qualified_type
+ (elttype, TYPE_QUALS (elttype) | TYPE_QUAL_CONST);
+ array = build_array_of_n_type (elttype, len);
+ array = finish_compound_literal (array, new_ctor);
+
+ parms = build_tree_list (NULL_TREE, size_int (len));
+ parms = tree_cons (NULL_TREE, decay_conversion (array), parms);
+ /* Call the private constructor. */
+ push_deferring_access_checks (dk_no_check);
+ new_ctor = build_special_member_call
+ (NULL_TREE, complete_ctor_identifier, parms, totype, 0, complain);
+ pop_deferring_access_checks ();
+ return build_cplus_new (totype, new_ctor);
+ }
+
+ case ck_aggr:
+ return get_target_expr (digest_init (totype, expr));
+
default:
break;
};
@@ -4625,6 +4785,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
break;
}
+ if (convs->check_narrowing)
+ check_narrowing (totype, expr);
+
if (issue_conversion_warnings)
expr = convert_and_check (totype, expr);
else
@@ -5626,6 +5789,18 @@ build_new_method_call (tree instance, tree fns, tree args,
if (DECL_DESTRUCTOR_P (fn))
name = complete_dtor_identifier;
+ /* If CONSTRUCTOR_IS_DIRECT_INIT is set, this was a T{ } form
+ initializer, not T({ }). If the type doesn't have a list ctor,
+ break apart the list into separate ctor args. */
+ if (DECL_CONSTRUCTOR_P (fn) && args
+ && BRACE_ENCLOSED_INITIALIZER_P (TREE_VALUE (args))
+ && CONSTRUCTOR_IS_DIRECT_INIT (TREE_VALUE (args))
+ && !TYPE_HAS_LIST_CTOR (basetype))
+ {
+ gcc_assert (TREE_CHAIN (args) == NULL_TREE);
+ args = ctor_to_list (TREE_VALUE (args));
+ }
+
class_type = (conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE);
mem_args = tree_cons (NULL_TREE, instance_ptr, args);
@@ -5977,13 +6152,26 @@ compare_ics (conversion *ics1, conversion *ics2)
conversion *t1;
conversion *t2;
- for (t1 = ics1; t1->kind != ck_user; t1 = t1->u.next)
- if (t1->kind == ck_ambig)
+ for (t1 = ics1; t1->kind != ck_user && t1->kind != ck_list; t1 = t1->u.next)
+ if (t1->kind == ck_ambig || t1->kind == ck_aggr)
return 0;
- for (t2 = ics2; t2->kind != ck_user; t2 = t2->u.next)
- if (t2->kind == ck_ambig)
+ for (t2 = ics2; t2->kind != ck_user && t2->kind != ck_list; t2 = t2->u.next)
+ if (t2->kind == ck_ambig || t2->kind == ck_aggr)
return 0;
+ /* Conversion to std::initializer_list is better than other
+ user-defined conversions. */
+ if (t1->kind == ck_list
+ || t2->kind == ck_list)
+ {
+ if (t2->kind != ck_list)
+ return 1;
+ else if (t1->kind != ck_list)
+ return -1;
+ else
+ return 0;
+ }
+
if (t1->cand->fn != t2->cand->fn)
return 0;
@@ -6815,6 +7003,76 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
return var;
}
+/* EXPR is the initializer for a variable DECL of reference or
+ std::initializer_list type. Create, push and return a new VAR_DECL
+ for the initializer so that it will live as long as DECL. Any
+ cleanup for the new variable is returned through CLEANUP, and the
+ code to initialize the new variable is returned through INITP. */
+
+tree
+set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
+{
+ tree init;
+ tree type;
+ tree var;
+
+ /* Create the temporary variable. */
+ type = TREE_TYPE (expr);
+ var = make_temporary_var_for_ref_to_temp (decl, type);
+ layout_decl (var, 0);
+ /* If the rvalue is the result of a function call it will be
+ a TARGET_EXPR. If it is some other construct (such as a
+ member access expression where the underlying object is
+ itself the result of a function call), turn it into a
+ TARGET_EXPR here. It is important that EXPR be a
+ TARGET_EXPR below since otherwise the INIT_EXPR will
+ attempt to make a bitwise copy of EXPR to initialize
+ VAR. */
+ if (TREE_CODE (expr) != TARGET_EXPR)
+ expr = get_target_expr (expr);
+ /* Create the INIT_EXPR that will initialize the temporary
+ variable. */
+ init = build2 (INIT_EXPR, type, var, expr);
+ if (at_function_scope_p ())
+ {
+ add_decl_expr (var);
+
+ if (TREE_STATIC (var))
+ init = add_stmt_to_compound (init, register_dtor_fn (var));
+ else
+ *cleanup = cxx_maybe_build_cleanup (var);
+
+ /* We must be careful to destroy the temporary only
+ after its initialization has taken place. If the
+ initialization throws an exception, then the
+ destructor should not be run. We cannot simply
+ transform INIT into something like:
+
+ (INIT, ({ CLEANUP_STMT; }))
+
+ because emit_local_var always treats the
+ initializer as a full-expression. Thus, the
+ destructor would run too early; it would run at the
+ end of initializing the reference variable, rather
+ than at the end of the block enclosing the
+ reference variable.
+
+ The solution is to pass back a cleanup expression
+ which the caller is responsible for attaching to
+ the statement tree. */
+ }
+ else
+ {
+ rest_of_decl_compilation (var, /*toplev=*/1, at_eof);
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ static_aggregates = tree_cons (NULL_TREE, var,
+ static_aggregates);
+ }
+
+ *initp = init;
+ return var;
+}
+
/* Convert EXPR to the indicated reference TYPE, in a way suitable for
initializing a variable of that TYPE. If DECL is non-NULL, it is
the VAR_DECL being initialized with the EXPR. (In that case, the
@@ -6919,60 +7177,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
if (!real_lvalue_p (expr))
{
tree init;
- tree type;
-
- /* Create the temporary variable. */
- type = TREE_TYPE (expr);
- var = make_temporary_var_for_ref_to_temp (decl, type);
- layout_decl (var, 0);
- /* If the rvalue is the result of a function call it will be
- a TARGET_EXPR. If it is some other construct (such as a
- member access expression where the underlying object is
- itself the result of a function call), turn it into a
- TARGET_EXPR here. It is important that EXPR be a
- TARGET_EXPR below since otherwise the INIT_EXPR will
- attempt to make a bitwise copy of EXPR to initialize
- VAR. */
- if (TREE_CODE (expr) != TARGET_EXPR)
- expr = get_target_expr (expr);
- /* Create the INIT_EXPR that will initialize the temporary
- variable. */
- init = build2 (INIT_EXPR, type, var, expr);
- if (at_function_scope_p ())
- {
- add_decl_expr (var);
-
- if (TREE_STATIC (var))
- init = add_stmt_to_compound (init, register_dtor_fn (var));
- else
- *cleanup = cxx_maybe_build_cleanup (var);
-
- /* We must be careful to destroy the temporary only
- after its initialization has taken place. If the
- initialization throws an exception, then the
- destructor should not be run. We cannot simply
- transform INIT into something like:
-
- (INIT, ({ CLEANUP_STMT; }))
-
- because emit_local_var always treats the
- initializer as a full-expression. Thus, the
- destructor would run too early; it would run at the
- end of initializing the reference variable, rather
- than at the end of the block enclosing the
- reference variable.
-
- The solution is to pass back a cleanup expression
- which the caller is responsible for attaching to
- the statement tree. */
- }
- else
- {
- rest_of_decl_compilation (var, /*toplev=*/1, at_eof);
- if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
- static_aggregates = tree_cons (NULL_TREE, var,
- static_aggregates);
- }
+ var = set_up_extended_ref_temp (decl, expr, cleanup, &init);
/* Use its address to initialize the reference variable. */
expr = build_address (var);
if (base_conv_type)
@@ -7003,4 +7208,39 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
return expr;
}
+/* Returns true iff TYPE is some variant of std::initializer_list. */
+
+bool
+is_std_init_list (tree type)
+{
+ return (CLASS_TYPE_P (type)
+ && CP_TYPE_CONTEXT (type) == std_node
+ && strcmp (TYPE_NAME_STRING (type), "initializer_list") == 0);
+}
+
+/* Returns true iff DECL is a list constructor: i.e. a constructor which
+ will accept an argument list of a single std::initializer_list<T>. */
+
+bool
+is_list_ctor (tree decl)
+{
+ tree args = FUNCTION_FIRST_USER_PARMTYPE (decl);
+ tree arg;
+
+ if (!args || args == void_list_node)
+ return false;
+
+ arg = non_reference (TREE_VALUE (args));
+ if (!is_std_init_list (arg))
+ return false;
+
+ args = TREE_CHAIN (args);
+
+ if (args && args != void_list_node && !TREE_PURPOSE (args))
+ /* There are more non-defaulted parms. */
+ return false;
+
+ return true;
+}
+
#include "gt-cp-call.h"
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d090d8ff0e2..ed6ae0e810a 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -59,6 +59,7 @@ struct diagnostic_info;
TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
TYPE_REF_IS_RVALUE (in REFERENCE_TYPE)
ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute)
+ CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR)
1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
@@ -572,6 +573,7 @@ enum cp_tree_index
CPTI_CLASS_TYPE,
CPTI_UNKNOWN_TYPE,
+ CPTI_INIT_LIST_TYPE,
CPTI_VTBL_TYPE,
CPTI_VTBL_PTR_TYPE,
CPTI_STD,
@@ -637,6 +639,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
+#define init_list_type_node cp_global_trees[CPTI_INIT_LIST_TYPE]
#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
#define std_node cp_global_trees[CPTI_STD]
@@ -1126,6 +1129,7 @@ struct lang_type_class GTY(())
unsigned has_complex_assign_ref : 1;
unsigned non_aggregate : 1;
unsigned has_complex_dflt : 1;
+ unsigned has_list_ctor : 1;
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
@@ -1134,7 +1138,7 @@ struct lang_type_class GTY(())
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
- unsigned dummy : 11;
+ unsigned dummy : 10;
tree primary_base;
VEC(tree_pair_s,gc) *vcall_indices;
@@ -1248,6 +1252,10 @@ struct lang_type GTY(())
#define TYPE_HAS_CONST_INIT_REF(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref)
+/* Nonzero if this class has an X(initializer_list<T>) constructor. */
+#define TYPE_HAS_LIST_CTOR(NODE) \
+ (LANG_TYPE_CLASS_CHECK (NODE)->has_list_ctor)
+
/* Nonzero if this class defines an overloaded operator new. (An
operator new [] doesn't count.) */
#define TYPE_HAS_NEW_OPERATOR(NODE) \
@@ -2713,7 +2721,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
/* True if NODE is a brace-enclosed initializer. */
#define BRACE_ENCLOSED_INITIALIZER_P(NODE) \
- (TREE_CODE (NODE) == CONSTRUCTOR && !TREE_TYPE (NODE))
+ (TREE_CODE (NODE) == CONSTRUCTOR && TREE_TYPE (NODE) == init_list_type_node)
/* True if NODE is a compound-literal, i.e., a brace-enclosed
initializer cast to a particular type. */
@@ -2725,6 +2733,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
CONSTRUCTOR_ELTS (NODE)) \
&& !TREE_HAS_CONSTRUCTOR (NODE))
+/* True if NODE is a init-list used as a direct-initializer, i.e.
+ B b{1,2}, not B b({1,2}) or B b = {1,2}. */
+#define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE)))
+
/* Nonzero means that an object of this type can not be initialized using
an initializer list. */
#define CLASSTYPE_NON_AGGREGATE(NODE) \
@@ -3688,6 +3700,11 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define LOOKUP_HIDDEN (LOOKUP_PREFER_NAMESPACES << 1)
/* Prefer that the lvalue be treated as an rvalue. */
#define LOOKUP_PREFER_RVALUE (LOOKUP_HIDDEN << 1)
+/* We're inside an init-list, so narrowing conversions are ill-formed. */
+#define LOOKUP_NO_NARROWING (LOOKUP_PREFER_RVALUE << 1)
+/* Avoid user-defined conversions for the first parameter of a copy
+ constructor. */
+#define LOOKUP_NO_COPY_CTOR_CONVERSION (LOOKUP_NO_NARROWING << 1)
#define LOOKUP_NAMESPACES_ONLY(F) \
(((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
@@ -4084,6 +4101,7 @@ extern tree cxx_type_promotes_to (tree);
extern tree type_passed_as (tree);
extern tree convert_for_arg_passing (tree, tree);
extern bool is_properly_derived_from (tree, tree);
+extern tree set_up_extended_ref_temp (tree, tree, tree *, tree *);
extern tree initialize_reference (tree, tree, tree, tree *);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern tree strip_top_quals (tree);
@@ -4092,6 +4110,8 @@ extern tree perform_direct_initialization_if_possible (tree, tree, bool,
tsubst_flags_t);
extern tree in_charge_arg_for_name (tree);
extern tree build_cxx_call (tree, int, tree *);
+extern bool is_std_init_list (tree);
+extern bool is_list_ctor (tree);
#ifdef ENABLE_CHECKING
extern void validate_conversion_obstack (void);
#endif /* ENABLE_CHECKING */
@@ -4311,6 +4331,7 @@ extern const char *language_to_string (enum languages);
extern const char *class_key_or_enum_as_string (tree);
extern void print_instantiation_context (void);
extern void maybe_warn_variadic_templates (void);
+extern void maybe_warn_cpp0x (const char *);
/* in except.c */
extern void init_exception_processing (void);
@@ -4622,7 +4643,7 @@ extern tree finish_increment_expr (tree, enum tree_code);
extern tree finish_this_expr (void);
extern tree finish_pseudo_destructor_expr (tree, tree, tree);
extern tree finish_unary_op_expr (enum tree_code, tree);
-extern tree finish_compound_literal (tree, VEC(constructor_elt,gc) *);
+extern tree finish_compound_literal (tree, tree);
extern tree finish_fname (tree);
extern void finish_translation_unit (void);
extern tree finish_template_type_parm (tree, tree);
@@ -4707,6 +4728,7 @@ extern tree build_min_non_dep_call_list (tree, tree, tree);
extern tree build_cplus_new (tree, tree);
extern tree get_target_expr (tree);
extern tree build_cplus_array_type (tree, tree);
+extern tree build_array_of_n_type (tree, int);
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
extern tree build_qualified_name (tree, tree, tree, bool);
@@ -4861,6 +4883,7 @@ extern void complete_type_check_abstract (tree);
extern int abstract_virtuals_error (tree, tree);
extern tree store_init_value (tree, tree);
+extern void check_narrowing (tree, tree);
extern tree digest_init (tree, tree);
extern tree build_scoped_ref (tree, tree, tree *);
extern tree build_x_arrow (tree);
@@ -4882,6 +4905,7 @@ extern tree mangle_thunk (tree, int, tree, tree);
extern tree mangle_conv_op_name_for_type (tree);
extern tree mangle_guard_variable (tree);
extern tree mangle_ref_init_variable (tree);
+extern tree mangle_compound_literal (void);
/* in dump.c */
extern bool cp_dump_tree (void *, tree);
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index b2c17c547db..70ef00a4fce 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -725,8 +725,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
if (abstract_virtuals_error (NULL_TREE, type))
return error_mark_node;
- if ((flags & LOOKUP_ONLYCONVERTING)
- && ! (MAYBE_CLASS_TYPE_P (dtype) && DERIVED_FROM_P (type, dtype)))
+ if (BRACE_ENCLOSED_INITIALIZER_P (ctor))
+ ctor = perform_implicit_conversion (type, ctor, tf_warning_or_error);
+ else if ((flags & LOOKUP_ONLYCONVERTING)
+ && ! (CLASS_TYPE_P (dtype) && DERIVED_FROM_P (type, dtype)))
/* For copy-initialization, first we create a temp of the proper type
with a user-defined conversion sequence, then we direct-initialize
the target with the temp (see [dcl.init]). */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 32be05cc7c3..a5a5574d7b4 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3344,6 +3344,9 @@ cxx_init_decl_processing (void)
TYPE_POINTER_TO (unknown_type_node) = unknown_type_node;
TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;
+ init_list_type_node = make_node (UNKNOWN_TYPE);
+ record_unknown_type (init_list_type_node, "init list");
+
{
/* Make sure we get a unique function type, so we can give
its pointer type a name. (This wins for gdb.) */
@@ -4295,6 +4298,39 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
return NULL_TREE;
}
+/* Subroutine of check_initializer. We're initializing a DECL of
+ std::initializer_list<T> TYPE from a braced-init-list INIT, and need to
+ extend the lifetime of the underlying array to match that of the decl,
+ just like for reference initialization. CLEANUP is as for
+ grok_reference_init. */
+
+static tree
+build_init_list_var_init (tree decl, tree type, tree init, tree *cleanup)
+{
+ tree aggr_init, array, arrtype;
+ init = perform_implicit_conversion (type, init, tf_warning_or_error);
+ aggr_init = TARGET_EXPR_INITIAL (init);
+ init = build2 (INIT_EXPR, type, decl, init);
+
+ array = AGGR_INIT_EXPR_ARG (aggr_init, 1);
+ arrtype = TREE_TYPE (array);
+ STRIP_NOPS (array);
+ gcc_assert (TREE_CODE (array) == ADDR_EXPR);
+ array = TREE_OPERAND (array, 0);
+ /* If the array is constant, finish_compound_literal already made it a
+ static variable and we don't need to do anything here. */
+ if (decl && TREE_CODE (array) == TARGET_EXPR)
+ {
+ tree subinit;
+ tree var = set_up_extended_ref_temp (decl, array, cleanup, &subinit);
+ var = build_address (var);
+ var = convert (arrtype, var);
+ AGGR_INIT_EXPR_ARG (aggr_init, 1) = var;
+ init = build2 (COMPOUND_EXPR, TREE_TYPE (init), subinit, init);
+ }
+ return init;
+}
+
/* Designated initializers in arrays are not supported in GNU C++.
The parser cannot detect this error since it does not know whether
a given brace-enclosed initializer is for a class type or for an
@@ -4573,7 +4609,7 @@ reshape_init_array_1 (tree elt_type, tree max_index, reshape_iter *d)
unsigned HOST_WIDE_INT index;
/* The initializer for an array is always a CONSTRUCTOR. */
- new_init = build_constructor (NULL_TREE, NULL);
+ new_init = build_constructor (init_list_type_node, NULL);
if (sized_array_p)
{
@@ -4668,7 +4704,7 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p)
gcc_assert (CLASS_TYPE_P (type));
/* The initializer for a class is always a CONSTRUCTOR. */
- new_init = build_constructor (NULL_TREE, NULL);
+ new_init = build_constructor (init_list_type_node, NULL);
field = next_initializable_field (TYPE_FIELDS (type));
if (!field)
@@ -4926,6 +4962,26 @@ check_array_initializer (tree decl, tree type, tree init)
return false;
}
+/* Subroutine of check_initializer; args are passed down from that function.
+ Set stmts_are_full_exprs_p to 1 across a call to build_aggr_init. */
+
+static tree
+build_aggr_init_full_exprs (tree decl, tree init, int flags)
+
+{
+ int saved_stmts_are_full_exprs_p = 0;
+ if (building_stmt_tree ())
+ {
+ saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
+ current_stmt_tree ()->stmts_are_full_exprs_p = 1;
+ }
+ init = build_aggr_init (decl, init, flags, tf_warning_or_error);
+ if (building_stmt_tree ())
+ current_stmt_tree ()->stmts_are_full_exprs_p =
+ saved_stmts_are_full_exprs_p;
+ return init;
+}
+
/* Verify INIT (the initializer for DECL), and record the
initialization in DECL_INITIAL, if appropriate. CLEANUP is as for
grok_reference_init.
@@ -4967,7 +5023,12 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
int init_len = VEC_length (constructor_elt, CONSTRUCTOR_ELTS (init));
if (SCALAR_TYPE_P (type))
{
- if (init_len != 1)
+ if (init_len == 0)
+ {
+ maybe_warn_cpp0x ("extended initializer lists");
+ init = build_zero_init (type, NULL_TREE, false);
+ }
+ else if (init_len != 1)
{
error ("scalar object %qD requires one element in initializer",
decl);
@@ -4975,15 +5036,6 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
return NULL_TREE;
}
}
- else if ((cxx_dialect == cxx98) && !CP_AGGREGATE_TYPE_P (type))
- {
- /* A non-aggregate that is not a scalar cannot be initialized
- via an initializer-list in C++98. */
- error ("braces around initializer for non-aggregate type %qT",
- type);
- TREE_TYPE (decl) = error_mark_node;
- return NULL_TREE;
- }
}
if (TREE_CODE (decl) == CONST_DECL)
@@ -5001,17 +5053,26 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
{
/* Do not reshape constructors of vectors (they don't need to be
reshaped. */
- if (TREE_CODE (init) == CONSTRUCTOR
- && !COMPOUND_LITERAL_P (init)
- && !TREE_TYPE (init)) /* ptrmemfunc */
+ if (BRACE_ENCLOSED_INITIALIZER_P (init))
{
- init = reshape_init (type, init);
-
- if ((*targetm.vector_opaque_p) (type))
+ if (is_std_init_list (type))
+ return build_init_list_var_init (decl, type, init, cleanup);
+ else if (TYPE_NON_AGGREGATE_CLASS (type))
+ {
+ /* Don't reshape if the class has constructors. */
+ if (cxx_dialect == cxx98)
+ error ("in C++98 %qD must be initialized by constructor, "
+ "not by %<{...}%>",
+ decl);
+ init = build_tree_list (NULL_TREE, init);
+ }
+ else if ((*targetm.vector_opaque_p) (type))
{
error ("opaque vector types cannot be initialized");
init = error_mark_node;
}
+ else
+ init = reshape_init (type, init);
}
/* If DECL has an array type without a specific bound, deduce the
@@ -5021,60 +5082,26 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
if (type == error_mark_node)
return NULL_TREE;
- if (TREE_CODE (type) == ARRAY_TYPE && TYPE_NEEDS_CONSTRUCTING (type))
- goto initialize_aggr;
- else if (CLASS_TYPE_P (type))
+ if (TYPE_NEEDS_CONSTRUCTING (type)
+ || (CLASS_TYPE_P (type)
+ && !BRACE_ENCLOSED_INITIALIZER_P (init)))
+ return build_aggr_init_full_exprs (decl, init, flags);
+ else if (TREE_CODE (init) != TREE_VEC)
{
- if (TREE_CODE (init) == CONSTRUCTOR)
- {
- if (TYPE_NON_AGGREGATE_CLASS (type))
- {
- error ("%qD must be initialized by constructor, "
- "not by %<{...}%>",
- decl);
- init = error_mark_node;
- }
- else
- goto dont_use_constructor;
- }
- else
- {
- int saved_stmts_are_full_exprs_p;
-
- initialize_aggr:
- saved_stmts_are_full_exprs_p = 0;
- if (building_stmt_tree ())
- {
- saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
- current_stmt_tree ()->stmts_are_full_exprs_p = 1;
- }
- init = build_aggr_init (decl, init, flags, tf_warning_or_error);
- if (building_stmt_tree ())
- current_stmt_tree ()->stmts_are_full_exprs_p =
- saved_stmts_are_full_exprs_p;
- return init;
- }
- }
- else
- {
- dont_use_constructor:
- if (TREE_CODE (init) != TREE_VEC)
- {
- init_code = store_init_value (decl, init);
- if (pedantic && TREE_CODE (type) == ARRAY_TYPE
- && DECL_INITIAL (decl)
- && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST
- && PAREN_STRING_LITERAL_P (DECL_INITIAL (decl)))
- warning (0, "array %qD initialized by parenthesized string literal %qE",
- decl, DECL_INITIAL (decl));
- init = NULL;
- }
+ init_code = store_init_value (decl, init);
+ if (pedantic && TREE_CODE (type) == ARRAY_TYPE
+ && DECL_INITIAL (decl)
+ && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST
+ && PAREN_STRING_LITERAL_P (DECL_INITIAL (decl)))
+ warning (0, "array %qD initialized by parenthesized string literal %qE",
+ decl, DECL_INITIAL (decl));
+ init = NULL;
}
}
else if (DECL_EXTERNAL (decl))
;
else if (TYPE_P (type) && TYPE_NEEDS_CONSTRUCTING (type))
- goto initialize_aggr;
+ return build_aggr_init_full_exprs (decl, init, flags);
else if (MAYBE_CLASS_TYPE_P (type))
{
tree core_type = strip_array_types (type);
@@ -5311,7 +5338,7 @@ initialize_artificial_var (tree decl, tree init)
{
gcc_assert (DECL_ARTIFICIAL (decl));
if (TREE_CODE (init) == TREE_LIST)
- init = build_constructor_from_list (NULL_TREE, init);
+ init = build_constructor_from_list (TREE_TYPE (decl), init);
gcc_assert (TREE_CODE (init) == CONSTRUCTOR);
DECL_INITIAL (decl) = init;
DECL_INITIALIZED_P (decl) = 1;
@@ -8921,17 +8948,11 @@ grokdeclarator (const cp_declarator *declarator,
DECL_NONCONVERTING_P (decl) = 1;
else if (DECL_CONSTRUCTOR_P (decl))
{
- /* The constructor can be called with exactly one
- parameter if there is at least one parameter, and
- any subsequent parameters have default arguments.
+ /* 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
- || (arg_types
- && TREE_CHAIN (arg_types)
- && TREE_CHAIN (arg_types) != void_list_node
- && !TREE_PURPOSE (TREE_CHAIN (arg_types))))
+ if (arg_types == void_list_node)
DECL_NONCONVERTING_P (decl) = 1;
}
}
@@ -9646,6 +9667,8 @@ grok_special_member_properties (tree decl)
}
else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1;
+ else if (is_list_ctor (decl))
+ TYPE_HAS_LIST_CTOR (class_type) = 1;
}
else if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR)
{
@@ -11606,7 +11629,8 @@ finish_constructor_body (void)
tree val;
tree exprstmt;
- if (targetm.cxx.cdtor_returns_this ())
+ if (targetm.cxx.cdtor_returns_this ()
+ && (! TYPE_FOR_JAVA (current_class_type)))
{
/* Any return from a constructor will end up here. */
add_stmt (build_stmt (LABEL_EXPR, cdtor_label));
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 55e620a6b54..80aa6e962d2 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -284,7 +284,10 @@ dump_type (tree t, int flags)
switch (TREE_CODE (t))
{
case UNKNOWN_TYPE:
- pp_identifier (cxx_pp, "<unresolved overloaded function type>");
+ if (t == init_list_type_node)
+ pp_identifier (cxx_pp, "<brace-enclosed initializer list>");
+ else
+ pp_identifier (cxx_pp, "<unresolved overloaded function type>");
break;
case TREE_LIST:
@@ -2674,13 +2677,20 @@ cp_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
report_diagnostic (&diagnostic);
}
-/* Warn about the use of variadic templates when appropriate. */
+/* Warn about the use of C++0x features when appropriate. */
void
-maybe_warn_variadic_templates (void)
+maybe_warn_cpp0x (const char* str)
{
if ((cxx_dialect == cxx98) && !in_system_header)
/* We really want to suppress this warning in system headers,
because libstdc++ uses variadic templates even when we aren't
in C++0x mode. */
- pedwarn ("ISO C++ does not include variadic templates");
+ pedwarn ("%s only available with -std=c++0x", str);
+}
+
+/* Warn about the use of variadic templates when appropriate. */
+void
+maybe_warn_variadic_templates (void)
+{
+ maybe_warn_cpp0x ("variadic templates");
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 0c38a7fcb0c..3e9e612f2b4 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1334,10 +1334,10 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
to run a new constructor; and catching an exception, where we
have already built up the constructor call so we could wrap it
in an exception region. */;
- else if (BRACE_ENCLOSED_INITIALIZER_P (init))
+ else if (BRACE_ENCLOSED_INITIALIZER_P (init)
+ && CP_AGGREGATE_TYPE_P (type))
{
/* A brace-enclosed initializer for an aggregate. */
- gcc_assert (CP_AGGREGATE_TYPE_P (type));
init = digest_init (type, init);
}
else
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 290cb7030b5..e42f60afba7 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4639,7 +4639,8 @@ arg_assoc_type (struct arg_lookup *k, tree type)
case TYPENAME_TYPE:
return false;
case LANG_TYPE:
- gcc_assert (type == unknown_type_node);
+ gcc_assert (type == unknown_type_node
+ || type == init_list_type_node);
return false;
case TYPE_PACK_EXPANSION:
return arg_assoc_type (k, PACK_EXPANSION_PATTERN (type));
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7d530f50714..2323c672166 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -529,6 +529,14 @@ cp_lexer_next_token_is_keyword (cp_lexer* lexer, enum rid keyword)
return cp_lexer_peek_token (lexer)->keyword == keyword;
}
+/* Return true if the next token is not the indicated KEYWORD. */
+
+static inline bool
+cp_lexer_next_token_is_not_keyword (cp_lexer* lexer, enum rid keyword)
+{
+ return cp_lexer_peek_token (lexer)->keyword != keyword;
+}
+
/* Return true if the next token is a keyword for a decl-specifier. */
static bool
@@ -1743,6 +1751,8 @@ static tree cp_parser_initializer
(cp_parser *, bool *, bool *);
static tree cp_parser_initializer_clause
(cp_parser *, bool *);
+static tree cp_parser_braced_list
+ (cp_parser*, bool*);
static VEC(constructor_elt,gc) *cp_parser_initializer_list
(cp_parser *, bool *);
@@ -1965,7 +1975,7 @@ static bool cp_parser_optional_template_keyword
(cp_parser *);
static void cp_parser_pre_parsed_nested_name_specifier
(cp_parser *);
-static void cp_parser_cache_group
+static bool cp_parser_cache_group
(cp_parser *, enum cpp_ttype, unsigned);
static void cp_parser_parse_tentatively
(cp_parser *);
@@ -4534,7 +4544,9 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
}
/* Form the representation of the compound-literal. */
postfix_expression
- = finish_compound_literal (type, initializer_list);
+ = (finish_compound_literal
+ (type, build_constructor (init_list_type_node,
+ initializer_list)));
break;
}
}
@@ -5070,10 +5082,19 @@ cp_parser_parenthesized_expression_list (cp_parser* parser,
}
else
{
+ bool expr_non_constant_p;
+
/* Parse the next assignment-expression. */
- if (non_constant_p)
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ /* A braced-init-list. */
+ maybe_warn_cpp0x ("extended initializer lists");
+ expr = cp_parser_braced_list (parser, &expr_non_constant_p);
+ if (non_constant_p && expr_non_constant_p)
+ *non_constant_p = true;
+ }
+ else if (non_constant_p)
{
- bool expr_non_constant_p;
expr = (cp_parser_constant_expression
(parser, /*allow_non_constant_p=*/true,
&expr_non_constant_p));
@@ -5535,8 +5556,9 @@ cp_parser_new_expression (cp_parser* parser)
else
type = cp_parser_new_type_id (parser, &nelts);
- /* If the next token is a `(', then we have a new-initializer. */
- if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ /* If the next token is a `(' or '{', then we have a new-initializer. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN)
+ || cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
initializer = cp_parser_new_initializer (parser);
else
initializer = NULL_TREE;
@@ -5748,6 +5770,7 @@ cp_parser_direct_new_declarator (cp_parser* parser)
new-initializer:
( expression-list [opt] )
+ braced-init-list
Returns a representation of the expression-list. If there is no
expression-list, VOID_ZERO_NODE is returned. */
@@ -5757,9 +5780,18 @@ cp_parser_new_initializer (cp_parser* parser)
{
tree expression_list;
- expression_list = (cp_parser_parenthesized_expression_list
- (parser, false, /*cast_p=*/false, /*allow_expansion_p=*/true,
- /*non_constant_p=*/NULL));
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ bool expr_non_constant_p;
+ maybe_warn_cpp0x ("extended initializer lists");
+ expression_list = cp_parser_braced_list (parser, &expr_non_constant_p);
+ CONSTRUCTOR_IS_DIRECT_INIT (expression_list) = 1;
+ expression_list = build_tree_list (NULL_TREE, expression_list);
+ }
+ else
+ expression_list = (cp_parser_parenthesized_expression_list
+ (parser, false, /*cast_p=*/false, /*allow_expansion_p=*/true,
+ /*non_constant_p=*/NULL));
if (!expression_list)
expression_list = void_zero_node;
@@ -6208,10 +6240,14 @@ cp_parser_assignment_expression (cp_parser* parser, bool cast_p)
= cp_parser_assignment_operator_opt (parser);
if (assignment_operator != ERROR_MARK)
{
- tree rhs;
+ bool non_constant_p;
/* Parse the right-hand side of the assignment. */
- rhs = cp_parser_assignment_expression (parser, cast_p);
+ tree rhs = cp_parser_initializer_clause (parser, &non_constant_p);
+
+ if (BRACE_ENCLOSED_INITIALIZER_P (rhs))
+ maybe_warn_cpp0x ("extended initializer lists");
+
/* An assignment may not appear in a
constant-expression. */
if (cp_parser_non_integral_constant_expression (parser,
@@ -7124,7 +7160,8 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p)
condition:
expression
- type-specifier-seq declarator = assignment-expression
+ type-specifier-seq declarator = initializer-clause
+ type-specifier-seq declarator braced-init-list
GNU Extension:
@@ -7170,31 +7207,47 @@ cp_parser_condition (cp_parser* parser)
attributes = cp_parser_attributes_opt (parser);
/* Parse the asm-specification. */
asm_specification = cp_parser_asm_specification_opt (parser);
- /* If the next token is not an `=', then we might still be
+ /* If the next token is not an `=' or '{', then we might still be
looking at an expression. For example:
if (A(a).x)
looks like a decl-specifier-seq and a declarator -- but then
there is no `=', so this is an expression. */
- cp_parser_require (parser, CPP_EQ, "%<=%>");
- /* If we did see an `=', then we are looking at a declaration
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
+ cp_parser_simulate_error (parser);
+
+ /* If we did see an `=' or '{', then we are looking at a declaration
for sure. */
if (cp_parser_parse_definitely (parser))
{
tree pushed_scope;
bool non_constant_p;
+ bool flags = LOOKUP_ONLYCONVERTING;
/* Create the declaration. */
decl = start_decl (declarator, &type_specifiers,
/*initialized_p=*/true,
attributes, /*prefix_attributes=*/NULL_TREE,
&pushed_scope);
- /* Parse the assignment-expression. */
- initializer
- = cp_parser_constant_expression (parser,
- /*allow_non_constant_p=*/true,
- &non_constant_p);
+
+ /* Parse the initializer. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ initializer = cp_parser_braced_list (parser, &non_constant_p);
+ CONSTRUCTOR_IS_DIRECT_INIT (initializer) = 1;
+ flags = 0;
+ }
+ else
+ {
+ /* Consume the `='. */
+ cp_lexer_consume_token (parser->lexer);
+ initializer = cp_parser_initializer_clause (parser, &non_constant_p);
+ }
+ if (BRACE_ENCLOSED_INITIALIZER_P (initializer))
+ maybe_warn_cpp0x ("extended initializer lists");
+
if (!non_constant_p)
initializer = fold_non_dependent_expr (initializer);
@@ -7202,7 +7255,7 @@ cp_parser_condition (cp_parser* parser)
cp_finish_decl (decl,
initializer, !non_constant_p,
asm_specification,
- LOOKUP_ONLYCONVERTING);
+ flags);
if (pushed_scope)
pop_scope (pushed_scope);
@@ -7426,6 +7479,7 @@ cp_parser_for_init_statement (cp_parser* parser)
break ;
continue ;
return expression [opt] ;
+ return braced-init-list ;
goto identifier ;
GNU extension:
@@ -7496,12 +7550,18 @@ cp_parser_jump_statement (cp_parser* parser)
case RID_RETURN:
{
tree expr;
+ bool expr_non_constant_p;
- /* If the next token is a `;', then there is no
- expression. */
- if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ maybe_warn_cpp0x ("extended initializer lists");
+ expr = cp_parser_braced_list (parser, &expr_non_constant_p);
+ }
+ else if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
expr = cp_parser_expression (parser, /*cast_p=*/false);
else
+ /* If the next token is a `;', then there is no
+ expression. */
expr = NULL_TREE;
/* Build the return-statement. */
statement = finish_return_stmt (expr);
@@ -7964,7 +8024,8 @@ cp_parser_simple_declaration (cp_parser* parser,
is not a parenthesis, then we must be looking at a declaration.
(After "int (" we might be looking at a functional cast.) */
if (decl_specifiers.any_specifiers_p
- && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN))
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
cp_parser_commit_to_tentative_parse (parser);
/* Keep going until we hit the `;' at the end of the simple
@@ -8907,6 +8968,7 @@ cp_parser_mem_initializer_list (cp_parser* parser)
mem-initializer:
mem-initializer-id ( expression-list [opt] )
+ mem-initializer-id braced-init-list
GNU extension:
@@ -8937,11 +8999,20 @@ cp_parser_mem_initializer (cp_parser* parser)
if (member && !DECL_P (member))
in_base_initializer = 1;
- expression_list
- = cp_parser_parenthesized_expression_list (parser, false,
- /*cast_p=*/false,
- /*allow_expansion_p=*/true,
- /*non_constant_p=*/NULL);
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ bool expr_non_constant_p;
+ maybe_warn_cpp0x ("extended initializer lists");
+ expression_list = cp_parser_braced_list (parser, &expr_non_constant_p);
+ CONSTRUCTOR_IS_DIRECT_INIT (expression_list) = 1;
+ expression_list = build_tree_list (NULL_TREE, expression_list);
+ }
+ else
+ expression_list
+ = cp_parser_parenthesized_expression_list (parser, false,
+ /*cast_p=*/false,
+ /*allow_expansion_p=*/true,
+ /*non_constant_p=*/NULL);
if (expression_list == error_mark_node)
return error_mark_node;
if (!expression_list)
@@ -12197,7 +12268,7 @@ cp_parser_init_declarator (cp_parser* parser,
initialized with "= ..", CPP_OPEN_PAREN if initialized with
"(...)". */
enum cpp_ttype initialization_kind;
- bool is_parenthesized_init = false;
+ bool is_direct_init = false;
bool is_non_constant_init;
int ctor_dtor_or_conv_p;
bool friend_p;
@@ -12263,7 +12334,8 @@ cp_parser_init_declarator (cp_parser* parser,
token = cp_lexer_peek_token (parser->lexer);
/* Check to see if the token indicates the start of a
function-definition. */
- if (cp_parser_token_starts_function_definition_p (token))
+ if (function_declarator_p (declarator)
+ && cp_parser_token_starts_function_definition_p (token))
{
if (!function_definition_allowed_p)
{
@@ -12314,9 +12386,10 @@ cp_parser_init_declarator (cp_parser* parser,
return error_mark_node;
}
- /* An `=' or an `(' indicates an initializer. */
+ /* An `=' or an `(', or an '{' in C++0x, indicates an initializer. */
if (token->type == CPP_EQ
- || token->type == CPP_OPEN_PAREN)
+ || token->type == CPP_OPEN_PAREN
+ || token->type == CPP_OPEN_BRACE)
{
is_initialized = true;
initialization_kind = token->type;
@@ -12399,7 +12472,7 @@ cp_parser_init_declarator (cp_parser* parser,
/* Parse the initializer. */
initializer = NULL_TREE;
- is_parenthesized_init = false;
+ is_direct_init = false;
is_non_constant_init = true;
if (is_initialized)
{
@@ -12422,7 +12495,7 @@ cp_parser_init_declarator (cp_parser* parser,
}
else
initializer = cp_parser_initializer (parser,
- &is_parenthesized_init,
+ &is_direct_init,
&is_non_constant_init);
}
@@ -12430,7 +12503,8 @@ cp_parser_init_declarator (cp_parser* parser,
initializer. Mark Mitchell proposed removing this functionality
on the GCC mailing lists on 2002-08-13. This parser accepts the
attributes -- but ignores them. */
- if (cp_parser_allow_gnu_extensions_p (parser) && is_parenthesized_init)
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && initialization_kind == CPP_OPEN_PAREN)
if (cp_parser_attributes_opt (parser))
warning (OPT_Wattributes,
"attributes after parenthesized initializer ignored");
@@ -12463,8 +12537,8 @@ cp_parser_init_declarator (cp_parser* parser,
a direct-initialization, which means that an
`explicit' constructor is OK. Otherwise, an
`explicit' constructor cannot be used. */
- ((is_parenthesized_init || !is_initialized)
- ? 0 : LOOKUP_ONLYCONVERTING));
+ ((is_direct_init || !is_initialized)
+ ? 0 : LOOKUP_ONLYCONVERTING));
}
else if ((cxx_dialect != cxx98) && friend_p
&& decl && TREE_CODE (decl) == FUNCTION_DECL)
@@ -13983,14 +14057,14 @@ cp_parser_ctor_initializer_opt_and_function_body (cp_parser *parser)
Returns an expression representing the initializer. If no
initializer is present, NULL_TREE is returned.
- *IS_PARENTHESIZED_INIT is set to TRUE if the `( expression-list )'
- production is used, and zero otherwise. *IS_PARENTHESIZED_INIT is
- set to FALSE if there is no initializer present. If there is an
+ *IS_DIRECT_INIT is set to FALSE if the `= initializer-clause'
+ production is used, and TRUE otherwise. *IS_DIRECT_INIT is
+ set to TRUE if there is no initializer present. If there is an
initializer, and it is not a constant-expression, *NON_CONSTANT_P
is set to true; otherwise it is set to false. */
static tree
-cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init,
+cp_parser_initializer (cp_parser* parser, bool* is_direct_init,
bool* non_constant_p)
{
cp_token *token;
@@ -14001,7 +14075,7 @@ cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init,
/* Let our caller know whether or not this initializer was
parenthesized. */
- *is_parenthesized_init = (token->type == CPP_OPEN_PAREN);
+ *is_direct_init = (token->type != CPP_EQ);
/* Assume that the initializer is constant. */
*non_constant_p = false;
@@ -14017,6 +14091,12 @@ cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init,
/*cast_p=*/false,
/*allow_expansion_p=*/true,
non_constant_p);
+ else if (token->type == CPP_OPEN_BRACE)
+ {
+ maybe_warn_cpp0x ("extended initializer lists");
+ init = cp_parser_braced_list (parser, non_constant_p);
+ CONSTRUCTOR_IS_DIRECT_INIT (init) = 1;
+ }
else
{
/* Anything else is an error. */
@@ -14031,20 +14111,14 @@ cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init,
initializer-clause:
assignment-expression
- { initializer-list , [opt] }
- { }
+ braced-init-list
Returns an expression representing the initializer.
If the `assignment-expression' production is used the value
returned is simply a representation for the expression.
- Otherwise, a CONSTRUCTOR is returned. The CONSTRUCTOR_ELTS will be
- the elements of the initializer-list (or NULL, if the last
- production is used). The TREE_TYPE for the CONSTRUCTOR will be
- NULL_TREE. There is no way to detect whether or not the optional
- trailing `,' was provided. NON_CONSTANT_P is as for
- cp_parser_initializer. */
+ Otherwise, calls cp_parser_braced_list. */
static tree
cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p)
@@ -14066,25 +14140,46 @@ cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p)
initializer = fold_non_dependent_expr (initializer);
}
else
+ initializer = cp_parser_braced_list (parser, non_constant_p);
+
+ return initializer;
+}
+
+/* Parse a brace-enclosed initializer list.
+
+ braced-init-list:
+ { initializer-list , [opt] }
+ { }
+
+ Returns a CONSTRUCTOR. The CONSTRUCTOR_ELTS will be
+ the elements of the initializer-list (or NULL, if the last
+ production is used). The TREE_TYPE for the CONSTRUCTOR will be
+ NULL_TREE. There is no way to detect whether or not the optional
+ trailing `,' was provided. NON_CONSTANT_P is as for
+ cp_parser_initializer. */
+
+static tree
+cp_parser_braced_list (cp_parser* parser, bool* non_constant_p)
+{
+ tree initializer;
+
+ /* Consume the `{' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Create a CONSTRUCTOR to represent the braced-initializer. */
+ initializer = make_node (CONSTRUCTOR);
+ /* If it's not a `}', then there is a non-trivial initializer. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_BRACE))
{
- /* Consume the `{' token. */
- cp_lexer_consume_token (parser->lexer);
- /* Create a CONSTRUCTOR to represent the braced-initializer. */
- initializer = make_node (CONSTRUCTOR);
- /* If it's not a `}', then there is a non-trivial initializer. */
- if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_BRACE))
- {
- /* Parse the initializer list. */
- CONSTRUCTOR_ELTS (initializer)
- = cp_parser_initializer_list (parser, non_constant_p);
- /* A trailing `,' token is allowed. */
- if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
- cp_lexer_consume_token (parser->lexer);
- }
- /* Now, there should be a trailing `}'. */
- cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>");
+ /* Parse the initializer list. */
+ CONSTRUCTOR_ELTS (initializer)
+ = cp_parser_initializer_list (parser, non_constant_p);
+ /* A trailing `,' token is allowed. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ cp_lexer_consume_token (parser->lexer);
}
-
+ /* Now, there should be a trailing `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "%<}%>");
+ TREE_TYPE (initializer) = init_list_type_node;
return initializer;
}
@@ -17297,11 +17392,22 @@ cp_parser_functional_cast (cp_parser* parser, tree type)
{
tree expression_list;
tree cast;
+ bool nonconst_p;
+
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ maybe_warn_cpp0x ("extended initializer lists");
+ expression_list = cp_parser_braced_list (parser, &nonconst_p);
+ CONSTRUCTOR_IS_DIRECT_INIT (expression_list) = 1;
+ if (TREE_CODE (type) == TYPE_DECL)
+ type = TREE_TYPE (type);
+ return finish_compound_literal (type, expression_list);
+ }
expression_list
= cp_parser_parenthesized_expression_list (parser, false,
/*cast_p=*/true,
- /*allow_expansion_p=*/true,
+ /*allow_expansion_p=*/true,
/*non_constant_p=*/NULL);
cast = build_functional_cast (type, expression_list,
@@ -17352,6 +17458,22 @@ cp_parser_save_member_function_body (cp_parser* parser,
/* Save away the tokens that make up the body of the
function. */
first = parser->lexer->next_token;
+ /* We can have braced-init-list mem-initializers before the fn body. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ {
+ cp_lexer_consume_token (parser->lexer);
+ while (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)
+ && cp_lexer_next_token_is_not_keyword (parser->lexer, RID_TRY))
+ {
+ /* cache_group will stop after an un-nested { } pair, too. */
+ if (cp_parser_cache_group (parser, CPP_CLOSE_PAREN, /*depth=*/0))
+ break;
+
+ /* variadic mem-inits have ... after the ')'. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
+ cp_lexer_consume_token (parser->lexer);
+ }
+ }
cp_parser_cache_group (parser, CPP_CLOSE_BRACE, /*depth=*/0);
/* Handle function try blocks. */
while (cp_lexer_next_token_is_keyword (parser->lexer, RID_CATCH))
@@ -18210,41 +18332,54 @@ cp_parser_pre_parsed_nested_name_specifier (cp_parser *parser)
parser->object_scope = NULL_TREE;
}
-/* Consume tokens up through a non-nested END token. */
+/* Consume tokens up through a non-nested END token. Returns TRUE if we
+ encounter the end of a block before what we were looking for. */
-static void
+static bool
cp_parser_cache_group (cp_parser *parser,
enum cpp_ttype end,
unsigned depth)
{
while (true)
{
- cp_token *token;
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
- /* Abort a parenthesized expression if we encounter a brace. */
+ /* Abort a parenthesized expression if we encounter a semicolon. */
if ((end == CPP_CLOSE_PAREN || depth == 0)
- && cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
- return;
+ && token->type == CPP_SEMICOLON)
+ return true;
/* If we've reached the end of the file, stop. */
- if (cp_lexer_next_token_is (parser->lexer, CPP_EOF)
+ if (token->type == CPP_EOF
|| (end != CPP_PRAGMA_EOL
- && cp_lexer_next_token_is (parser->lexer, CPP_PRAGMA_EOL)))
- return;
- /* Consume the next token. */
- token = cp_lexer_consume_token (parser->lexer);
+ && token->type == CPP_PRAGMA_EOL))
+ return true;
+ if (token->type == CPP_CLOSE_BRACE && depth == 0)
+ /* We've hit the end of an enclosing block, so there's been some
+ kind of syntax error. */
+ return true;
+
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
/* See if it starts a new group. */
if (token->type == CPP_OPEN_BRACE)
{
cp_parser_cache_group (parser, CPP_CLOSE_BRACE, depth + 1);
+ /* In theory this should probably check end == '}', but
+ cp_parser_save_member_function_body needs it to exit
+ after either '}' or ')' when called with ')'. */
if (depth == 0)
- return;
+ return false;
}
else if (token->type == CPP_OPEN_PAREN)
- cp_parser_cache_group (parser, CPP_CLOSE_PAREN, depth + 1);
+ {
+ cp_parser_cache_group (parser, CPP_CLOSE_PAREN, depth + 1);
+ if (depth == 0 && end == CPP_CLOSE_PAREN)
+ return false;
+ }
else if (token->type == CPP_PRAGMA)
cp_parser_cache_group (parser, CPP_PRAGMA_EOL, depth + 1);
else if (token->type == end)
- return;
+ return false;
}
}
@@ -20503,10 +20638,10 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
if (CLASS_TYPE_P (TREE_TYPE (decl))
|| type_dependent_expression_p (decl))
{
- bool is_parenthesized_init, is_non_constant_init;
+ bool is_direct_init, is_non_constant_init;
init = cp_parser_initializer (parser,
- &is_parenthesized_init,
+ &is_direct_init,
&is_non_constant_init);
cp_finish_decl (decl, init, !is_non_constant_init,
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f24b6ff04b3..cce706f0705 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11507,6 +11507,7 @@ tsubst_copy_and_build (tree t,
bool process_index_p;
int newlen;
bool need_copy_p = false;
+ tree r;
if (type == error_mark_node)
return error_mark_node;
@@ -11571,10 +11572,12 @@ tsubst_copy_and_build (tree t,
}
}
+ r = build_constructor (init_list_type_node, n);
+
if (TREE_HAS_CONSTRUCTOR (t))
- return finish_compound_literal (type, n);
+ return finish_compound_literal (type, r);
- return build_constructor (NULL_TREE, n);
+ return r;
}
case TYPEID_EXPR:
@@ -12271,6 +12274,8 @@ type_unification_real (tree tparms,
arg_strict |= maybe_adjust_types_for_deduction (strict, &parm, &arg,
arg_expr);
+ if (arg == init_list_type_node && arg_expr)
+ arg = arg_expr;
if (unify (tparms, targs, parm, arg, arg_strict))
return 1;
}
@@ -13037,7 +13042,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
if (arg == error_mark_node)
return 1;
- if (arg == unknown_type_node)
+ if (arg == unknown_type_node
+ || arg == init_list_type_node)
/* We can't deduce anything from this, but we might get all the
template args from other function args. */
return 0;
@@ -13049,6 +13055,31 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
if (arg == parm && !uses_template_parms (parm))
return 0;
+ /* Handle init lists early, so the rest of the function can assume
+ we're dealing with a type. */
+ if (BRACE_ENCLOSED_INITIALIZER_P (arg))
+ {
+ tree elt, elttype;
+ unsigned i;
+
+ if (!is_std_init_list (parm))
+ /* We can only deduce from an initializer list argument if the
+ parameter is std::initializer_list; otherwise this is a
+ non-deduced context. */
+ return 0;
+
+ elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0);
+
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt)
+ {
+ if (!BRACE_ENCLOSED_INITIALIZER_P (elt))
+ elt = TREE_TYPE (elt);
+ if (unify (tparms, targs, elttype, elt, UNIFY_ALLOW_NONE))
+ return 1;
+ }
+ return 0;
+ }
+
/* Immediately reject some pairs that won't unify because of
cv-qualification mismatches. */
if (TREE_CODE (arg) == TREE_CODE (parm)
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 1dcd785371a..8a36f0b77b7 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -900,7 +900,7 @@ tinfo_base_init (tinfo_s *ti, tree target)
init = tree_cons (NULL_TREE, decay_conversion (name_decl), init);
- init = build_constructor_from_list (NULL_TREE, nreverse (init));
+ init = build_constructor_from_list (init_list_type_node, nreverse (init));
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
init = tree_cons (NULL_TREE, init, NULL_TREE);
@@ -917,7 +917,7 @@ generic_initializer (tinfo_s *ti, tree target)
{
tree init = tinfo_base_init (ti, target);
- init = build_constructor_from_list (NULL_TREE, init);
+ init = build_constructor_from_list (init_list_type_node, init);
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
return init;
@@ -942,7 +942,7 @@ ptr_initializer (tinfo_s *ti, tree target)
get_tinfo_ptr (TYPE_MAIN_VARIANT (to)),
init);
- init = build_constructor_from_list (NULL_TREE, nreverse (init));
+ init = build_constructor_from_list (init_list_type_node, nreverse (init));
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
return init;
@@ -974,7 +974,7 @@ ptm_initializer (tinfo_s *ti, tree target)
get_tinfo_ptr (klass),
init);
- init = build_constructor_from_list (NULL_TREE, nreverse (init));
+ init = build_constructor_from_list (init_list_type_node, nreverse (init));
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
return init;
@@ -990,7 +990,7 @@ class_initializer (tinfo_s *ti, tree target, tree trail)
tree init = tinfo_base_init (ti, target);
TREE_CHAIN (init) = trail;
- init = build_constructor_from_list (NULL_TREE, init);
+ init = build_constructor_from_list (init_list_type_node, init);
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
return init;
@@ -1102,10 +1102,10 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
build_int_cst (offset_type, flags));
base_init = tree_cons (NULL_TREE, offset, base_init);
base_init = tree_cons (NULL_TREE, tinfo, base_init);
- base_init = build_constructor_from_list (NULL_TREE, base_init);
+ base_init = build_constructor_from_list (init_list_type_node, base_init);
base_inits = tree_cons (NULL_TREE, base_init, base_inits);
}
- base_inits = build_constructor_from_list (NULL_TREE, base_inits);
+ base_inits = build_constructor_from_list (init_list_type_node, base_inits);
base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE);
/* Prepend the number of bases. */
base_inits = tree_cons (NULL_TREE,
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 2400aeb37da..fa65e9b2804 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2099,21 +2099,17 @@ finish_unary_op_expr (enum tree_code code, tree expr)
}
/* Finish a compound-literal expression. TYPE is the type to which
- the INITIALIZER_LIST is being cast. */
+ the CONSTRUCTOR in COMPOUND_LITERAL is being cast. */
tree
-finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list)
+finish_compound_literal (tree type, tree compound_literal)
{
- tree compound_literal;
-
if (!TYPE_OBJ_P (type))
{
error ("compound literal of non-object type %qT", type);
return error_mark_node;
}
- /* Build a CONSTRUCTOR for the INITIALIZER_LIST. */
- compound_literal = build_constructor (NULL_TREE, initializer_list);
if (processing_template_decl)
{
TREE_TYPE (compound_literal) = type;
@@ -2123,6 +2119,18 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list)
}
type = complete_type (type);
+
+ if (TYPE_NON_AGGREGATE_CLASS (type))
+ {
+ /* Trying to deal with a CONSTRUCTOR instead of a TREE_LIST
+ everywhere that deals with function arguments would be a pain, so
+ just wrap it in a TREE_LIST. The parser set a flag so we know
+ that it came from T{} rather than T({}). */
+ CONSTRUCTOR_IS_DIRECT_INIT (compound_literal) = 1;
+ compound_literal = build_tree_list (NULL_TREE, compound_literal);
+ return build_functional_cast (type, compound_literal, tf_error);
+ }
+
if (TREE_CODE (type) == ARRAY_TYPE
&& check_array_initializer (NULL_TREE, type, compound_literal))
return error_mark_node;
@@ -2130,7 +2138,19 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list)
if (TREE_CODE (type) == ARRAY_TYPE)
cp_complete_array_type (&type, compound_literal, false);
compound_literal = digest_init (type, compound_literal);
- return get_target_expr (compound_literal);
+ if ((!at_function_scope_p () || cp_type_readonly (type))
+ && initializer_constant_valid_p (compound_literal, type))
+ {
+ tree decl = create_temporary_var (type);
+ DECL_INITIAL (decl) = compound_literal;
+ TREE_STATIC (decl) = 1;
+ decl = pushdecl_top_level (decl);
+ DECL_NAME (decl) = make_anon_name ();
+ SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
+ return decl;
+ }
+ else
+ return get_target_expr (compound_literal);
}
/* Return the declaration for the function-name variable indicated by
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index ff372206ee6..b7c0a8d33b8 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -616,6 +616,14 @@ build_cplus_array_type (tree elt_type, tree index_type)
return t;
}
+/* Return an ARRAY_TYPE with element type ELT and length N. */
+
+tree
+build_array_of_n_type (tree elt, int n)
+{
+ return build_cplus_array_type (elt, build_index_type (size_int (n - 1)));
+}
+
/* Return a reference type node referring to TO_TYPE. If RVAL is
true, return an rvalue reference type, otherwise return an lvalue
reference type. If a type node exists, reuse it, otherwise create
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index e34fa675b9f..14cbd9d8dd2 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -7164,6 +7164,7 @@ static int
comp_ptr_ttypes_real (tree to, tree from, int constp)
{
bool to_more_cv_qualified = false;
+ bool is_opaque_pointer = false;
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
@@ -7198,9 +7199,13 @@ comp_ptr_ttypes_real (tree to, tree from, int constp)
constp &= TYPE_READONLY (to);
}
+ if (TREE_CODE (to) == VECTOR_TYPE)
+ is_opaque_pointer = vector_targets_convertible_p (to, from);
+
if (TREE_CODE (to) != POINTER_TYPE && !TYPE_PTRMEM_P (to))
return ((constp >= 0 || to_more_cv_qualified)
- && same_type_ignoring_top_level_qualifiers_p (to, from));
+ && (is_opaque_pointer
+ || same_type_ignoring_top_level_qualifiers_p (to, from)));
}
}
@@ -7261,6 +7266,8 @@ ptr_reasonably_similar (const_tree to, const_tree from)
bool
comp_ptr_ttypes_const (tree to, tree from)
{
+ bool is_opaque_pointer = false;
+
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
if (TREE_CODE (to) != TREE_CODE (from))
@@ -7271,8 +7278,12 @@ comp_ptr_ttypes_const (tree to, tree from)
TYPE_OFFSET_BASETYPE (to)))
continue;
+ if (TREE_CODE (to) == VECTOR_TYPE)
+ is_opaque_pointer = vector_targets_convertible_p (to, from);
+
if (TREE_CODE (to) != POINTER_TYPE)
- return same_type_ignoring_top_level_qualifiers_p (to, from);
+ return (is_opaque_pointer
+ || same_type_ignoring_top_level_qualifiers_p (to, from));
}
}
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 05e88b9002e..4cf8021964f 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "output.h"
#include "diagnostic.h"
+#include "real.h"
static tree
process_init_constructor (tree type, tree init);
@@ -592,7 +593,7 @@ store_init_value (tree decl, tree init)
{
error ("constructor syntax used, but no constructor declared "
"for type %qT", type);
- init = build_constructor_from_list (NULL_TREE, nreverse (init));
+ init = build_constructor_from_list (init_list_type_node, nreverse (init));
}
}
else if (TREE_CODE (init) == TREE_LIST
@@ -631,15 +632,70 @@ store_init_value (tree decl, tree init)
}
+/* Give errors about narrowing conversions within { }. */
+
+void
+check_narrowing (tree type, tree init)
+{
+ tree ftype = TREE_TYPE (init);
+ bool ok = true;
+ REAL_VALUE_TYPE d;
+
+ if (DECL_P (init))
+ init = decl_constant_value (init);
+
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_CODE (ftype) == REAL_TYPE)
+ ok = false;
+ else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype)
+ && CP_INTEGRAL_TYPE_P (type))
+ {
+ if (TYPE_PRECISION (type) < TYPE_PRECISION (ftype)
+ && (TREE_CODE (init) != INTEGER_CST
+ || !int_fits_type_p (init, type)))
+ ok = false;
+ }
+ else if (TREE_CODE (ftype) == REAL_TYPE
+ && TREE_CODE (type) == REAL_TYPE)
+ {
+ if (TYPE_PRECISION (type) < TYPE_PRECISION (ftype))
+ {
+ ok = false;
+ if (TREE_CODE (init) == REAL_CST)
+ {
+ d = TREE_REAL_CST (init);
+ if (exact_real_truncate (TYPE_MODE (type), &d))
+ ok = true;
+ }
+ }
+ }
+ else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype)
+ && TREE_CODE (type) == REAL_TYPE)
+ {
+ ok = false;
+ if (TREE_CODE (init) == INTEGER_CST)
+ {
+ d = real_value_from_int_cst (0, init);
+ if (exact_real_truncate (TYPE_MODE (type), &d))
+ ok = true;
+ }
+ }
+
+ if (!ok)
+ error ("narrowing conversion of %qE to %qT inside { }", init, type);
+}
+
/* Process the initializer INIT for a variable of type TYPE, emitting
diagnostics for invalid initializers and converting the initializer as
appropriate.
For aggregate types, it assumes that reshape_init has already run, thus the
- initializer will have the right shape (brace elision has been undone). */
+ initializer will have the right shape (brace elision has been undone).
-tree
-digest_init (tree type, tree init)
+ NESTED is true iff we are being called for an element of a CONSTRUCTOR. */
+
+static tree
+digest_init_r (tree type, tree init, bool nested)
{
enum tree_code code = TREE_CODE (type);
@@ -706,6 +762,8 @@ digest_init (tree type, tree init)
{
tree *exp;
+ if (cxx_dialect != cxx98 && nested)
+ check_narrowing (type, init);
init = convert_for_initialization (0, type, init, LOOKUP_NORMAL,
"initialization", NULL_TREE, 0,
tf_warning_or_error);
@@ -731,7 +789,7 @@ digest_init (tree type, tree init)
|| TREE_CODE (type) == COMPLEX_TYPE);
if (BRACE_ENCLOSED_INITIALIZER_P (init))
- return process_init_constructor (type, init);
+ return process_init_constructor (type, init);
else
{
if (COMPOUND_LITERAL_P (init) && TREE_CODE (type) == ARRAY_TYPE)
@@ -757,6 +815,11 @@ digest_init (tree type, tree init)
}
}
+tree
+digest_init (tree type, tree init)
+{
+ return digest_init_r (type, init, false);
+}
/* Set of flags used within process_init_constructor to describe the
initializers. */
@@ -828,7 +891,7 @@ process_init_constructor_array (tree type, tree init)
else
ce->index = size_int (i);
gcc_assert (ce->value);
- ce->value = digest_init (TREE_TYPE (type), ce->value);
+ ce->value = digest_init_r (TREE_TYPE (type), ce->value, true);
if (ce->value != error_mark_node)
gcc_assert (same_type_ignoring_top_level_qualifiers_p
@@ -854,7 +917,7 @@ process_init_constructor_array (tree type, tree init)
next = build_functional_cast (TREE_TYPE (type), NULL_TREE,
tf_warning_or_error);
else
- next = build_constructor (NULL_TREE, NULL);
+ next = build_constructor (init_list_type_node, NULL);
next = digest_init (TREE_TYPE (type), next);
}
else if (!zero_init_p (TREE_TYPE (type)))
@@ -929,7 +992,7 @@ process_init_constructor_record (tree type, tree init)
}
gcc_assert (ce->value);
- next = digest_init (TREE_TYPE (field), ce->value);
+ next = digest_init_r (TREE_TYPE (field), ce->value, true);
++idx;
}
else if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (field)))
@@ -942,9 +1005,9 @@ process_init_constructor_record (tree type, tree init)
next = build_functional_cast (TREE_TYPE (field), NULL_TREE,
tf_warning_or_error);
else
- next = build_constructor (NULL_TREE, NULL);
+ next = build_constructor (init_list_type_node, NULL);
- next = digest_init (TREE_TYPE (field), next);
+ next = digest_init_r (TREE_TYPE (field), next, true);
/* Warn when some struct elements are implicitly initialized. */
warning (OPT_Wmissing_field_initializers,
@@ -1037,7 +1100,7 @@ process_init_constructor_union (tree type, tree init)
}
if (ce->value && ce->value != error_mark_node)
- ce->value = digest_init (TREE_TYPE (ce->index), ce->value);
+ ce->value = digest_init_r (TREE_TYPE (ce->index), ce->value, true);
return picflag_from_initializer (ce->value);
}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 28c99638ec3..0c46bdaa496 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3191,7 +3191,7 @@ df_set_note (enum reg_note note_type, rtx insn, rtx old, rtx reg)
}
/* Did not find the note. */
- REG_NOTES (insn) = alloc_EXPR_LIST (note_type, reg, REG_NOTES (insn));
+ add_reg_note (insn, note_type, reg);
return old;
}
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index b1b896527ba..86c2f46a49e 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1607,6 +1607,45 @@ Use installed @samp{zlib} rather than that included with GCC@.
@item --with-win32-nlsapi=ansi, unicows or unicode
Indicates how MinGW @samp{libgcj} translates between UNICODE
characters and the Win32 API@.
+
+@item --enable-java-home
+If enabled, this creates a JPackage compatible SDK environment during install.
+Note that if --enable-java-home is used, --with-arch-directory=ARCH must also
+be specified.
+
+@item --with-arch-directory=ARCH
+Specifies the name to use for the @file{jre/lib/ARCH} directory in the SDK
+environment created when --enable-java-home is passed. Typical names for this
+directory include i386, amd64, ia64, etc.
+
+@item --with-os-directory=DIR
+Specifies the OS directory for the SDK include directory. This is set to auto
+detect, and is typically 'linux'.
+
+@item --with-origin-name=NAME
+Specifies the JPackage origin name. This defaults to the 'gcj' in
+java-1.5.0-gcj.
+
+@item --with-arch-suffix=SUFFIX
+Specifies the suffix for the sdk directory. Defaults to the empty string.
+Examples include '.x86_64' in 'java-1.5.0-gcj-1.5.0.0.x86_64'.
+
+@item --with-jvm-root-dir=DIR
+Specifies where to install the SDK. Default is $(prefix)/lib/jvm.
+
+@item --with-jvm-jar-dir=DIR
+Specifies where to install jars. Default is $(prefix)/lib/jvm-exports.
+
+@item --with-python-dir=DIR
+Specifies where to install the Python modules used for aot-compile. DIR should
+not include the prefix used in installation. For example, if the Python modules
+are to be installed in /usr/lib/python2.5/site-packages, then
+--with-python-dir=/lib/python2.5/site-packages should be passed. If this is
+not specified, then the Python modules are installed in $(prefix)/share/python.
+
+@item --enable-aot-compile-rpm
+Adds aot-compile-rpm to the list of installed scripts.
+
@table @code
@item ansi
Use the single-byte @code{char} and the Win32 A functions natively,
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c59d88e492d..31d931e4960 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -359,10 +359,10 @@ Objective-C and Objective-C++ Dialects}.
-ftree-loop-distribution @gol
-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-reassoc @gol
--ftree-sink -ftree-sra -ftree-store-ccp -ftree-ter @gol
--ftree-vect-loop-version -ftree-vectorize -ftree-vrp -funit-at-a-time @gol
--funroll-all-loops -funroll-loops -funsafe-loop-optimizations @gol
--funsafe-math-optimizations -funswitch-loops @gol
+-ftree-sink -ftree-sra -ftree-store-ccp -ftree-switch-conversion @gol
+-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
+-funit-at-a-time -funroll-all-loops -funroll-loops @gol
+-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
-fwhole-program @gol
--param @var{name}=@var{value}
@@ -5194,6 +5194,7 @@ also turns on the following optimization flags:
-fsched-interblock -fsched-spec @gol
-fschedule-insns -fschedule-insns2 @gol
-fstrict-aliasing -fstrict-overflow @gol
+-ftree-switch-conversion @gol
-ftree-pre @gol
-ftree-vrp}
@@ -5868,6 +5869,11 @@ pass operates on both local scalar variables and memory stores and
loads (global variables, structures, arrays, etc). This flag is
enabled by default at @option{-O2} and higher.
+@item -ftree-switch-conversion
+Perform conversion of simple initializations in a switch to
+initializations from a scalar array. This flag is enabled by default
+at @option{-O2} and higher.
+
@item -ftree-dce
@opindex ftree-dce
Perform dead code elimination (DCE) on trees. This flag is enabled by
@@ -7344,6 +7350,11 @@ mechanism for comparing types in C++ and Objective-C++. However, if
bugs in the canonical type system are causing compilation failures,
set this value to 0 to disable canonical types.
+@item switch-conversion-max-branch-ratio
+Switch initialization conversion will refuse to create arrays that are
+bigger than @option{switch-conversion-max-branch-ratio} times the number of
+branches in the switch.
+
@item max-partial-antic-length
Maximum length of the partial antic set computed during the tree
partial redundancy elimination optimization (@option{-ftree-pre}) when
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 418da241b66..22c7979a773 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3044,9 +3044,8 @@ link_cc0_insns (rtx insn)
if (NONJUMP_INSN_P (user) && GET_CODE (PATTERN (user)) == SEQUENCE)
user = XVECEXP (PATTERN (user), 0, 0);
- REG_NOTES (user) = gen_rtx_INSN_LIST (REG_CC_SETTER, insn,
- REG_NOTES (user));
- REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_CC_USER, user, REG_NOTES (insn));
+ add_reg_note (user, REG_CC_SETTER, insn);
+ add_reg_note (insn, REG_CC_USER, user);
}
/* Return the next insn that uses CC0 after INSN, which is assumed to
@@ -3223,10 +3222,7 @@ try_split (rtx pat, rtx trial, int last)
is responsible for this step using
split_branch_probability variable. */
gcc_assert (njumps == 1);
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_BR_PROB,
- GEN_INT (probability),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_BR_PROB, GEN_INT (probability));
}
}
}
@@ -3257,10 +3253,7 @@ try_split (rtx pat, rtx trial, int last)
if (CALL_P (insn)
|| (flag_non_call_exceptions && INSN_P (insn)
&& may_trap_p (PATTERN (insn))))
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_EH_REGION,
- XEXP (note, 0),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_EH_REGION, XEXP (note, 0));
}
break;
@@ -3269,10 +3262,7 @@ try_split (rtx pat, rtx trial, int last)
for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
{
if (CALL_P (insn))
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
- XEXP (note, 0),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_NOTE_KIND (note), XEXP (note, 0));
}
break;
@@ -3280,10 +3270,7 @@ try_split (rtx pat, rtx trial, int last)
for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
{
if (JUMP_P (insn))
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
- XEXP (note, 0),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_NOTE_KIND (note), XEXP (note, 0));
}
break;
@@ -3294,8 +3281,7 @@ try_split (rtx pat, rtx trial, int last)
rtx reg = XEXP (note, 0);
if (!FIND_REG_INC_NOTE (insn, reg)
&& for_each_rtx (&PATTERN (insn), find_auto_inc, reg) > 0)
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_INC, reg,
- REG_NOTES (insn));
+ add_reg_note (insn, REG_INC, reg);
}
break;
#endif
@@ -4600,7 +4586,6 @@ rtx
set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
{
rtx note = find_reg_note (insn, kind, NULL_RTX);
- rtx new_note = NULL;
switch (kind)
{
@@ -4638,8 +4623,7 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
break;
}
- new_note = gen_rtx_EXPR_LIST (kind, datum, REG_NOTES (insn));
- REG_NOTES (insn) = new_note;
+ add_reg_note (insn, kind, datum);
switch (kind)
{
@@ -5525,13 +5509,10 @@ emit_copy_of_insn_after (rtx insn, rtx after)
if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
{
if (GET_CODE (link) == EXPR_LIST)
- REG_NOTES (new)
- = gen_rtx_EXPR_LIST (REG_NOTE_KIND (link),
- copy_insn_1 (XEXP (link, 0)), REG_NOTES (new));
+ add_reg_note (new, REG_NOTE_KIND (link),
+ copy_insn_1 (XEXP (link, 0)));
else
- REG_NOTES (new)
- = gen_rtx_INSN_LIST (REG_NOTE_KIND (link),
- XEXP (link, 0), REG_NOTES (new));
+ add_reg_note (new, REG_NOTE_KIND (link), XEXP (link, 0));
}
INSN_CODE (new) = INSN_CODE (insn);
diff --git a/gcc/expr.c b/gcc/expr.c
index 6d6278a7bc7..33616d6900e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7102,10 +7102,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
&& GET_CODE (PATTERN (insn)) != CLOBBER
&& GET_CODE (PATTERN (insn)) != USE
&& (CALL_P (insn) || may_trap_p (PATTERN (insn))))
- {
- REG_NOTES (insn) = alloc_EXPR_LIST (REG_EH_REGION, GEN_INT (rn),
- REG_NOTES (insn));
- }
+ add_reg_note (insn, REG_EH_REGION, GEN_INT (rn));
}
}
diff --git a/gcc/final.c b/gcc/final.c
index 5a002c064e1..b583f03bea3 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1385,6 +1385,9 @@ asm_insn_count (rtx body)
else
template = decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL);
+ if (!*template)
+ return 0;
+
for (; *template; template++)
if (IS_ASM_LOGICAL_LINE_SEPARATOR (*template, template)
|| *template == '\n')
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a54a0b14909..82c2392d14d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2008-07-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/36590
+ PR fortran/36681
+ * iresolve.c (resolve_mask_arg): Don't convert mask to
+ kind=1 logical if it is of that type already.
+
2008-06-29 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36341
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index a1e7622a866..64a24e80007 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -106,7 +106,7 @@ resolve_mask_arg (gfc_expr *mask)
/* In the library, we access the mask with a GFC_LOGICAL_1
argument. No need to waste memory if we are about to create
a temporary array. */
- if (mask->expr_type == EXPR_OP)
+ if (mask->expr_type == EXPR_OP && mask->ts.kind != 1)
{
ts.type = BT_LOGICAL;
ts.kind = 1;
diff --git a/gcc/function.c b/gcc/function.c
index 680b3604859..d8234da3877 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2352,6 +2352,30 @@ assign_parm_adjust_entry_rtl (struct assign_parm_data_one *data)
data->entry_parm = entry_parm;
}
+/* A subroutine of assign_parms. Reconstitute any values which were
+ passed in multiple registers and would fit in a single register. */
+
+static void
+assign_parm_remove_parallels (struct assign_parm_data_one *data)
+{
+ rtx entry_parm = data->entry_parm;
+
+ /* Convert the PARALLEL to a REG of the same mode as the parallel.
+ This can be done with register operations rather than on the
+ stack, even if we will store the reconstituted parameter on the
+ stack later. */
+ if (GET_CODE (entry_parm) == PARALLEL
+ && data->passed_mode != BLKmode)
+ {
+ rtx parmreg = gen_reg_rtx (GET_MODE (entry_parm));
+ emit_group_store (parmreg, entry_parm, NULL_TREE,
+ GET_MODE_SIZE (GET_MODE (entry_parm)));
+ entry_parm = parmreg;
+ }
+
+ data->entry_parm = entry_parm;
+}
+
/* A subroutine of assign_parms. Adjust DATA->STACK_RTL such that it's
always valid and properly aligned. */
@@ -2397,8 +2421,6 @@ assign_parm_setup_block_p (struct assign_parm_data_one *data)
{
if (data->nominal_mode == BLKmode)
return true;
- if (GET_CODE (data->entry_parm) == PARALLEL)
- return true;
#ifdef BLOCK_REG_PADDING
/* Only assign_parm_setup_block knows how to deal with register arguments
@@ -2424,59 +2446,10 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
rtx stack_parm = data->stack_parm;
HOST_WIDE_INT size;
HOST_WIDE_INT size_stored;
- rtx orig_entry_parm = entry_parm;
if (GET_CODE (entry_parm) == PARALLEL)
entry_parm = emit_group_move_into_temps (entry_parm);
- /* If we've a non-block object that's nevertheless passed in parts,
- reconstitute it in register operations rather than on the stack. */
- if (GET_CODE (entry_parm) == PARALLEL
- && data->nominal_mode != BLKmode)
- {
- rtx elt0 = XEXP (XVECEXP (orig_entry_parm, 0, 0), 0);
-
- if ((XVECLEN (entry_parm, 0) > 1
- || hard_regno_nregs[REGNO (elt0)][GET_MODE (elt0)] > 1)
- && use_register_for_decl (parm))
- {
- rtx parmreg = gen_reg_rtx (data->nominal_mode);
-
- push_to_sequence2 (all->first_conversion_insn,
- all->last_conversion_insn);
-
- /* For values returned in multiple registers, handle possible
- incompatible calls to emit_group_store.
-
- For example, the following would be invalid, and would have to
- be fixed by the conditional below:
-
- emit_group_store ((reg:SF), (parallel:DF))
- emit_group_store ((reg:SI), (parallel:DI))
-
- An example of this are doubles in e500 v2:
- (parallel:DF (expr_list (reg:SI) (const_int 0))
- (expr_list (reg:SI) (const_int 4))). */
- if (data->nominal_mode != data->passed_mode)
- {
- rtx t = gen_reg_rtx (GET_MODE (entry_parm));
- emit_group_store (t, entry_parm, NULL_TREE,
- GET_MODE_SIZE (GET_MODE (entry_parm)));
- convert_move (parmreg, t, 0);
- }
- else
- emit_group_store (parmreg, entry_parm, data->nominal_type,
- int_size_in_bytes (data->nominal_type));
-
- all->first_conversion_insn = get_insns ();
- all->last_conversion_insn = get_last_insn ();
- end_sequence ();
-
- SET_DECL_RTL (parm, parmreg);
- return;
- }
- }
-
size = int_size_in_bytes (data->passed_type);
size_stored = CEIL_ROUND (size, UNITS_PER_WORD);
if (stack_parm == 0)
@@ -2641,6 +2614,8 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
else
SET_DECL_RTL (parm, parmreg);
+ assign_parm_remove_parallels (data);
+
/* Copy the value into the register. */
if (data->nominal_mode != data->passed_mode
|| promoted_nominal_mode != data->promoted_mode)
@@ -2803,6 +2778,8 @@ assign_parm_setup_stack (struct assign_parm_data_all *all, tree parm,
execution. */
bool to_conversion = false;
+ assign_parm_remove_parallels (data);
+
if (data->promoted_mode != data->nominal_mode)
{
/* Conversion is required. */
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 771df43a321..0955744855c 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4562,9 +4562,8 @@ add_label_notes (rtx x, rtx insn)
such a LABEL_REF, so we don't have to handle REG_LABEL_TARGET
notes. */
gcc_assert (!JUMP_P (insn));
- REG_NOTES (insn)
- = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, XEXP (x, 0),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_LABEL_OPERAND, XEXP (x, 0));
+
if (LABEL_P (XEXP (x, 0)))
LABEL_NUSES (XEXP (x, 0))++;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 8d5b38bbf32..d614986b49c 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -3773,11 +3773,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
/* any_condjump_p (jump) == false.
We don't need the same note for the check because
any_condjump_p (check) == true. */
- {
- REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
- NULL_RTX,
- REG_NOTES (jump));
- }
+ add_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
edge_flags = EDGE_CROSSING;
}
else
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index b5ceb09f1b9..33ac01f7a7c 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,14 @@
+2008-06-30 Joshua Sumali <jsumali@redhat.com>
+
+ * Make-lang.in (JAVA_MANFILES): Add doc/aot-compile.1 and
+ doc/rebuild-gcj-db.1
+ (java.uninstall): Likewise.
+ (java.maintainer-clean): Likewise.
+ (aot-compile.pod): New rule.
+ (rebuild-gcj-db.pod): New rule.
+ (java.install-man): Install doc/aot-compile.1 and doc/rebuild-gcj-db.1
+ * gcj.texi: Add new sections for aot-compile and rebuild-gcj-db.
+
2008-06-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in (java/jcf-io.o-warn): New.
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index badbb7fdfbf..cab40afb959 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -146,8 +146,9 @@ java.pdf: $(JAVA_PDFFILES)
java.html: $(build_htmldir)/java/index.html
JAVA_MANFILES = doc/gcj.1 doc/jcf-dump.1 doc/gij.1 \
- doc/jv-convert.1 doc/grmic.1\
- doc/gcj-dbtool.1 doc/gc-analyze.1
+ doc/jv-convert.1 doc/grmic.1 \
+ doc/gcj-dbtool.1 doc/gc-analyze.1 doc/aot-compile.1 \
+ doc/rebuild-gcj-db.1
java.man: $(JAVA_MANFILES)
@@ -192,6 +193,8 @@ java.uninstall:
-rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
-rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
-rm -rf $(DESTDIR)$(man1dir)/gcj-dbtool$(man1ext)
+ -rm -rf $(DESTDIR)$(man1dir)/aot-compile$(man1ext)
+ -rm -rf $(DESTDIR)$(man1dir)/rebuild-gcj-db$(man1ext)
java.install-info: $(DESTDIR)$(infodir)/gcj.info
@@ -226,6 +229,8 @@ java.maintainer-clean:
-rm -f $(docobjdir)/grmic.1
-rm -f $(docobjdir)/gcj-dbtool.1
-rm -f $(docobjdir)/gc-analyze.1
+ -rm -f $(docobjdir)/aot-compile.1
+ -rm -f $(docobjdir)/rebuild-gcj-db.1
#
# Stage hooks:
# The main makefile has already created stage?/java.
@@ -356,15 +361,21 @@ gcj-dbtool.pod: java/gcj.texi
-$(TEXI2POD) -D gcj-dbtool < $< > $@
gc-analyze.pod: java/gcj.texi
-$(TEXI2POD) -D gc-analyze < $< > $@
+aot-compile.pod: java/gcj.texi
+ -$(TEXI2POD) -D aot-compile < $< > $@
+rebuild-gcj-db.pod: java/gcj.texi
+ -$(TEXI2POD) -D rebuild-gcj-db < $< > $@
# Install the man pages.
java.install-man: installdirs \
$(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext) \
$(JAVA_TARGET_INDEPENDENT_BIN_TOOLS:%=doc/%.1) \
doc/gij.1 doc/jv-convert.1 doc/grmic.1 \
- doc/gcj-dbtool.1 doc/gc-analyze.1
+ doc/gcj-dbtool.1 doc/gc-analyze.1 \
+ doc/aot-compile.1 doc/rebuild-gcj-db.1
for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS) \
- gij jv-convert grmic gcj-dbtool gc-analyze ; do \
+ gij jv-convert grmic gcj-dbtool gc-analyze aot-compile \
+ rebuild-gcj-db; do \
tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
man_name=$(DESTDIR)$(man1dir)/$${tool_transformed_name}$(man1ext); \
rm -f $$man_name ; \
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 94172d80b20..179e620f8c9 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -72,6 +72,11 @@ man page gfdl(7).
Generate stubs for Remote Method Invocation.
* gc-analyze: (gcj)Invoking gc-analyze.
Analyze Garbage Collector (GC) memory dumps.
+* aot-compile: (gcj)Invoking aot-compile.
+ Compile bytecode to native and generate databases.
+* rebuild-gcj-db: (gcj)Invoking rebuild-gcj-db.
+ Merge the per-solib databases made by aot-compile
+ into one system-wide database.
@end direntry
@end format
@@ -115,6 +120,9 @@ files and object files, and it can read both Java source code and
* Invoking jv-convert:: Converting from one encoding to another
* Invoking grmic:: Generate stubs for Remote Method Invocation.
* Invoking gc-analyze:: Analyze Garbage Collector (GC) memory dumps.
+* Invoking aot-compile:: Compile bytecode to native and generate databases.
+* Invoking rebuild-gcj-db:: Merge the per-solib databases made by aot-compile
+ into one system-wide database.
* About CNI:: Description of the Compiled Native Interface
* System properties:: Modifying runtime behavior of the libgcj library
* Resources:: Where to look for more information
@@ -921,7 +929,7 @@ gcj-dbtool [@option{-0}] [@option{-}] [@option{-n}] [@option{-a}] [@option{-f}]
[@option{-v}] [@option{-m}] [@option{--version}] [@option{--help}]
@c man end
-@c man begin SEEALSO gij
+@c man begin SEEALSO gcj-dbtool
gcc(1), gcj(1), gcjh(1), jcf-dump(1), gfdl(7),
and the Info entries for @file{gcj} and @file{gcc}.
@c man end
@@ -1219,6 +1227,87 @@ Print version information, then exit.
@c man end
+@node Invoking aot-compile
+@chapter Invoking aot-compile
+
+@c man title aot-compile Compile bytecode to native and generate databases
+
+@ignore
+
+@c man begin SYNOPSIS aot-compile
+aot-compile [@option{OPTION}] @dots{} @var{SRCDIR} @var{DSTDIR}
+
+aot-compile [@option{-M, --make}=@var{PATH}] [@option{-C, --gcj}=@var{PATH}]
+ [@option{-D, --dbtool}=@var{PATH}] [@option{-m, --makeflags}=@var{FLAGS}]
+ [@option{-c, --gcjflags}=@var{FLAGS}] [@option{-l, --ldflags}=@var{FLAGS}]
+ [@option{-e, --exclude}=@var{PATH}]
+@c man end
+
+@c man begin SEEALSO aot-compile
+gcc(1), gcj(1), gcjh(1), jcf-dump(1), gfdl(7),
+and the Info entries for @file{gcj} and @file{gcc}.
+@c man end
+
+@end ignore
+
+@c man begin DESCRIPTION aot-compile
+@code{aot-compile} is a script that searches a directory for Java bytecode
+(as class files, or in jars) and uses @code{gcj} to compile it to native
+code and generate the databases from it.
+@c man end
+
+@c man begin OPTIONS aot-compile
+@table @gcctabopt
+@item -M, --make=@var{PATH}
+Specify the path to the @code{make} executable to use.
+
+@item -C, --gcj=@var{PATH}
+Specify the path to the @code{gcj} executable to use.
+
+@item -D, --dbtool=@var{PATH}
+Specify the path to the @code{gcj-dbtool} executable to use.
+
+@item -m, --makeflags=@var{FLAGS}
+Specify flags to pass to @code{make} during the build.
+
+@item -c, --gcjflags=@var{FLAGS}
+Specify flags to pass to @code{gcj} during compilation, in addition to
+'-fPIC -findirect-dispatch -fjni'.
+
+@item -l, --ldflags=@var{FLAGS}
+Specify flags to pass to @code{gcj} during linking, in addition to
+'-Wl,-Bsymbolic'.
+
+@item -e, --exclude=@var{PATH}
+Do not compile @var{PATH}.
+
+@end table
+
+@c man end
+
+@node Invoking rebuild-gcj-db
+@chapter Invoking rebuild-gcj-db
+
+@c man title rebuild-gcj-db Merge the per-solib databases made by aot-compile into one system-wide database.
+@ignore
+
+@c man begin SYNOPSIS rebuild-gcj-db
+rebuild-gcj-db
+@c man end
+
+@c man begin SEEALSO rebuild-gcj-db
+gcc(1), gcj(1), gcjh(1), jcf-dump(1), gfdl(7),
+and the Info entries for @file{gcj} and @file{gcc}.
+@c man end
+
+@end ignore
+
+@c man begin DESCRIPTION rebuild-gcj-db
+@code{rebuild-gcj-db} is a script that merges the per-solib databases made by
+@code{aot-compile} into one system-wide database so @code{gij} can find the
+solibs.
+@c man end
+
@node About CNI
@chapter About CNI
diff --git a/gcc/jump.c b/gcc/jump.c
index 23d183e932c..595363b1adb 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1068,8 +1068,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
a label, except for the primary target of a jump,
must have such a note. */
if (! find_reg_note (insn, kind, label))
- REG_NOTES (insn)
- = gen_rtx_INSN_LIST (kind, label, REG_NOTES (insn));
+ add_reg_note (insn, kind, label);
}
}
return;
diff --git a/gcc/libgcc-std.ver b/gcc/libgcc-std.ver
index 89be00cf3be..1df9ab1b3f9 100644
--- a/gcc/libgcc-std.ver
+++ b/gcc/libgcc-std.ver
@@ -1800,3 +1800,7 @@ GCC_4.3.0 {
__satfractunstiuda
__satfractunstiuta
}
+
+%inherit GCC_4.4.0 GCC_4.3.0
+GCC_4.4.0 {
+}
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index c6e0540d15f..293b3ae3776 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -321,9 +321,8 @@ add_test (rtx cond, edge *e, basic_block dest)
JUMP_LABEL (jump) = label;
/* The jump is supposed to handle an unlikely special case. */
- REG_NOTES (jump)
- = gen_rtx_EXPR_LIST (REG_BR_PROB,
- const0_rtx, REG_NOTES (jump));
+ add_reg_note (jump, REG_BR_PROB, const0_rtx);
+
LABEL_NUSES (label)++;
make_edge (bb, dest, (*e)->flags & ~EDGE_FALLTHRU);
@@ -518,18 +517,14 @@ doloop_modify (struct loop *loop, struct niter_desc *desc,
/* Add a REG_NONNEG note if the actual or estimated maximum number
of iterations is non-negative. */
if (nonneg)
- {
- REG_NOTES (jump_insn)
- = gen_rtx_EXPR_LIST (REG_NONNEG, NULL_RTX, REG_NOTES (jump_insn));
- }
+ add_reg_note (jump_insn, REG_NONNEG, NULL_RTX);
+
/* Update the REG_BR_PROB note. */
if (true_prob_val)
{
/* Seems safer to use the branch probability. */
- REG_NOTES (jump_insn) =
- gen_rtx_EXPR_LIST (REG_BR_PROB,
- GEN_INT (desc->in_edge->probability),
- REG_NOTES (jump_insn));
+ add_reg_note (jump_insn, REG_BR_PROB,
+ GEN_INT (desc->in_edge->probability));
}
}
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index 54c39a5698a..9d66d41db6e 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -125,8 +125,8 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
JUMP_LABEL (jump) = label;
LABEL_NUSES (label)++;
}
- REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_BR_PROB, GEN_INT (prob),
- REG_NOTES (jump));
+ add_reg_note (jump, REG_BR_PROB, GEN_INT (prob));
+
seq = get_insns ();
end_sequence ();
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 67a95984fab..57205b51e61 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -551,8 +551,7 @@ move_eh_region_note (rtx insn, rtx insns)
|| (flag_non_call_exceptions
&& INSN_P (p)
&& may_trap_p (PATTERN (p))))
- REG_NOTES (p) = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (note, 0),
- REG_NOTES (p));
+ add_reg_note (p, REG_EH_REGION, XEXP (note, 0));
}
}
diff --git a/gcc/mkmap-symver.awk b/gcc/mkmap-symver.awk
index 855043f7e6c..4877e905147 100644
--- a/gcc/mkmap-symver.awk
+++ b/gcc/mkmap-symver.awk
@@ -46,7 +46,8 @@ state == "nm" && ($1 == "U" || $2 == "U") {
}
state == "nm" && NF == 3 {
- def[$3] = 1;
+ split ($3, s, "@")
+ def[s[1]] = 1;
sawsymbol = 1;
next;
}
@@ -82,10 +83,13 @@ $1 == "}" {
{
sym = prefix $1;
+ symbols[sym] = 1
if (thislib != "%exclude")
- ver[sym] = thislib;
- else
- delete ver[sym];
+ ver[sym, thislib] = 1;
+ else {
+ for (l in libs)
+ ver[sym, l] = 0;
+ }
next;
}
@@ -107,8 +111,8 @@ function output(lib) {
output(inherit[lib]);
empty=1
- for (sym in ver)
- if ((ver[sym] == lib) && (sym in def))
+ for (sym in symbols)
+ if ((ver[sym, lib] != 0) && (sym in def))
{
if (empty)
{
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 32a6396bd70..6e8c6cf3d21 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3879,8 +3879,7 @@ emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
if (note != 0)
XEXP (note, 0) = constm1_rtx;
else
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, constm1_rtx,
- REG_NOTES (insn));
+ add_reg_note (insn, REG_EH_REGION, constm1_rtx);
}
/* First emit all insns that set pseudos. Remove them from the list as
diff --git a/gcc/opts.c b/gcc/opts.c
index 226030bcde0..0bea9e4e94b 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -891,6 +891,7 @@ decode_options (unsigned int argc, const char **argv)
flag_reorder_functions = 1;
flag_tree_store_ccp = 1;
flag_tree_vrp = 1;
+ flag_tree_switch_conversion = 1;
if (!optimize_size)
{
diff --git a/gcc/params.def b/gcc/params.def
index d80deff01ea..d1f8fcec0e7 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -710,6 +710,15 @@ DEFPARAM (PARAM_DF_DOUBLE_QUEUE_THRESHOLD_FACTOR,
"Multiplier used for determining the double-queueing threshold",
2, 0, 0)
+/* Switch initialization conversion will refuse to create arrays that are
+ bigger than this parameter times the number of switch branches. */
+
+DEFPARAM (PARAM_SWITCH_CONVERSION_BRANCH_RATIO,
+ "switch-conversion-max-branch-ratio",
+ "The maximum ratio between array size and switch branches for "
+ "a switch conversion to take place",
+ 8, 1, 0)
+
/*
Local variables:
mode:c
diff --git a/gcc/params.h b/gcc/params.h
index bb3afb3354d..7e08ec741e5 100644
--- a/gcc/params.h
+++ b/gcc/params.h
@@ -167,4 +167,6 @@ typedef enum compiler_param
PARAM_VALUE (PARAM_L2_CACHE_SIZE)
#define USE_CANONICAL_TYPES \
PARAM_VALUE (PARAM_USE_CANONICAL_TYPES)
+#define SWITCH_CONVERSION_BRANCH_RATIO \
+ PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO)
#endif /* ! GCC_PARAMS_H */
diff --git a/gcc/passes.c b/gcc/passes.c
index ba6151a4cd7..e1d019fa9fd 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -572,6 +572,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_update_address_taken);
NEXT_PASS (pass_simple_dse);
NEXT_PASS (pass_tail_recursion);
+ NEXT_PASS (pass_convert_switch);
NEXT_PASS (pass_profile);
NEXT_PASS (pass_release_ssa_names);
}
diff --git a/gcc/predict.c b/gcc/predict.c
index ca7f9448d01..ad5e8eae232 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -263,12 +263,10 @@ predict_insn (rtx insn, enum br_predictor predictor, int probability)
if (!flag_guess_branch_prob)
return;
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_BR_PRED,
- gen_rtx_CONCAT (VOIDmode,
- GEN_INT ((int) predictor),
- GEN_INT ((int) probability)),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_BR_PRED,
+ gen_rtx_CONCAT (VOIDmode,
+ GEN_INT ((int) predictor),
+ GEN_INT ((int) probability)));
}
/* Predict insn by given predictor. */
@@ -561,9 +559,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
if (!prob_note)
{
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_BR_PROB,
- GEN_INT (combined_probability), REG_NOTES (insn));
+ add_reg_note (insn, REG_BR_PROB, GEN_INT (combined_probability));
/* Save the prediction into CFG in case we are seeing non-degenerated
conditional jump. */
diff --git a/gcc/recog.c b/gcc/recog.c
index a176ed30af6..3ddfd86c635 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3045,10 +3045,9 @@ peephole2_optimize (void)
{
case REG_NORETURN:
case REG_SETJMP:
- REG_NOTES (new_insn)
- = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
- XEXP (note, 0),
- REG_NOTES (new_insn));
+ add_reg_note (new_insn, REG_NOTE_KIND (note),
+ XEXP (note, 0));
+ break;
default:
/* Discard all other reg notes. */
break;
@@ -3096,10 +3095,7 @@ peephole2_optimize (void)
&& !find_reg_note (x, REG_EH_REGION, NULL)))
{
if (note)
- REG_NOTES (x)
- = gen_rtx_EXPR_LIST (REG_EH_REGION,
- XEXP (note, 0),
- REG_NOTES (x));
+ add_reg_note (x, REG_EH_REGION, XEXP (note, 0));
if (x != BB_END (bb) && eh_edge)
{
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index ffa06fd5752..4b5e422e207 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -788,9 +788,7 @@ emit_pop_insn (rtx insn, stack regstack, rtx reg, enum emit_where where)
else
pop_insn = emit_insn_before (pop_rtx, insn);
- REG_NOTES (pop_insn)
- = gen_rtx_EXPR_LIST (REG_DEAD, FP_MODE_REG (FIRST_STACK_REG, DFmode),
- REG_NOTES (pop_insn));
+ add_reg_note (pop_insn, REG_DEAD, FP_MODE_REG (FIRST_STACK_REG, DFmode));
regstack->reg[regstack->top - (hard_regno - FIRST_STACK_REG)]
= regstack->reg[regstack->top];
@@ -1064,8 +1062,7 @@ move_for_stack_reg (rtx insn, stack regstack, rtx pat)
push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
emit_insn_before (push_rtx, insn);
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, top_stack_reg,
- REG_NOTES (insn));
+ add_reg_note (insn, REG_DEAD, top_stack_reg);
}
replace_reg (psrc, FIRST_STACK_REG);
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 4a53defed24..7de8d0d5b98 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -200,9 +200,8 @@ try_auto_increment (rtx insn, rtx inc_insn, rtx inc_insn_set, rtx reg,
if (note)
PUT_MODE (note, REG_UNUSED);
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_INC,
- reg, REG_NOTES (insn));
+ add_reg_note (insn, REG_INC, reg);
+
if (! inc_insn_set)
delete_insn (inc_insn);
return 1;
diff --git a/gcc/reload.c b/gcc/reload.c
index 9ab01375a91..e426d3634f6 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -4145,9 +4145,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
&& (!JUMP_P (insn)
|| !label_is_jump_target_p (XEXP (substitution, 0),
insn)))
- REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND,
- XEXP (substitution, 0),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_LABEL_OPERAND, XEXP (substitution, 0));
}
else
retval |= (substed_operand[i] != *recog_data.operand_loc[i]);
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 297acbf8aa5..f449ffa9c32 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -4000,8 +4000,7 @@ fixup_eh_region_note (rtx insn, rtx prev, rtx next)
if (INSN_P (i) && i != insn && may_trap_p (PATTERN (i)))
{
trap_count++;
- REG_NOTES (i)
- = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (note, 0), REG_NOTES (i));
+ add_reg_note (i, REG_EH_REGION, XEXP (note, 0));
}
}
@@ -4235,9 +4234,7 @@ reload_as_needed (int live_known)
}
if (n == 1)
{
- REG_NOTES (p)
- = gen_rtx_EXPR_LIST (REG_INC, reload_reg,
- REG_NOTES (p));
+ add_reg_note (p, REG_INC, reload_reg);
/* Mark this as having an output reload so that the
REG_INC processing code below won't invalidate
the reload for inheritance. */
@@ -8535,8 +8532,7 @@ add_auto_inc_notes (rtx insn, rtx x)
if (code == MEM && auto_inc_p (XEXP (x, 0)))
{
- REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_INC, XEXP (XEXP (x, 0), 0), REG_NOTES (insn));
+ add_reg_note (insn, REG_INC, XEXP (XEXP (x, 0), 0));
return;
}
@@ -8563,9 +8559,7 @@ copy_eh_notes (rtx insn, rtx x)
for (; x != 0; x = NEXT_INSN (x))
{
if (may_trap_p (PATTERN (x)))
- REG_NOTES (x)
- = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (eh_note, 0),
- REG_NOTES (x));
+ add_reg_note (x, REG_EH_REGION, XEXP (eh_note, 0));
}
}
}
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 7135a188574..25f410aad2d 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3217,9 +3217,7 @@ delete_prior_computation (rtx note, rtx insn)
{
int i;
- REG_NOTES (our_prev)
- = gen_rtx_EXPR_LIST (REG_UNUSED, reg,
- REG_NOTES (our_prev));
+ add_reg_note (our_prev, REG_UNUSED, reg);
for (i = dest_regno; i < dest_endregno; i++)
if (! find_regno_note (our_prev, REG_UNUSED, i))
@@ -3281,8 +3279,7 @@ delete_computation (rtx insn)
delete_computation (prev);
else
/* Otherwise, show that cc0 won't be used. */
- REG_NOTES (prev) = gen_rtx_EXPR_LIST (REG_UNUSED,
- cc0_rtx, REG_NOTES (prev));
+ add_reg_note (prev, REG_UNUSED, cc0_rtx);
}
}
#endif
@@ -4024,9 +4021,7 @@ dbr_schedule (rtx first)
continue;
pred_flags = get_jump_flags (insn, JUMP_LABEL (insn));
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_BR_PRED,
- GEN_INT (pred_flags),
- REG_NOTES (insn));
+ add_reg_note (insn, REG_BR_PRED, GEN_INT (pred_flags));
}
free_resource_info ();
free (uid_to_ruid);
diff --git a/gcc/resource.c b/gcc/resource.c
index 05308491f61..009fb6e609b 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -266,13 +266,10 @@ mark_referenced_resources (rtx x, struct resources *res,
return;
case UNSPEC_VOLATILE:
+ case TRAP_IF:
case ASM_INPUT:
/* Traditional asm's are always volatile. */
res->volatil = 1;
- return;
-
- case TRAP_IF:
- res->volatil = 1;
break;
case ASM_OPERANDS:
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 2e0884f8f56..b2b561c3421 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1755,6 +1755,7 @@ extern rtx find_reg_equal_equiv_note (const_rtx);
extern rtx find_constant_src (const_rtx);
extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
+extern void add_reg_note (rtx, enum reg_note, rtx);
extern void remove_note (rtx, const_rtx);
extern void remove_reg_equal_equiv_notes (rtx);
extern int side_effects_p (const_rtx);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index dec7daf0e3d..d569ff04b2b 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1842,6 +1842,34 @@ find_regno_fusage (const_rtx insn, enum rtx_code code, unsigned int regno)
}
+/* Add register note with kind KIND and datum DATUM to INSN. */
+
+void
+add_reg_note (rtx insn, enum reg_note kind, rtx datum)
+{
+ rtx note;
+
+ switch (kind)
+ {
+ case REG_CC_SETTER:
+ case REG_CC_USER:
+ case REG_LABEL_TARGET:
+ case REG_LABEL_OPERAND:
+ /* These types of register notes use an INSN_LIST rather than an
+ EXPR_LIST, so that copying is done right and dumps look
+ better. */
+ note = alloc_INSN_LIST (datum, REG_NOTES (insn));
+ PUT_REG_NOTE_KIND (note, kind);
+ break;
+
+ default:
+ note = alloc_EXPR_LIST (kind, datum, REG_NOTES (insn));
+ break;
+ }
+
+ REG_NOTES (insn) = note;
+}
+
/* Remove register note NOTE from the REG_NOTES of INSN. */
void
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3a2c9a1b1e2..9b7ec4fedfd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,134 @@
-2008-06-30 Uros Bizjak <ubizjak@gmail.com>
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * g++.dg/abi/mangle24.C: Remove -mmmx.
+ * gcc.dg/const-float80-ped.c: Likewise.
+ * gcc.dg/const-float80.c: Likewise.
+ * gcc.dg/torture/fp-int-convert-float80.c: Likewise.
+
+ * g++.dg/abi/mangle25.C: Enable x86.
+ * gcc.dg/const-float128-ped.c: Likewise.
+ * gcc.dg/const-float128.c: Likewise.
+ * gcc.dg/torture/fp-int-convert-float128.c: Likewise.
+ * gcc.target/i386/pr32191.c: Likewise.
+ * gcc.target/i386/pr32268.c: Likewise.
+
+2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ PR target/36698
+ * gcc.c-torture/compile/20001226-1.c: XFAIL -O0 case on SPU.
+
+ * gcc.dg/pr27095.c: Provide target-specific regexp for SPU.
+
+2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * lib/compat.exp (compat-execute): Add -ffunction-sections
+ and -Wl,--auto-overlay when building for spu-*-elf*.
+
+2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gcc.dg/nrv3.c (S): Increase size of padding for SPU.
+ * g++.dg/opt/temp1.C (struct T): Likewise.
+
+2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gcc.c-torture/execute/20030222-1.x: New file.
+ * gcc.dg/tree-ssa/ssa-fre-3.c: Disable test on SPU.
+ * gcc.dg/lower-subreg-1.c: Likewise.
+
+2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ SPU single-precision FP does not support subnormals:
+ * gcc.c-torture/execute/ieee/mul-subnormal-single-1.x: New file.
+
+ SPU single-precision FP does not support Inf or Nan:
+ * gcc.c-torture/execute/ieee/inf-1.c: Disable "float" Inf test on SPU.
+ * gcc.c-torture/execute/ieee/compare-fp-1.x: New file.
+ * gcc.c-torture/execute/ieee/compare-fp-4.x: Disable test on SPU.
+ * gcc.c-torture/execute/ieee/fp-cmp-2.x: Disable test on SPU.
+ * gcc.c-torture/execute/ieee/fp-cmp-4f.x: New file.
+ * gcc.c-torture/execute/ieee/fp-cmp-8f.x: New file.
+ * gcc.dg/pr15784-3.c: Disable test on SPU.
+ * gcc.dg/pr28796-2.c: Likewise.
+ * gcc.dg/float-range-1.c: Likewise.
+ * gcc.dg/float-range-3.c: Likewise.
+ * gcc.dg/float-range-4.c: Likewise.
+ * gcc.dg/float-range-5.c: Likewise.
+ * gcc.dg/fold-overflow-1.c: Likewise.
+ * gcc.dg/builtins-1.c: SPU does not support __builtin_inff.
+ * gcc.dg/builtin-inf-1.c: SPU does not support __builtin_inff.
+ Check for error instead of warning "does not support infinity".
+ * gcc.dg/builtins-43.c: Disable "float" Inf/Nan tests on SPU.
+ * gcc.dg/builtins-44.c: Likewise.
+ * gcc.dg/builtins-45.c: Likewise.
+ * gcc.dg/torture/builtin-math-2.c: Likewise.
+ * gcc.dg/torture/builtin-logb-1.c: Likewise.
+ * gcc.dg/torture/builtin-modf-1.c: Likewise.
+ * gcc.dg/torture/builtin-ldexp-1.c: Likewise.
+ * gcc.dg/torture/builtin-frexp-1.c: Likewise.
+ * gcc.dg/torture/type-generic-1.c: Disable test on SPU.
+ * g++.dg/torture/type-generic-1.C: Likewise.
+
+ SPU single-precision FP always rounds towards zero:
+ * gcc.c-torture/execute/ieee/920518-1.x: New file.
+ * gcc.c-torture/execute/ieee/20010114-2.x: New file.
+ * gcc.c-torture/execute/ieee/20030331-1.x: New file.
+ * gcc.dg/torture/fp-int-convert-float.c: Disable test on SPU.
+ * gcc.dg/torture/fp-int-convert-timode.c: Disable "float" test on SPU.
+
+2008-07-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/36590
+ PR fortran/36681
+ * gfortran.dg/count_mask_1.f90: New test.
+
+2008-07-02 Ira Rosen <irar@il.ibm.com>
+
+ * gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c: Add noinline
+ attribute to main1().
+ * gcc.dg/vect/costmodel/spu/costmodel-vect-33.c: Increase the loop
+ bound in order to make it worth to vectorize the loop.
+ * gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c: Likewise.
+
+2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/36676
+ * gfortran.dg/namelist_51.f90: New test.
+
+2008-07-01 Joseph Myers <joseph@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target_vect_int,
+ check_effective_target_vect_shift,
+ check_effective_target_vect_long,
+ check_effective_target_vect_float,
+ check_effective_target_vect_no_align,
+ check_effective_target_vect_int_mult): Check for ARM.
+ (check_effective_target_arm_neon): New.
+ (check_effective_target_vect_cmdline_needed): Use it.
+
+2008-07-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * g++.dg/other/opaque-1.C, g++.dg/other/opaque-2.C,
+ g++.dg/other/opaque-3.C: Also run on powerpc*-*-linux*spe*.
+
+2008-07-01 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/quad-sse.c: New test.
+
+2008-07-01 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36666
+ * gcc.c-torture/compile/pr36666.c: New testcase.
+
+2008-07-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/pack10.adb: New test.
+
+2008-06-30 Andy Hutchinson <hutchinsonandy@aim.com>
+
+ PR target/36598
+ * gcc.dg/memcpy-1.c: Mark test XFAIL for avr target.
+
+2008-06-30 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/movti.c: New test.
diff --git a/gcc/testsuite/g++.dg/abi/mangle24.C b/gcc/testsuite/g++.dg/abi/mangle24.C
index 16aa2ea8e59..3a9f629d5bf 100644
--- a/gcc/testsuite/g++.dg/abi/mangle24.C
+++ b/gcc/testsuite/g++.dg/abi/mangle24.C
@@ -5,7 +5,6 @@
// Origin: Joseph Myers <joseph@codesourcery.com>
// { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
// { dg-options "" } */
-// { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
// { dg-final { scan-assembler "_Z1fe" { target i?86-*-* x86_64-*-* } } } */
// { dg-final { scan-assembler "_Z1fe" { target { ia64-*-* && { ! "ia64-*-hpux*" } } } } } */
// { dg-final { scan-assembler "_Z1fu9__float80" { target ia64-*-hpux* } } } */
diff --git a/gcc/testsuite/g++.dg/abi/mangle25.C b/gcc/testsuite/g++.dg/abi/mangle25.C
index 75819a7bfaf..e00ba5c692d 100644
--- a/gcc/testsuite/g++.dg/abi/mangle25.C
+++ b/gcc/testsuite/g++.dg/abi/mangle25.C
@@ -4,7 +4,7 @@
// ia64-hpux where "long double" is "e" and __float128 is synonymous with
// "long double".
// Origin: Joseph Myers <joseph@codesourcery.com>
-// { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-*} && lp64 } } } }
+// { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } }
// { dg-options "" } */
// { dg-final { scan-assembler "_Z1fg" { target i?86-*-* x86_64-*-* } } } */
// { dg-final { scan-assembler "_Z1fg" { target { ia64-*-* && { ! "ia64-*-hpux*" } } } } } */
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist1.C b/gcc/testsuite/g++.dg/cpp0x/initlist1.C
new file mode 100644
index 00000000000..b7583da7829
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist1.C
@@ -0,0 +1,69 @@
+// Basic uses of initializer lists
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+#include <initializer_list>
+
+extern "C" void abort();
+
+using namespace std;
+
+struct A { int i,j; A(int _i,int _j): i(_i), j(_j) {} };
+struct B { A a; B(A _a): a(_a) {} };
+struct C { B b; C(B _b): b(_b) {} };
+
+struct D
+{
+ int ia[3];
+ D (initializer_list<int> l)
+ {
+ const int *p = l.begin();
+ for (int i = 0; i < 3; ++i)
+ ia[i] = *p++;
+ }
+};
+
+void f(C c)
+{
+ if (c.b.a.i != 1) abort();
+ if (c.b.a.j != 2) abort();
+}
+void f(int);
+
+void g(D d)
+{
+ if (d.ia[0] != 1 || d.ia[1] != 2 || d.ia[2] != 3)
+ abort();
+}
+
+struct E
+{
+ int i, j, k;
+};
+
+void h(E e)
+{
+ if (e.i != 1 || e.j != 2 || e.k != 3)
+ abort();
+}
+
+void i(initializer_list<int> l)
+{
+ const int *p = l.begin();
+ if (*p++ != 1) abort();
+ if (*p++ != 2) abort();
+ if (*p++ != 3) abort();
+ if (p != l.end()) abort();
+}
+
+int main()
+{
+ g({1,2,3});
+
+ h({1,2,3});
+
+ f({{{1,2}}});
+ f({{A{1,2}}});
+
+ i({1,2,3});
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist2.C b/gcc/testsuite/g++.dg/cpp0x/initlist2.C
new file mode 100644
index 00000000000..2fe4770560d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist2.C
@@ -0,0 +1,32 @@
+// Test that conversion to std::initializer_list takes priority over other
+// user-defined conversions.
+
+// { dg-do link }
+// { dg-options "-std=c++0x" }
+
+#include <initializer_list>
+
+struct string
+{
+ string (const char *) {}
+ template <class Iter> string (Iter, Iter);
+};
+
+template <class T, class U>
+struct pair
+{
+ pair (T t, U u) {}
+};
+
+template<class T, class U>
+struct map
+{
+ void insert (pair<T,U>);
+ void insert (std::initializer_list<pair<T,U> >) {}
+};
+
+int main()
+{
+ map<string,string> m;
+ m.insert({ {"this","that"}, {"me","you"} });
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist3.C b/gcc/testsuite/g++.dg/cpp0x/initlist3.C
new file mode 100644
index 00000000000..412deb51129
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist3.C
@@ -0,0 +1,11 @@
+// { dg-options "-std=c++0x" }
+
+#include <initializer_list>
+
+template <class T> void f(std::initializer_list<T>);
+
+void g()
+{
+ f({1,2,3});
+}
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist4.C b/gcc/testsuite/g++.dg/cpp0x/initlist4.C
new file mode 100644
index 00000000000..d1ffab8546c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist4.C
@@ -0,0 +1,32 @@
+// Test for initializer-list 'explicit' rule
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+ explicit A(int,int);
+ operator bool();
+};
+
+A f(A)
+{
+ A{1,2};
+ A a1{1,2};
+ new A{1,2};
+ if (A a5{1,2});
+
+ A({1,2}); // { dg-error "explicit" }
+ A a2({1,2}); // { dg-error "explicit" }
+ A a3 = {1,2}; // { dg-error "explicit" }
+ new A({1,2}); // { dg-error "explicit" }
+ f({1,2}); // { dg-error "explicit" }
+ a1 = {1,2}; // { dg-error "explicit" }
+ if (A a4 = {1,2}); // { dg-error "explicit" }
+ return {1,2}; // { dg-error "explicit" }
+}
+
+struct B
+{
+ A a;
+ B(): a{1,2} {}
+ B(const B&): a({1,2}) {} // { dg-error "explicit" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist5.C b/gcc/testsuite/g++.dg/cpp0x/initlist5.C
new file mode 100644
index 00000000000..0d02fd42d7f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist5.C
@@ -0,0 +1,21 @@
+// Test for narrowing diagnostics
+// { dg-options "-std=c++0x" }
+
+#include <initializer_list>
+
+struct A { int i; int j; };
+A a2 { 1.2 }; // { dg-error "narrowing" }
+A a1 { 1, 2 }; // aggregate initialization
+struct B {
+ B(std::initializer_list<int>);
+};
+B b1 { 1, 2 }; // creates initializer_list<int> and calls constructor
+B b2 { 1, 2.0 }; // { dg-error "narrowing" }
+struct C {
+ C(int i, double j);
+};
+C c1 = { 1, 2.2 }; // calls constructor with arguments (1, 2.2)
+C c2 = { 1.1, 2 }; // { dg-error "narrowing" }
+
+int j { 1 }; // initialize to 1
+int k {}; // initialize to 0
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist6.C b/gcc/testsuite/g++.dg/cpp0x/initlist6.C
new file mode 100644
index 00000000000..523570315eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist6.C
@@ -0,0 +1,30 @@
+// Test for initlist lifetime
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+#include <initializer_list>
+
+int c;
+
+struct A
+{
+ A(int,int) { ++c; }
+ ~A() { --c; }
+};
+
+void f (std::initializer_list<A> l) { }
+
+int main()
+{
+ f({ {1,2}, {3,4} });
+ if (c != 0)
+ return 1;
+
+ {
+ std::initializer_list<A> l { {1,2}, {3,4} };
+ if (c != 2)
+ return 2;
+ }
+ if (c != 0)
+ return 3;
+}
diff --git a/gcc/testsuite/g++.dg/inherit/error4.C b/gcc/testsuite/g++.dg/inherit/error4.C
index 77fa75d1994..d56d67f7556 100644
--- a/gcc/testsuite/g++.dg/inherit/error4.C
+++ b/gcc/testsuite/g++.dg/inherit/error4.C
@@ -2,9 +2,9 @@
struct A { virtual ~A(); };
-struct B : A A {}; // { dg-error "'A'|function definition|extra" }
+struct B : A A {}; // { dg-error "" }
-A foo(const B &b)
+A foo(const B &b) // { dg-error "" }
{
- return b; // { dg-error "conversion" }
+ return b;
}
diff --git a/gcc/testsuite/g++.dg/init/brace2.C b/gcc/testsuite/g++.dg/init/brace2.C
index 2af063d5f56..619a20f3c70 100644
--- a/gcc/testsuite/g++.dg/init/brace2.C
+++ b/gcc/testsuite/g++.dg/init/brace2.C
@@ -5,4 +5,4 @@ const char * y = { "hello" };
int a = 2;
int b = { 2,3 }; // { dg-error "requires one element in initializer" }
int c = { { 2 } } ; // { dg-error "braces around scalar initializer" }
-int d = {}; // { dg-error "requires one element in initializer" }
+int d = {}; // { dg-error "initializer" }
diff --git a/gcc/testsuite/g++.dg/init/brace6.C b/gcc/testsuite/g++.dg/init/brace6.C
index ffb70118f9e..066d1ba65ff 100644
--- a/gcc/testsuite/g++.dg/init/brace6.C
+++ b/gcc/testsuite/g++.dg/init/brace6.C
@@ -6,7 +6,7 @@ struct A {
};
struct B {
- B(const B&);
+ B(const B&); // { dg-error "candidate" }
int b;
};
@@ -18,8 +18,8 @@ int main()
{
int i = { 1 };
int j = { 1, 2 }; /* { dg-error "requires one element" } */
- A a = { 6 }; /* { dg-error "initializer for non" } */
- B b = { 6 }; /* { dg-error "initializer for non" } */
+ A a = { 6 }; /* { dg-error "initialize" } */
+ B b = { 6 }; /* { dg-error "initialize" } */
C c = { 6 }; /* { dg-error "too many initializers" } */
D d = { 6 };
}
diff --git a/gcc/testsuite/g++.dg/opt/temp1.C b/gcc/testsuite/g++.dg/opt/temp1.C
index b822dc464fe..dc13f516246 100644
--- a/gcc/testsuite/g++.dg/opt/temp1.C
+++ b/gcc/testsuite/g++.dg/opt/temp1.C
@@ -24,7 +24,12 @@ void *memcpy (void *dest, const void *src, __SIZE_TYPE__ n)
}
struct T {
+#ifdef __SPU__
+ /* SPU returns aggregates up to 1172 bytes in registers. */
+ int a[300];
+#else
int a[128];
+#endif
T &operator+=(T const &v) __attribute__((noinline));
T operator+(T const &v) const { T t = *this; t += v; return t; }
};
diff --git a/gcc/testsuite/g++.dg/other/opaque-1.C b/gcc/testsuite/g++.dg/other/opaque-1.C
index ad79bfa21b6..ae1d76f3f7f 100644
--- a/gcc/testsuite/g++.dg/other/opaque-1.C
+++ b/gcc/testsuite/g++.dg/other/opaque-1.C
@@ -1,4 +1,4 @@
-/* { dg-do run { target powerpc-*-eabispe* } } */
+/* { dg-do run { target powerpc-*-eabispe* powerpc*-*-linux*spe* } } */
#define __vector __attribute__((vector_size(8)))
typedef float __vector __ev64_fs__;
diff --git a/gcc/testsuite/g++.dg/other/opaque-2.C b/gcc/testsuite/g++.dg/other/opaque-2.C
index efe04e3df1b..9a9b1b46404 100644
--- a/gcc/testsuite/g++.dg/other/opaque-2.C
+++ b/gcc/testsuite/g++.dg/other/opaque-2.C
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* } } */
+/* { dg-do compile { target powerpc-*-eabi* powerpc*-*-linux*spe* } } */
/* { dg-options "-mcpu=8540 -mabi=spe" } */
#define __vector __attribute__((vector_size(8)))
diff --git a/gcc/testsuite/g++.dg/other/opaque-3.C b/gcc/testsuite/g++.dg/other/opaque-3.C
index 18ed0bee536..8cba875fd9b 100644
--- a/gcc/testsuite/g++.dg/other/opaque-3.C
+++ b/gcc/testsuite/g++.dg/other/opaque-3.C
@@ -1,4 +1,4 @@
-/* { dg-do compile { target powerpc-*-eabi* } } */
+/* { dg-do compile { target powerpc-*-eabi* powerpc*-*-linux*spe* } } */
/* { dg-options "-mcpu=8540 -mabi=spe" } */
__ev64_opaque__ o;
diff --git a/gcc/testsuite/g++.dg/parse/crash36.C b/gcc/testsuite/g++.dg/parse/crash36.C
index bcd96e4ec1f..1397e87d256 100644
--- a/gcc/testsuite/g++.dg/parse/crash36.C
+++ b/gcc/testsuite/g++.dg/parse/crash36.C
@@ -2,7 +2,7 @@
// { dg-do compile }
// { dg-options "-std=c++98" }
-template <typename... T> struct A // { dg-error "does not include variadic templates" }
+template <typename... T> struct A // { dg-error "variadic templates" }
{
static T &t; // { dg-error "not expanded with|T" }
static const int i = sizeof (++t); // { dg-error "was not declared in this scope" }
diff --git a/gcc/testsuite/g++.dg/parse/ctor3.C b/gcc/testsuite/g++.dg/parse/ctor3.C
index 193ffae24fe..e597d926f40 100644
--- a/gcc/testsuite/g++.dg/parse/ctor3.C
+++ b/gcc/testsuite/g++.dg/parse/ctor3.C
@@ -4,5 +4,5 @@ struct A {};
struct B : A
{
- B() : A {} // { dg-error "expected" }
+ B() : A {} // { dg-error "initializer|expected" }
};
diff --git a/gcc/testsuite/g++.dg/torture/type-generic-1.C b/gcc/testsuite/g++.dg/torture/type-generic-1.C
index 92dd9fcb751..7db2e69d0a5 100644
--- a/gcc/testsuite/g++.dg/torture/type-generic-1.C
+++ b/gcc/testsuite/g++.dg/torture/type-generic-1.C
@@ -3,6 +3,7 @@
/* { dg-do run } */
/* { dg-options "-mieee" { target sh*-*-* } } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
#include "../../gcc.dg/tg-tests.h"
diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
index cfcf546e157..19701ab3877 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
@@ -4,6 +4,7 @@
/* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */
/* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */
/* { dg-xfail-if "jump beyond 128K not supported" { xtensa-*-* } { "-O0" } { "" } } */
+/* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */
/* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */
/* This testcase exposed two branch shortening bugs on powerpc. */
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36666.c b/gcc/testsuite/gcc.c-torture/compile/pr36666.c
new file mode 100644
index 00000000000..9eb132cd044
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr36666.c
@@ -0,0 +1,22 @@
+struct Foo {
+ int *p;
+ struct X {
+ int a,b,c,d,e,*f;
+ } x;
+} *init, *init2;
+
+struct X __attribute__((const)) foo(struct X);
+struct Foo __attribute__((const)) foo2(struct Foo);
+
+void bar1 (void)
+{
+ init->x = foo (init2->x);
+}
+void bar2 (void)
+{
+ init->x = foo (init->x);
+}
+void bar3 (void)
+{
+ *init = foo2 (*init2);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030222-1.x b/gcc/testsuite/gcc.c-torture/execute/20030222-1.x
new file mode 100644
index 00000000000..e195563ddd0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030222-1.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # Using inline assembly to convert long long to int is not working quite
+ # right # on the SPU. An extra shift-left-4-byte is needed.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x
new file mode 100644
index 00000000000..73b18d1604d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # This doesn't work on the SPU because single precision floats are
+ # always rounded toward 0.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x
new file mode 100644
index 00000000000..73b18d1604d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # This doesn't work on the SPU because single precision floats are
+ # always rounded toward 0.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x
new file mode 100644
index 00000000000..73b18d1604d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # This doesn't work on the SPU because single precision floats are
+ # always rounded toward 0.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x
new file mode 100644
index 00000000000..2f7a4ecc54a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x
index 510a30909ea..d7ecd110089 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x
@@ -13,5 +13,11 @@ if [istarget "arm*-*-vxworks*"] {
}
}
+if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+}
+
lappend additional_flags "-fno-trapping-math"
return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x
index 84c193fe0e4..0fe5a98d375 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x
@@ -13,4 +13,10 @@ if [istarget "arm*-*-vxworks*"] {
}
}
+if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+}
+
return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x
new file mode 100644
index 00000000000..2f7a4ecc54a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x
new file mode 100644
index 00000000000..2f7a4ecc54a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c
index 34f60f3f1c0..eee8c0130ba 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c
@@ -2,7 +2,10 @@ extern void abort (void);
int main()
{
+#ifndef __SPU__
+ /* The SPU single-precision floating point format does not support Inf. */
float fi = __builtin_inff();
+#endif
double di = __builtin_inf();
long double li = __builtin_infl();
@@ -10,22 +13,28 @@ int main()
double dh = __builtin_huge_val();
long double lh = __builtin_huge_vall();
+#ifndef __SPU__
if (fi + fi != fi)
abort ();
+#endif
if (di + di != di)
abort ();
if (li + li != li)
abort ();
+#ifndef __SPU__
if (fi != fh)
abort ();
+#endif
if (di != dh)
abort ();
if (li != lh)
abort ();
+#ifndef __SPU__
if (fi <= 0)
abort ();
+#endif
if (di <= 0)
abort ();
if (li <= 0)
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
index ce771550b2e..5978c94a8ea 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
@@ -8,4 +8,9 @@ if {[istarget "m68k-*-*"] && [check_effective_target_coldfire_fpu]} {
# not aware of any system that has this.
set torture_execute_xfail "m68k-*-*"
}
+if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support subnormals.
+ return 1
+}
return 0
diff --git a/gcc/testsuite/gcc.dg/builtin-inf-1.c b/gcc/testsuite/gcc.dg/builtin-inf-1.c
index fdb4612274c..d96a5b6b3f5 100644
--- a/gcc/testsuite/gcc.dg/builtin-inf-1.c
+++ b/gcc/testsuite/gcc.dg/builtin-inf-1.c
@@ -8,6 +8,6 @@ float fh = __builtin_huge_valf();
double dh = __builtin_huge_val();
long double lh = __builtin_huge_vall();
-/* { dg-warning "does not support infinity" "INF unsupported" { target vax-*-* } 3 } */
-/* { dg-warning "does not support infinity" "INF unsupported" { target vax-*-* } 4 } */
-/* { dg-warning "does not support infinity" "INF unsupported" { target vax-*-* } 5 } */
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* spu-*-* } 3 } */
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } 4 } */
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } 5 } */
diff --git a/gcc/testsuite/gcc.dg/builtins-1.c b/gcc/testsuite/gcc.dg/builtins-1.c
index 573a879bd00..5dab9fe0a4e 100644
--- a/gcc/testsuite/gcc.dg/builtins-1.c
+++ b/gcc/testsuite/gcc.dg/builtins-1.c
@@ -144,7 +144,7 @@ FPTEST2ARG2_REENT (gamma, int *) /* gamma_r */
FPTEST0 (huge_val)
FPTEST2 (hypot)
FPTEST1 (ilogb)
-FPTEST0 (inf)
+FPTEST0 (inf) /* { dg-warning "target format does not support infinity" "inf" {target spu-*-*} } */
FPTEST1 (j0)
FPTEST1 (j1)
FPTEST2ARG1 (jn, int)
diff --git a/gcc/testsuite/gcc.dg/builtins-43.c b/gcc/testsuite/gcc.dg/builtins-43.c
index 4256967ee53..85d96b6cb0c 100644
--- a/gcc/testsuite/gcc.dg/builtins-43.c
+++ b/gcc/testsuite/gcc.dg/builtins-43.c
@@ -12,15 +12,20 @@ int
main ()
{
double nan = __builtin_nan ("");
+#ifndef __SPU__
+ /* The SPU single-precision floating point format does not support NANs. */
float nanf = __builtin_nanf ("");
+#endif
long double nanl = __builtin_nanl ("");
if (!__builtin_isnan (nan))
link_error ();
+#ifndef __SPU__
if (!__builtin_isnan (nanf))
link_error ();
if (!__builtin_isnanf (nanf))
link_error ();
+#endif
if (!__builtin_isnan (nanl))
link_error ();
if (!__builtin_isnanl (nanl))
diff --git a/gcc/testsuite/gcc.dg/builtins-44.c b/gcc/testsuite/gcc.dg/builtins-44.c
index b3916886a43..9e19d774dfd 100644
--- a/gcc/testsuite/gcc.dg/builtins-44.c
+++ b/gcc/testsuite/gcc.dg/builtins-44.c
@@ -12,15 +12,20 @@ int
main ()
{
double pinf = __builtin_inf ();
+#ifndef __SPU__
+ /* The SPU single-precision floating point format does not support Inf. */
float pinff = __builtin_inff ();
+#endif
long double pinfl = __builtin_infl ();
if (__builtin_isinf (pinf) != 1)
link_error ();
+#ifndef __SPU__
if (__builtin_isinf (pinff) != 1)
link_error ();
if (__builtin_isinff (pinff) != 1)
link_error ();
+#endif
if (__builtin_isinf (pinfl) != 1)
link_error ();
if (__builtin_isinfl (pinfl) != 1)
@@ -28,10 +33,12 @@ main ()
if (__builtin_isinf (-pinf) != -1)
link_error ();
+#ifndef __SPU__
if (__builtin_isinf (-pinff) != -1)
link_error ();
if (__builtin_isinff (-pinff) != -1)
link_error ();
+#endif
if (__builtin_isinf (-pinfl) != -1)
link_error ();
if (__builtin_isinfl (-pinfl) != -1)
diff --git a/gcc/testsuite/gcc.dg/builtins-45.c b/gcc/testsuite/gcc.dg/builtins-45.c
index ad9d39ec268..15ec33af677 100644
--- a/gcc/testsuite/gcc.dg/builtins-45.c
+++ b/gcc/testsuite/gcc.dg/builtins-45.c
@@ -12,24 +12,34 @@ int
main ()
{
double nan = __builtin_nan ("");
+#ifndef __SPU__
+ /* The SPU single-precision floating point format does not support NANs. */
float nanf = __builtin_nanf ("");
+#endif
long double nanl = __builtin_nanl ("");
double pinf = __builtin_inf ();
+#ifndef __SPU__
+ /* The SPU single-precision floating point format does not support Inf. */
float pinff = __builtin_inff ();
+#endif
long double pinfl = __builtin_infl ();
if (__builtin_finite (pinf))
link_error ();
+#ifndef __SPU__
if (__builtin_finitef (pinff))
link_error ();
+#endif
if (__builtin_finitel (pinfl))
link_error ();
if (__builtin_finite (nan))
link_error ();
+#ifndef __SPU__
if (__builtin_finitef (nanf))
link_error ();
+#endif
if (__builtin_finitel (nanl))
link_error ();
diff --git a/gcc/testsuite/gcc.dg/const-float128-ped.c b/gcc/testsuite/gcc.dg/const-float128-ped.c
index 86a630cf951..6a6b6223ce2 100644
--- a/gcc/testsuite/gcc.dg/const-float128-ped.c
+++ b/gcc/testsuite/gcc.dg/const-float128-ped.c
@@ -1,5 +1,5 @@
/* Test 'q' suffix with -pedantic on __float128 type constants. */
-/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-* } && lp64 } } } } */
+/* { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "-pedantic" } */
__float128 a = 123.456789q; /* { dg-warning "non-standard suffix on floating constant" } */
diff --git a/gcc/testsuite/gcc.dg/const-float128.c b/gcc/testsuite/gcc.dg/const-float128.c
index 146e0c9c986..116e4597b44 100644
--- a/gcc/testsuite/gcc.dg/const-float128.c
+++ b/gcc/testsuite/gcc.dg/const-float128.c
@@ -1,5 +1,5 @@
/* Test 'q' and 'Q' suffixes on __float128 type constants. */
-/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-* } && lp64 } } } } */
+/* { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "" } */
__float128 a = 123.456789q;
diff --git a/gcc/testsuite/gcc.dg/const-float80-ped.c b/gcc/testsuite/gcc.dg/const-float80-ped.c
index 9cf047804a4..d1cf316dcad 100644
--- a/gcc/testsuite/gcc.dg/const-float80-ped.c
+++ b/gcc/testsuite/gcc.dg/const-float80-ped.c
@@ -1,6 +1,5 @@
/* Test 'w' suffix with -pedantic on __float80 type constants. */
/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
/* { dg-options "-pedantic" } */
-/* { dg-options "-mmmx -pedantic" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
__float80 a = 123.456789w; /* { dg-warning "non-standard suffix on floating constant" } */
diff --git a/gcc/testsuite/gcc.dg/const-float80.c b/gcc/testsuite/gcc.dg/const-float80.c
index f2a836d3e64..8ec771f8f9c 100644
--- a/gcc/testsuite/gcc.dg/const-float80.c
+++ b/gcc/testsuite/gcc.dg/const-float80.c
@@ -1,7 +1,6 @@
/* Test 'w' and 'W' suffixes on __float80 type constants. */
/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
/* { dg-options "" } */
-/* { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
__float80 a = 123.456789W;
__float80 b = 123.456789w;
diff --git a/gcc/testsuite/gcc.dg/float-range-1.c b/gcc/testsuite/gcc.dg/float-range-1.c
index bf050487a2f..ddd7fd67207 100644
--- a/gcc/testsuite/gcc.dg/float-range-1.c
+++ b/gcc/testsuite/gcc.dg/float-range-1.c
@@ -4,6 +4,7 @@
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */
/* { dg-options "-ansi -pedantic-errors -Woverflow" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
void
f (void)
diff --git a/gcc/testsuite/gcc.dg/float-range-3.c b/gcc/testsuite/gcc.dg/float-range-3.c
index 7fa766f526e..e018a1ebc16 100644
--- a/gcc/testsuite/gcc.dg/float-range-3.c
+++ b/gcc/testsuite/gcc.dg/float-range-3.c
@@ -1,6 +1,7 @@
/* PR 23572 : warnings for out of range floating-point constants. */
/* { dg-compile } */
/* { dg-options "-std=c99" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
#include <math.h>
#ifndef INFINITY
diff --git a/gcc/testsuite/gcc.dg/float-range-4.c b/gcc/testsuite/gcc.dg/float-range-4.c
index 2ec38c43bf6..fbb820f9b21 100644
--- a/gcc/testsuite/gcc.dg/float-range-4.c
+++ b/gcc/testsuite/gcc.dg/float-range-4.c
@@ -1,6 +1,7 @@
/* PR 23572 : warnings for out of range floating-point constants. */
/* { dg-compile } */
/* { dg-options "-Wno-overflow -std=c99" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
#include <math.h>
#ifndef INFINITY
diff --git a/gcc/testsuite/gcc.dg/float-range-5.c b/gcc/testsuite/gcc.dg/float-range-5.c
index 49742e322bf..89f00796aec 100644
--- a/gcc/testsuite/gcc.dg/float-range-5.c
+++ b/gcc/testsuite/gcc.dg/float-range-5.c
@@ -2,6 +2,7 @@
Test that they are NOT pedantic warnings. */
/* { dg-compile } */
/* { dg-options "-pedantic-errors -std=c99" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
#include <math.h>
#ifndef INFINITY
diff --git a/gcc/testsuite/gcc.dg/fold-overflow-1.c b/gcc/testsuite/gcc.dg/fold-overflow-1.c
index e2b731b735a..bd4d25a73ed 100644
--- a/gcc/testsuite/gcc.dg/fold-overflow-1.c
+++ b/gcc/testsuite/gcc.dg/fold-overflow-1.c
@@ -1,5 +1,6 @@
/* { dg-compile } */
/* { dg-skip-if "consts are shorts, not longs" { "m32c-*-*" "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
/* { dg-options "-O -ftrapping-math" } */
/* There should be exactly 2 +Inf in the assembly file. */
diff --git a/gcc/testsuite/gcc.dg/lower-subreg-1.c b/gcc/testsuite/gcc.dg/lower-subreg-1.c
index 01851268c11..bb35d21bb50 100644
--- a/gcc/testsuite/gcc.dg/lower-subreg-1.c
+++ b/gcc/testsuite/gcc.dg/lower-subreg-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { { ! mips64 } && { ! ia64-*-* } } } } */
+/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */
/* { dg-options "-O -fdump-rtl-subreg" } */
/* { dg-require-effective-target ilp32 } */
diff --git a/gcc/testsuite/gcc.dg/memcpy-1.c b/gcc/testsuite/gcc.dg/memcpy-1.c
index 7098f83955d..2b11098b286 100644
--- a/gcc/testsuite/gcc.dg/memcpy-1.c
+++ b/gcc/testsuite/gcc.dg/memcpy-1.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
-/* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" } } */
+/* PR36598 AVR fail maybe due to cost metrics */
+/* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
struct a {int a,b,c;} a;
int test(struct a a)
diff --git a/gcc/testsuite/gcc.dg/nrv3.c b/gcc/testsuite/gcc.dg/nrv3.c
index 2b582c3ebe8..c28b8ec570d 100644
--- a/gcc/testsuite/gcc.dg/nrv3.c
+++ b/gcc/testsuite/gcc.dg/nrv3.c
@@ -3,7 +3,12 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-optimized" } */
+#ifdef __SPU__
+/* SPU returns aggregates up to 1172 bytes in registers. */
+typedef struct { int x[300]; void *y; } S;
+#else
typedef struct { int x[20]; void *y; } S;
+#endif
typedef struct { int a; S b; } T;
S nrv_candidate (void);
void use_result (S, int);
diff --git a/gcc/testsuite/gcc.dg/pr15784-3.c b/gcc/testsuite/gcc.dg/pr15784-3.c
index a8bdc552cde..746f9660e48 100644
--- a/gcc/testsuite/gcc.dg/pr15784-3.c
+++ b/gcc/testsuite/gcc.dg/pr15784-3.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-skip-if "No NaN support" { spu-*-* } } */
/* SH4 without -mieee defaults to -ffinite-math-only. */
/* { dg-options "-fdump-tree-gimple -fno-finite-math-only" } */
/* Test for folding abs(x) where appropriate. */
diff --git a/gcc/testsuite/gcc.dg/pr27095.c b/gcc/testsuite/gcc.dg/pr27095.c
index 5ec39687a06..d274f4e8445 100644
--- a/gcc/testsuite/gcc.dg/pr27095.c
+++ b/gcc/testsuite/gcc.dg/pr27095.c
@@ -11,7 +11,7 @@ main (int argc, char **argv)
memset (x, argc, strlen (x));
return 0;
}
-/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen" { target { ! { powerpc*-*-darwin* hppa*-*-hpux* ia64-*-hpux* alpha*-*-* } } } } } */
+/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen" { target { ! { powerpc*-*-darwin* hppa*-*-hpux* ia64-*-hpux* alpha*-*-* spu-*-* } } } } } */
/* hppa*-*-hpux* has an IMPORT statement for strlen (plus the branch). */
/* *-*-darwin* has something similar. */
/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen" { target hppa*-*-hpux* } } } */
@@ -20,3 +20,5 @@ main (int argc, char **argv)
/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen" { target ia64-*-hpux* } } } */
/* alpha-*-* has a GOT load and the call. */
/* { dg-final { scan-assembler-not "(?n)jsr .*,strlen\(.*\n\)+.*jsr .*,strlen" { target alpha*-*-* } } } */
+/* spu-*-* has a branch hint and the call. */
+/* { dg-final { scan-assembler-not "(?n)brsl.*,strlen\(.*\n\)+.*brsl.*,strlen" { target spu-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/pr28796-2.c b/gcc/testsuite/gcc.dg/pr28796-2.c
index f4900817581..17fd1584dde 100644
--- a/gcc/testsuite/gcc.dg/pr28796-2.c
+++ b/gcc/testsuite/gcc.dg/pr28796-2.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-options "-O2 -funsafe-math-optimizations -fno-finite-math-only -DUNSAFE" } */
/* { dg-options "-mieee -O2 -funsafe-math-optimizations -fno-finite-math-only -DUNSAFE" { target alpha*-*-* } } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
#include "tg-tests.h"
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c b/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c
index 2225f825b82..3ef23648a34 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c
@@ -53,6 +53,7 @@ extern void link_error(int);
/* Test that FUNCRES(frexp(NEG FUNCARG(ARGARG),&i)) is false. Check
the sign as well. Ensure side-effects are evaluated in i. */
+#ifndef __SPU__
#define TESTIT_FREXP2(NEG,FUNCARG,ARGARG,FUNCRES) do { \
int i=5; \
if (!__builtin_##FUNCRES##f(__builtin_frexpf(NEG __builtin_##FUNCARG##f(ARGARG),&i)) \
@@ -68,6 +69,20 @@ extern void link_error(int);
|| CKEXP(i,8)) \
link_error(__LINE__); \
} while (0)
+#else
+#define TESTIT_FREXP2(NEG,FUNCARG,ARGARG,FUNCRES) do { \
+ int i=6; \
+ /* SPU single-precision floating point format does not support Inf or Nan. */ \
+ if (!__builtin_##FUNCRES(__builtin_frexp(NEG __builtin_##FUNCARG(ARGARG),&i)) \
+ || CKSGN(__builtin_frexp(NEG __builtin_##FUNCARG(ARGARG),(i++,&i)), NEG __builtin_##FUNCARG(ARGARG)) \
+ || CKEXP(i,7)) \
+ link_error(__LINE__); \
+ if (!__builtin_##FUNCRES##l(__builtin_frexpl(NEG __builtin_##FUNCARG##l(ARGARG),&i)) \
+ || CKSGN_L(__builtin_frexpl(NEG __builtin_##FUNCARG##l(ARGARG),(i++,&i)), NEG __builtin_##FUNCARG##l(ARGARG)) \
+ || CKEXP(i,8)) \
+ link_error(__LINE__); \
+ } while (0)
+#endif
void __attribute__ ((__noinline__))
foo(void)
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c b/gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c
index 6efa870f837..94560a8abb4 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c
@@ -45,6 +45,7 @@ extern void link_error(int);
/* Test that FUNCRES(FUNC(NEG FUNCARG(ARGARG),ARG2)) is false. Check
the sign as well. */
+#ifndef __SPU__
#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,ARG2,FUNCRES) do { \
if (!__builtin_##FUNCRES##f(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG),ARG2)) \
|| CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG),ARG2), NEG __builtin_##FUNCARG##f(ARGARG))) \
@@ -56,6 +57,17 @@ extern void link_error(int);
|| CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG),ARG2), NEG __builtin_##FUNCARG##l(ARGARG))) \
link_error(__LINE__); \
} while (0)
+#else
+#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,ARG2,FUNCRES) do { \
+ /* SPU single-precision floating point format does not support Inf or Nan. */ \
+ if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG),ARG2)) \
+ || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG),ARG2), NEG __builtin_##FUNCARG(ARGARG))) \
+ link_error(__LINE__); \
+ if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG),ARG2)) \
+ || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG),ARG2), NEG __builtin_##FUNCARG##l(ARGARG))) \
+ link_error(__LINE__); \
+ } while (0)
+#endif
/* Using foo==MIN/MAX float values, test that FUNC(foo,EXP) == foo*exp2(EXP),
and also that FUNC(foo,-EXP) == foo*exp2(-EXP). */
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-logb-1.c b/gcc/testsuite/gcc.dg/torture/builtin-logb-1.c
index 7c8de654c83..25d0f91064e 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-logb-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-logb-1.c
@@ -47,6 +47,7 @@ extern void link_error(int);
/* Test if FUNCRES(FUNC(NEG FUNCARG(ARGARG))) is false. Check the
sign as well. */
+#ifndef __SPU__
#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
if (!__builtin_##FUNCRES##f(__builtin_##FUNC(NEG __builtin_##FUNCARG##f(ARGARG))) \
|| CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG __builtin_##FUNCARG##f(ARGARG))) \
@@ -58,6 +59,17 @@ extern void link_error(int);
|| CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
link_error(__LINE__); \
} while (0)
+#else
+#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
+ /* SPU single-precision floating point format does not support Inf or Nan. */ \
+ if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \
+ || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \
+ link_error(__LINE__); \
+ if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \
+ || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
+ link_error(__LINE__); \
+ } while (0)
+#endif
void __attribute__ ((__noinline__))
foo(void)
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-2.c b/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
index 214a3ef7c04..5c402873ab7 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
@@ -59,15 +59,21 @@ extern void fool (long double);
void bar()
{
/* An argument of NaN is not evaluated at compile-time. */
+#ifndef __SPU__
foof (__builtin_exp2f (__builtin_nanf("")));
+#endif
foo (__builtin_exp2 (__builtin_nan("")));
fool (__builtin_exp2l (__builtin_nanl("")));
/* An argument of Inf/-Inf is not evaluated at compile-time. */
+#ifndef __SPU__
foof (__builtin_exp2f (__builtin_inff()));
+#endif
foo (__builtin_exp2 (__builtin_inf()));
fool (__builtin_exp2l (__builtin_infl()));
+#ifndef __SPU__
foof (__builtin_exp2f (-__builtin_inff()));
+#endif
foo (__builtin_exp2 (-__builtin_inf()));
fool (__builtin_exp2l (-__builtin_infl()));
@@ -130,24 +136,36 @@ void bar()
TESTIT (tgamma, -3.0);
/* An argument of NaN is not evaluated at compile-time. */
+#ifndef __SPU__
foof (__builtin_powf (__builtin_nanf(""), 2.5F));
+#endif
foo (__builtin_pow (__builtin_nan(""), 2.5));
fool (__builtin_powl (__builtin_nanl(""), 2.5L));
+#ifndef __SPU__
foof (__builtin_powf (2.5F, __builtin_nanf("")));
+#endif
foo (__builtin_pow (2.5, __builtin_nan("")));
fool (__builtin_powl (2.5L, __builtin_nanl("")));
/* An argument of Inf/-Inf is not evaluated at compile-time. */
+#ifndef __SPU__
foof (__builtin_powf (__builtin_inff(), 2.5F));
+#endif
foo (__builtin_pow (__builtin_inf(), 2.5));
fool (__builtin_powl (__builtin_infl(), 2.5L));
+#ifndef __SPU__
foof (__builtin_powf (-__builtin_inff(), 2.5F));
+#endif
foo (__builtin_pow (-__builtin_inf(), 2.5));
fool (__builtin_powl (-__builtin_infl(), 2.5L));
+#ifndef __SPU__
foof (__builtin_powf (2.5F, __builtin_inff()));
+#endif
foo (__builtin_pow (2.5, __builtin_inf()));
fool (__builtin_powl (2.5L, __builtin_infl()));
+#ifndef __SPU__
foof (__builtin_powf (2.5F, -__builtin_inff()));
+#endif
foo (__builtin_pow (2.5, -__builtin_inf()));
fool (__builtin_powl (2.5L, -__builtin_infl()));
@@ -235,17 +253,25 @@ void bar()
TESTIT (ilogb, 0.0);
TESTIT (ilogb, -0.0);
+#ifndef __SPU__
foof (__builtin_ilogbf (__builtin_inff()));
+#endif
foo (__builtin_ilogb (__builtin_inf()));
fool (__builtin_ilogbl (__builtin_infl()));
+#ifndef __SPU__
foof (__builtin_ilogbf (-__builtin_inff()));
+#endif
foo (__builtin_ilogb (-__builtin_inf()));
fool (__builtin_ilogbl (-__builtin_infl()));
+#ifndef __SPU__
foof (__builtin_ilogbf (__builtin_nanf("")));
+#endif
foo (__builtin_ilogb (__builtin_nan("")));
fool (__builtin_ilogbl (__builtin_nanl("")));
+#ifndef __SPU__
foof (__builtin_ilogbf (-__builtin_nanf("")));
+#endif
foo (__builtin_ilogb (-__builtin_nan("")));
fool (__builtin_ilogbl (-__builtin_nanl("")));
@@ -291,7 +317,8 @@ void bar()
}
/* { dg-final { scan-tree-dump-times "exp2 " 9 "original" } } */
-/* { dg-final { scan-tree-dump-times "exp2f" 9 "original" } } */
+/* { dg-final { scan-tree-dump-times "exp2f" 9 "original" { target { ! { spu*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "exp2f" 6 "original" { target { spu*-*-* } } } } */
/* { dg-final { scan-tree-dump-times "exp2l" 9 "original" } } */
/* { dg-final { scan-tree-dump-times "asin " 2 "original" } } */
/* { dg-final { scan-tree-dump-times "asinf" 2 "original" } } */
@@ -321,7 +348,8 @@ void bar()
/* { dg-final { scan-tree-dump-times "tgammaf" 5 "original" } } */
/* { dg-final { scan-tree-dump-times "tgammal" 5 "original" } } */
/* { dg-final { scan-tree-dump-times "pow " 13 "original" } } */
-/* { dg-final { scan-tree-dump-times "powf" 13 "original" } } */
+/* { dg-final { scan-tree-dump-times "powf" 13 "original" { target { ! { spu*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "powf" 7 "original" { target { spu*-*-* } } } } */
/* { dg-final { scan-tree-dump-times "powl" 13 "original" } } */
/* { dg-final { scan-tree-dump-times "fma " 3 "original" } } */
/* { dg-final { scan-tree-dump-times "fmaf" 3 "original" } } */
@@ -342,7 +370,8 @@ void bar()
/* { dg-final { scan-tree-dump-times "_logbf" 2 "original" } } */
/* { dg-final { scan-tree-dump-times "_logbl" 2 "original" } } */
/* { dg-final { scan-tree-dump-times "ilogb " 6 "original" } } */
-/* { dg-final { scan-tree-dump-times "ilogbf" 6 "original" } } */
+/* { dg-final { scan-tree-dump-times "ilogbf" 6 "original" { target { ! { spu*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "ilogbf" 2 "original" { target { spu*-*-* } } } } */
/* { dg-final { scan-tree-dump-times "ilogbl" 6 "original" } } */
/* { dg-final { scan-tree-dump-times "y0 " 3 "original" } } */
/* { dg-final { scan-tree-dump-times "y0f" 3 "original" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c b/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c
index 0bed72ba138..05e16ac2cc4 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c
@@ -62,6 +62,7 @@ extern void link_error(int);
/* Test that modf(NEG FUNCARG(ARGARG, &iptr)) == FRACRES &&
FUNCRES(iptr) is true. Check the sign of both as well. This is
for checking an argument of Inf. */
+#ifndef __SPU__
#define TESTIT_MODF2(NEG,FUNCARG,ARGARG,FUNCRES,FRACRES) do { \
float iptrf = 0.5; double iptr = 0.5; long double iptrl = 0.5; \
if (__builtin_modff(NEG __builtin_##FUNCARG##f(ARGARG),&iptrf) != FRACRES##f \
@@ -80,10 +81,27 @@ extern void link_error(int);
|| CKSGN_IPTR_L(iptrl,FRACRES##l)) \
link_error(__LINE__); \
} while (0)
+#else
+#define TESTIT_MODF2(NEG,FUNCARG,ARGARG,FUNCRES,FRACRES) do { \
+ /* SPU single-precision floating point format does not support Inf or Nan. */ \
+ double iptr = 0.5; long double iptrl = 0.5; \
+ if (__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr) != FRACRES \
+ || CKSGN(__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr), FRACRES) \
+ || CKIPTR(!__builtin_##FUNCRES(iptr),0) \
+ || CKSGN_IPTR(iptr,FRACRES)) \
+ link_error(__LINE__); \
+ if (__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl) != FRACRES##l \
+ || CKSGN_L(__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl), FRACRES##l) \
+ || CKIPTR(!__builtin_##FUNCRES##l(iptrl),0) \
+ || CKSGN_IPTR_L(iptrl,FRACRES##l)) \
+ link_error(__LINE__); \
+ } while (0)
+#endif
/* Test that FUNCRES(modf(NEG FUNCARG(ARGARG, &iptr))) is true &&
FUNCRES(iptr) is true. Check the sign of both as well. This is
for checking an argument of NaN. */
+#ifndef __SPU__
#define TESTIT_MODF3(NEG,FUNCARG,ARGARG,FUNCRES) do { \
float iptrf = 0.5; double iptr = 0.5; long double iptrl = 0.5; \
if (CKRES(!__builtin_##FUNCRES##f(__builtin_modff(NEG __builtin_##FUNCARG##f(ARGARG),&iptrf))) \
@@ -102,6 +120,22 @@ extern void link_error(int);
|| CKSGN_IPTR_L(iptrl,NEG 1)) \
link_error(__LINE__); \
} while (0)
+#else
+#define TESTIT_MODF3(NEG,FUNCARG,ARGARG,FUNCRES) do { \
+ /* SPU single-precision floating point format does not support Inf or Nan. */ \
+ double iptr = 0.5; long double iptrl = 0.5; \
+ if (CKRES(!__builtin_##FUNCRES(__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr))) \
+ || CKSGN(__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr), NEG 1) \
+ || CKIPTR(!__builtin_##FUNCRES(iptr),0) \
+ || CKSGN_IPTR(iptr,NEG 1)) \
+ link_error(__LINE__); \
+ if (CKRES(!__builtin_##FUNCRES##l(__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl))) \
+ || CKSGN_L(__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl), NEG 1) \
+ || CKIPTR(!__builtin_##FUNCRES##l(iptrl),0) \
+ || CKSGN_IPTR_L(iptrl,NEG 1)) \
+ link_error(__LINE__); \
+ } while (0)
+#endif
void __attribute__ ((__noinline__))
foo(void)
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
index 7fca1df7adf..ca5a4f8b6d7 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
@@ -2,6 +2,7 @@
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do run } */
/* { dg-options "" } */
+/* { dg-skip-if "Round to zero" { spu-*-* } } */
#include <float.h>
#include "fp-int-convert.h"
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c
index 24decb86fdf..a4b73e9cf5d 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c
@@ -1,6 +1,6 @@
/* Test floating-point conversions. __float128 type. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do run { target { ia64-*-* || { { i?86-*-* x86_64-*-*} && lp64 } } } } */
+/* { dg-do run { target ia64-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "" } */
#include "fp-int-convert.h"
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c
index e2b587c0cba..3e25f904dbe 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c
@@ -2,7 +2,6 @@
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
/* { dg-options "" } */
-/* { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
#include "fp-int-convert.h"
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
index 2b27153044c..faeae6050d1 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
@@ -9,7 +9,10 @@
int
main (void)
{
+#ifndef __SPU__
+ /* Single-precision floating point on SPU always rounds to zero. */
TEST_I_F(TItype, UTItype, float, FLT_MANT_DIG);
+#endif
TEST_I_F(TItype, UTItype, double, DBL_MANT_DIG);
/* Disable the long double tests when using IBM Extended Doubles.
They have variable precision, but constants calculated by gcc's
diff --git a/gcc/testsuite/gcc.dg/torture/type-generic-1.c b/gcc/testsuite/gcc.dg/torture/type-generic-1.c
index 9b69e923055..9a8e9d0048c 100644
--- a/gcc/testsuite/gcc.dg/torture/type-generic-1.c
+++ b/gcc/testsuite/gcc.dg/torture/type-generic-1.c
@@ -3,6 +3,7 @@
/* { dg-do run } */
/* { dg-options "-mieee" { target sh*-*-* } } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
#include "../tg-tests.h"
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c b/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c
new file mode 100644
index 00000000000..06710f21793
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c
@@ -0,0 +1,81 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-switchconv" } */
+/* { dg-do run } */
+
+extern void abort (void);
+
+static int X, Y;
+
+int check(int param)
+{
+ int a = 0;
+ int b = 1;
+
+ switch (param)
+ {
+ case -2:
+ a = 0;
+ b = -1;
+ break;
+ case 1:
+ case 2:
+ a = 8;
+ b = 6;
+ break;
+ case 3:
+ a = 9;
+ b = 5;
+ break;
+ case 6:
+ a = 10;
+ b = 4;
+ break;
+ default:
+ a = 16;
+ b = 1;
+ }
+
+ X = a;
+ Y = b;
+ return 0;
+}
+
+void assertions(int a, int b)
+{
+ if (X != a || Y != b)
+ abort();
+
+ return;
+}
+
+int main ()
+{
+ check (-10);
+ assertions (16, 1);
+
+ check (-2);
+ assertions (0, -1);
+
+ check(1);
+ assertions (8, 6);
+
+ check(2);
+ assertions (8, 6);
+
+ check(3);
+ assertions (9, 5);
+
+ check(5);
+ assertions (16, 1);
+
+ check(6);
+ assertions (10, 4);
+
+ check(12);
+ assertions (16, 1);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "Switch converted" "switchconv" } } */
+/* { dg-final { cleanup-tree-dump "switchconv" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c
index 3b7a547a6e7..85e444886d0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c
@@ -5,7 +5,7 @@
When the condition is true, we distribute "(int) (a + b)" as
"(int) a + (int) b", otherwise we keep the original. */
-/* { dg-do compile { target { ! mips64 } } } */
+/* { dg-do compile { target { { ! mips64 } && { ! spu-*-* } } } } */
/* { dg-options "-O -fwrapv -fdump-tree-fre-details" } */
/* From PR14844. */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c
index df92ceb9e81..3e0db3d84d7 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c
@@ -4,7 +4,7 @@
#include <stdarg.h>
#include "../../tree-vect.h"
-#define N 16
+#define N 17
struct test {
char ca[N];
};
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c
index 71f3977b16a..3aac4c90005 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c
@@ -3,20 +3,20 @@
#include <stdarg.h>
#include "../../tree-vect.h"
-#define N 8
+#define N 16
#define OFF 4
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
+int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 0, 1, 3, 5, 7, 11, 13, 17};
int main1 (int *pib)
{
int i;
int ia[N+OFF];
- int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
+ int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 0, 1, 3, 5, 7, 11, 13, 17};
for (i = OFF; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c
index e01b67e48e1..af694a36dfd 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c
@@ -6,7 +6,7 @@
#define N 26
int a[N];
-int main1 (int X)
+__attribute__ ((noinline)) int main1 (int X)
{
int s = X;
int i;
diff --git a/gcc/testsuite/gcc.target/i386/pr32191.c b/gcc/testsuite/gcc.target/i386/pr32191.c
index 0da5d5c5aae..f5238b01dee 100644
--- a/gcc/testsuite/gcc.target/i386/pr32191.c
+++ b/gcc/testsuite/gcc.target/i386/pr32191.c
@@ -1,5 +1,4 @@
/* { dg-do compile } */
-/* { dg-require-effective-target lp64 } */
/* { dg-options "-std=c99" } */
typedef _Complex float __attribute__((mode(TC))) _Complex128;
diff --git a/gcc/testsuite/gcc.target/i386/pr32268.c b/gcc/testsuite/gcc.target/i386/pr32268.c
index 472259c1eba..a5d673ad94f 100644
--- a/gcc/testsuite/gcc.target/i386/pr32268.c
+++ b/gcc/testsuite/gcc.target/i386/pr32268.c
@@ -1,5 +1,4 @@
/* { dg-do run { target *-*-linux* } } */
-/* { dg-require-effective-target lp64 } */
/* { dg-options "-O2" } */
extern void abort(void);
diff --git a/gcc/testsuite/gcc.target/i386/quad-sse.c b/gcc/testsuite/gcc.target/i386/quad-sse.c
new file mode 100644
index 00000000000..fed61122f19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/quad-sse.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+__float128 x, y;
+
+__float128 test_1(void)
+{
+ return -x;
+}
+
+__float128 test_2(void)
+{
+ return __builtin_fabsq (x);
+}
+
+__float128 test_3(void)
+{
+ return __builtin_copysignq (x, y);
+}
+
+/* { dg-final { scan-assembler-not "call" } } */
diff --git a/gcc/testsuite/gfortran.dg/count_mask_1.f90 b/gcc/testsuite/gfortran.dg/count_mask_1.f90
new file mode 100644
index 00000000000..f9859fa2d0f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/count_mask_1.f90
@@ -0,0 +1,8 @@
+! { dg-do run }
+! PR 36590, PR 36681
+program test
+ logical(kind=1),parameter :: t=.true.,f=.false.
+ logical(kind=1),dimension(9) :: hexa,hexb
+ data hexa/f,f,t,t,f,f,f,t,f/,hexb/f,t,f,f,f,t,t,f,f/
+ isum=count(hexa(1:9).eqv.hexb(1:9))
+end program
diff --git a/gcc/testsuite/gfortran.dg/namelist_51.f90 b/gcc/testsuite/gfortran.dg/namelist_51.f90
new file mode 100644
index 00000000000..9663bd68d9f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/namelist_51.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+! PR36676 Namelist comment problems
+! test case from PR, reduced by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program mem_nml
+ implicit none
+ integer, save :: nxc
+ nxc = 0
+ call readNamelist()
+contains
+subroutine readNamelist()
+implicit none
+namelist /INPUT/ nxc
+open(unit = 101, status="scratch")
+write(101,'(a)')"&INPUT"
+write(101,'(a)')""
+write(101,'(a)')"!"
+write(101,'(a)')"!"
+write(101,'(a)')"!"
+write(101,'(a)')"nxc = 100"
+write(101,'(a)')"&END"
+rewind(101)
+read(unit = 101, nml = INPUT)
+if (nxc /= 100) call abort
+close(unit = 101)
+endsubroutine
+end program mem_nml
+
diff --git a/gcc/testsuite/gnat.dg/pack10.adb b/gcc/testsuite/gnat.dg/pack10.adb
new file mode 100644
index 00000000000..945e404d2ec
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/pack10.adb
@@ -0,0 +1,34 @@
+-- { dg-do run }
+
+procedure Pack10 is
+
+ type U16 is mod 2**16;
+ type U8 is mod 2**8;
+
+ type R is record
+ A : U16;
+ B : U8;
+ end record;
+
+ type M is array (1..2) of R;
+ pragma Pack (M);
+ -- This size clause can actually be omitted
+ for M'Size use 48;
+
+ type R2 is record
+ C : M;
+ D : U8;
+ end record;
+ for R2 use record
+ C at 0 range 0 .. 24*2-1;
+ end record;
+
+ My_R2 : R2;
+
+begin
+ My_R2.D := 1;
+ My_R2.C(2).B := 0;
+ if My_R2.D /=1 then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp
index 474af620d16..84538a6f8b4 100644
--- a/gcc/testsuite/lib/compat.exp
+++ b/gcc/testsuite/lib/compat.exp
@@ -275,6 +275,15 @@ proc compat-execute { src1 sid use_alt } {
set extra_flags_3 [compat-get-options $src3]
set compile_xfail_3 $compiler_conditional_xfail_data
+ # On the SPU, most of the compat test cases exceed local store size.
+ # Use automatic overlay support to make them fit.
+ if { [istarget spu-*-elf*] } {
+ set extra_flags_1 "$extra_flags_1 -Wl,--auto-overlay"
+ set extra_flags_1 "$extra_flags_1 -ffunction-sections"
+ set extra_flags_2 "$extra_flags_2 -ffunction-sections"
+ set extra_flags_3 "$extra_flags_3 -ffunction-sections"
+ }
+
# Define the names of the object files.
regsub "sid" "sid_main_tst.o" $sid obj1
regsub "sid" "sid_x_tst.o" $sid obj2_tst
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ecca42118b2..9c12dddaeed 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1131,7 +1131,8 @@ proc check_effective_target_vect_cmdline_needed { } {
|| ([istarget powerpc*-*-*]
&& ([check_effective_target_powerpc_spe]
|| [check_effective_target_powerpc_altivec]))
- || [istarget spu-*-*] } {
+ || [istarget spu-*-*]
+ || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
set et_vect_cmdline_needed_saved 0
}
}
@@ -1158,7 +1159,8 @@ proc check_effective_target_vect_int { } {
|| [istarget x86_64-*-*]
|| [istarget sparc*-*-*]
|| [istarget alpha*-*-*]
- || [istarget ia64-*-*] } {
+ || [istarget ia64-*-*]
+ || [check_effective_target_arm32] } {
set et_vect_int_saved 1
}
}
@@ -1264,6 +1266,22 @@ proc check_effective_target_arm_neon_hw { } {
} "-mfpu=neon -mfloat-abi=softfp"]
}
+# Return 1 if this is a ARM target with NEON enabled.
+
+proc check_effective_target_arm_neon { } {
+ if { [check_effective_target_arm32] } {
+ return [check_no_compiler_messages arm_neon object {
+ #ifndef __ARM_NEON__
+ #error not NEON
+ #else
+ int dummy;
+ #endif
+ }]
+ } else {
+ return 0
+ }
+}
+
# Return 1 if this a Loongson-2E or -2F target using an ABI that supports
# the Loongson vector modes.
@@ -1395,7 +1413,8 @@ proc check_effective_target_vect_shift { } {
&& ![istarget powerpc-*-linux*paired*])
|| [istarget ia64-*-*]
|| [istarget i?86-*-*]
- || [istarget x86_64-*-*] } {
+ || [istarget x86_64-*-*]
+ || [check_effective_target_arm32] } {
set et_vect_shift_saved 1
}
}
@@ -1414,6 +1433,7 @@ proc check_effective_target_vect_long { } {
&& ![istarget powerpc-*-linux*paired*])
&& [check_effective_target_ilp32])
|| [istarget x86_64-*-*]
+ || [check_effective_target_arm32]
|| ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
set answer 1
} else {
@@ -1440,7 +1460,8 @@ proc check_effective_target_vect_float { } {
|| [istarget spu-*-*]
|| [istarget mipsisa64*-*-*]
|| [istarget x86_64-*-*]
- || [istarget ia64-*-*] } {
+ || [istarget ia64-*-*]
+ || [check_effective_target_arm32] } {
set et_vect_float_saved 1
}
}
@@ -1819,7 +1840,8 @@ proc check_effective_target_vect_no_align { } {
set et_vect_no_align_saved 0
if { [istarget mipsisa64*-*-*]
|| [istarget sparc*-*-*]
- || [istarget ia64-*-*] } {
+ || [istarget ia64-*-*]
+ || [check_effective_target_arm32] } {
set et_vect_no_align_saved 1
}
}
@@ -2008,7 +2030,8 @@ proc check_effective_target_vect_int_mult { } {
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
|| [istarget spu-*-*]
|| [istarget i?86-*-*]
- || [istarget x86_64-*-*] } {
+ || [istarget x86_64-*-*]
+ || [check_effective_target_arm32] } {
set et_vect_int_mult_saved 1
}
}
diff --git a/gcc/timevar.def b/gcc/timevar.def
index 0429eb41275..a2693fcc199 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -140,6 +140,7 @@ DEFTIMEVAR (TV_TREE_NRV , "tree NRV optimization")
DEFTIMEVAR (TV_TREE_COPY_RENAME , "tree rename SSA copies")
DEFTIMEVAR (TV_TREE_SSA_VERIFY , "tree SSA verifier")
DEFTIMEVAR (TV_TREE_STMT_VERIFY , "tree STMT verifier")
+DEFTIMEVAR (TV_TREE_SWITCH_CONVERSION, "tree switch initialization conversion")
DEFTIMEVAR (TV_CGRAPH_VERIFY , "callgraph verifier")
DEFTIMEVAR (TV_DOM_FRONTIERS , "dominance frontiers")
DEFTIMEVAR (TV_DOMINANCE , "dominance computation")
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index d1f615ad495..c695863e553 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -508,6 +508,7 @@ extern struct gimple_opt_pass pass_O0_always_inline;
extern struct gimple_opt_pass pass_inline_parameters;
extern struct gimple_opt_pass pass_all_early_optimizations;
extern struct gimple_opt_pass pass_update_address_taken;
+extern struct gimple_opt_pass pass_convert_switch;
/* The root of the compilation pass tree, once constructed. */
extern struct opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes;
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index ac9d8514784..c49f0a48909 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -257,42 +257,27 @@ static bool
can_propagate_from (tree def_stmt)
{
tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
+ use_operand_p use_p;
+ ssa_op_iter iter;
/* If the rhs has side-effects we cannot propagate from it. */
if (TREE_SIDE_EFFECTS (rhs))
return false;
/* If the rhs is a load we cannot propagate from it. */
- if (REFERENCE_CLASS_P (rhs))
+ if (REFERENCE_CLASS_P (rhs)
+ || DECL_P (rhs))
return false;
/* Constants can be always propagated. */
if (is_gimple_min_invariant (rhs))
return true;
- /* We cannot propagate ssa names that occur in abnormal phi nodes. */
- switch (TREE_CODE_LENGTH (TREE_CODE (rhs)))
- {
- case 3:
- if (TREE_OPERAND (rhs, 2) != NULL_TREE
- && TREE_CODE (TREE_OPERAND (rhs, 2)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (rhs, 2)))
- return false;
- case 2:
- if (TREE_OPERAND (rhs, 1) != NULL_TREE
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (rhs, 1)))
- return false;
- case 1:
- if (TREE_OPERAND (rhs, 0) != NULL_TREE
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (rhs, 0)))
- return false;
- break;
-
- default:
+ /* If any of the SSA operands occurs in abnormal PHIs we cannot
+ propagate from this stmt. */
+ FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_USE)
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (USE_FROM_PTR (use_p)))
return false;
- }
/* If the definition is a conversion of a pointer to a function type,
then we can not apply optimizations as some targets require function
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 0824b3666a8..553125641ce 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -209,24 +209,6 @@ struct variable_info
/* ID of this variable */
unsigned int id;
- /* Name of this variable */
- const char *name;
-
- /* Tree that this variable is associated with. */
- tree decl;
-
- /* Offset of this variable, in bits, from the base variable */
- unsigned HOST_WIDE_INT offset;
-
- /* Size of the variable, in bits. */
- unsigned HOST_WIDE_INT size;
-
- /* Full size of the base variable, in bits. */
- unsigned HOST_WIDE_INT fullsize;
-
- /* A link to the variable for the next field in this structure. */
- struct variable_info *next;
-
/* True if this is a variable created by the constraint analysis, such as
heap variables and constraints we had to break up. */
unsigned int is_artificial_var:1;
@@ -248,16 +230,34 @@ struct variable_info
variable. This is used for C++ placement new. */
unsigned int no_tbaa_pruning : 1;
+ /* Variable id this was collapsed to due to type unsafety. Zero if
+ this variable was not collapsed. This should be unused completely
+ after build_succ_graph, or something is broken. */
+ unsigned int collapsed_to;
+
+ /* A link to the variable for the next field in this structure. */
+ struct variable_info *next;
+
+ /* Offset of this variable, in bits, from the base variable */
+ unsigned HOST_WIDE_INT offset;
+
+ /* Size of the variable, in bits. */
+ unsigned HOST_WIDE_INT size;
+
+ /* Full size of the base variable, in bits. */
+ unsigned HOST_WIDE_INT fullsize;
+
+ /* Name of this variable */
+ const char *name;
+
+ /* Tree that this variable is associated with. */
+ tree decl;
+
/* Points-to set for this variable. */
bitmap solution;
/* Old points-to set for this variable. */
bitmap oldsolution;
-
- /* Variable id this was collapsed to due to type unsafety. This
- should be unused completely after build_succ_graph, or something
- is broken. */
- struct variable_info *collapsed_to;
};
typedef struct variable_info *varinfo_t;
@@ -289,8 +289,8 @@ get_varinfo_fc (unsigned int n)
{
varinfo_t v = VEC_index (varinfo_t, varmap, n);
- if (v->collapsed_to)
- return v->collapsed_to;
+ if (v->collapsed_to != 0)
+ return get_varinfo (v->collapsed_to);
return v;
}
@@ -385,7 +385,7 @@ new_var_info (tree t, unsigned int id, const char *name)
ret->solution = BITMAP_ALLOC (&pta_obstack);
ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
ret->next = NULL;
- ret->collapsed_to = NULL;
+ ret->collapsed_to = 0;
return ret;
}
@@ -412,6 +412,7 @@ struct constraint_expr
typedef struct constraint_expr ce_s;
DEF_VEC_O(ce_s);
DEF_VEC_ALLOC_O(ce_s, heap);
+static void get_constraint_for_1 (tree, VEC(ce_s, heap) **, bool);
static void get_constraint_for (tree, VEC(ce_s, heap) **);
static void do_deref (VEC (ce_s, heap) **);
@@ -903,11 +904,8 @@ add_implicit_graph_edge (constraint_graph_t graph, unsigned int to,
if (!graph->implicit_preds[to])
graph->implicit_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
- if (!bitmap_bit_p (graph->implicit_preds[to], from))
- {
- stats.num_implicit_edges++;
- bitmap_set_bit (graph->implicit_preds[to], from);
- }
+ if (bitmap_set_bit (graph->implicit_preds[to], from))
+ stats.num_implicit_edges++;
}
/* Add a predecessor graph edge to GRAPH, going from TO to FROM if
@@ -920,8 +918,7 @@ add_pred_graph_edge (constraint_graph_t graph, unsigned int to,
{
if (!graph->preds[to])
graph->preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
- if (!bitmap_bit_p (graph->preds[to], from))
- bitmap_set_bit (graph->preds[to], from);
+ bitmap_set_bit (graph->preds[to], from);
}
/* Add a graph edge to GRAPH, going from FROM to TO if
@@ -942,12 +939,11 @@ add_graph_edge (constraint_graph_t graph, unsigned int to,
if (!graph->succs[from])
graph->succs[from] = BITMAP_ALLOC (&pta_obstack);
- if (!bitmap_bit_p (graph->succs[from], to))
+ if (bitmap_set_bit (graph->succs[from], to))
{
r = true;
if (to < FIRST_REF_NODE && from < FIRST_REF_NODE)
stats.num_edges++;
- bitmap_set_bit (graph->succs[from], to);
}
return r;
}
@@ -1404,13 +1400,11 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
unsigned int j;
bitmap_iterator bi;
- if (bitmap_bit_p (delta, anything_id))
- {
- flag = !bitmap_bit_p (sol, anything_id);
- if (flag)
- bitmap_set_bit (sol, anything_id);
- goto done;
- }
+ if (bitmap_bit_p (delta, anything_id))
+ {
+ flag |= bitmap_set_bit (sol, anything_id);
+ goto done;
+ }
/* For each variable j in delta (Sol(y)), add
an edge in the graph from j to x, and union Sol(j) into Sol(x). */
@@ -1435,13 +1429,9 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
/* Merging the solution from ESCAPED needlessly increases
the set. Use ESCAPED as representative instead.
Same for CALLUSED. */
- else if ((get_varinfo (t)->id == escaped_id
- || get_varinfo (t)->id == callused_id)
- && !bitmap_bit_p (sol, get_varinfo (t)->id))
- {
- bitmap_set_bit (sol, get_varinfo (t)->id);
- flag = true;
- }
+ else if (get_varinfo (t)->id == escaped_id
+ || get_varinfo (t)->id == callused_id)
+ flag |= bitmap_set_bit (sol, get_varinfo (t)->id);
else if (add_graph_edge (graph, lhs, t))
flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
}
@@ -1485,14 +1475,11 @@ do_ds_constraint (constraint_t c, bitmap delta)
continue;
t = find (v->id);
- if (!bitmap_bit_p (get_varinfo (t)->solution, anything_id))
+ if (bitmap_set_bit (get_varinfo (t)->solution, anything_id)
+ && !TEST_BIT (changed, t))
{
- bitmap_set_bit (get_varinfo (t)->solution, anything_id);
- if (!TEST_BIT (changed, t))
- {
- SET_BIT (changed, t);
- changed_count++;
- }
+ SET_BIT (changed, t);
+ changed_count++;
}
}
return;
@@ -2495,13 +2482,32 @@ get_vi_for_tree (tree t)
return (varinfo_t) *slot;
}
-/* Get a constraint expression from an SSA_VAR_P node. */
+/* Get a constraint expression for a new temporary variable. */
static struct constraint_expr
-get_constraint_exp_from_ssa_var (tree t)
+get_constraint_exp_for_temp (tree t)
+{
+ struct constraint_expr cexpr;
+
+ gcc_assert (SSA_VAR_P (t));
+
+ cexpr.type = SCALAR;
+ cexpr.var = get_vi_for_tree (t)->id;
+ cexpr.offset = 0;
+
+ return cexpr;
+}
+
+/* Get a constraint expression vector from an SSA_VAR_P node.
+ If address_p is true, the result will be taken its address of. */
+
+static void
+get_constraint_for_ssa_var (tree t, VEC(ce_s, heap) **results, bool address_p)
{
struct constraint_expr cexpr;
+ varinfo_t vi;
+ /* We allow FUNCTION_DECLs here even though it doesn't make much sense. */
gcc_assert (SSA_VAR_P (t) || DECL_P (t));
/* For parameters, get at the points-to set for the actual parm
@@ -2509,21 +2515,37 @@ get_constraint_exp_from_ssa_var (tree t)
if (TREE_CODE (t) == SSA_NAME
&& TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
&& SSA_NAME_IS_DEFAULT_DEF (t))
- return get_constraint_exp_from_ssa_var (SSA_NAME_VAR (t));
+ {
+ get_constraint_for_ssa_var (SSA_NAME_VAR (t), results, address_p);
+ return;
+ }
+ vi = get_vi_for_tree (t);
+ cexpr.var = vi->id;
cexpr.type = SCALAR;
-
- cexpr.var = get_vi_for_tree (t)->id;
+ cexpr.offset = 0;
/* If we determine the result is "anything", and we know this is readonly,
say it points to readonly memory instead. */
if (cexpr.var == anything_id && TREE_READONLY (t))
{
+ gcc_unreachable ();
cexpr.type = ADDRESSOF;
cexpr.var = readonly_id;
}
- cexpr.offset = 0;
- return cexpr;
+ /* If we are not taking the address of the constraint expr, add all
+ sub-fiels of the variable as well. */
+ if (!address_p)
+ {
+ for (; vi; vi = vi->next)
+ {
+ cexpr.var = vi->id;
+ VEC_safe_push (ce_s, heap, *results, &cexpr);
+ }
+ return;
+ }
+
+ VEC_safe_push (ce_s, heap, *results, &cexpr);
}
/* Process constraint T, performing various simplifications and then
@@ -2564,13 +2586,7 @@ process_constraint (constraint_t t)
tree pointertype = TREE_TYPE (rhsdecl);
tree pointedtotype = TREE_TYPE (pointertype);
tree tmpvar = create_tmp_var_raw (pointedtotype, "doubledereftmp");
- struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar);
-
- /* If this is an aggregate of known size, we should have passed
- this off to do_structure_copy, and it should have broken it
- up. */
- gcc_assert (!AGGREGATE_TYPE_P (pointedtotype)
- || get_varinfo (rhs.var)->is_unknown_size_var);
+ struct constraint_expr tmplhs = get_constraint_exp_for_temp (tmpvar);
process_constraint (new_constraint (tmplhs, rhs));
process_constraint (new_constraint (lhs, tmplhs));
@@ -2581,7 +2597,7 @@ process_constraint (constraint_t t)
tree rhsdecl = get_varinfo (rhs.var)->decl;
tree pointertype = TREE_TYPE (rhsdecl);
tree tmpvar = create_tmp_var_raw (pointertype, "derefaddrtmp");
- struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar);
+ struct constraint_expr tmplhs = get_constraint_exp_for_temp (tmpvar);
process_constraint (new_constraint (tmplhs, rhs));
process_constraint (new_constraint (lhs, tmplhs));
@@ -2625,10 +2641,12 @@ bitpos_of_field (const tree fdecl)
}
-/* Given a COMPONENT_REF T, return the constraint_expr for it. */
+/* Given a COMPONENT_REF T, return the constraint_expr vector for it.
+ If address_p is true the result will be taken its address of. */
static void
-get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
+get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
+ bool address_p)
{
tree orig_t = t;
HOST_WIDE_INT bitsize = -1;
@@ -2636,7 +2654,6 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
HOST_WIDE_INT bitpos;
tree forzero;
struct constraint_expr *result;
- unsigned int beforelength = VEC_length (ce_s, *results);
/* Some people like to do cute things like take the address of
&0->a.b */
@@ -2657,11 +2674,12 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
t = get_ref_base_and_extent (t, &bitpos, &bitsize, &bitmaxsize);
- get_constraint_for (t, results);
+ /* Pretend to take the address of the base, we'll take care of
+ adding the required subset of sub-fields below. */
+ get_constraint_for_1 (t, results, true);
result = VEC_last (ce_s, *results);
- result->offset = bitpos;
- gcc_assert (beforelength + 1 == VEC_length (ce_s, *results));
+ gcc_assert (VEC_length (ce_s, *results) == 1);
/* This can also happen due to weird offsetof type macros. */
if (TREE_CODE (t) != ADDR_EXPR && result->type == ADDRESSOF)
@@ -2674,28 +2692,34 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
ignore this constraint. When we handle pointer subtraction,
we may have to do something cute here. */
- if (result->offset < get_varinfo (result->var)->fullsize
+ if ((unsigned HOST_WIDE_INT)bitpos < get_varinfo (result->var)->fullsize
&& bitmaxsize != 0)
{
/* It's also not true that the constraint will actually start at the
right offset, it may start in some padding. We only care about
setting the constraint to the first actual field it touches, so
walk to find it. */
+ struct constraint_expr cexpr = *result;
varinfo_t curr;
- for (curr = get_varinfo (result->var); curr; curr = curr->next)
+ VEC_pop (ce_s, *results);
+ cexpr.offset = 0;
+ for (curr = get_varinfo (cexpr.var); curr; curr = curr->next)
{
if (ranges_overlap_p (curr->offset, curr->size,
- result->offset, bitmaxsize))
+ bitpos, bitmaxsize))
{
- result->var = curr->id;
- break;
+ cexpr.var = curr->id;
+ VEC_safe_push (ce_s, heap, *results, &cexpr);
+ if (address_p)
+ break;
}
}
/* assert that we found *some* field there. The user couldn't be
accessing *only* padding. */
/* Still the user could access one past the end of an array
embedded in a struct resulting in accessing *only* padding. */
- gcc_assert (curr || ref_contains_array_ref (orig_t));
+ gcc_assert (VEC_length (ce_s, *results) >= 1
+ || ref_contains_array_ref (orig_t));
}
else if (bitmaxsize == 0)
{
@@ -2706,8 +2730,6 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
else
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Access to past the end of variable, ignoring\n");
-
- result->offset = 0;
}
else if (bitmaxsize == -1)
{
@@ -2716,6 +2738,8 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
result->var = anything_id;
result->offset = 0;
}
+ else
+ result->offset = bitpos;
}
@@ -2740,7 +2764,7 @@ do_deref (VEC (ce_s, heap) **constraints)
else if (c->type == DEREF)
{
tree tmpvar = create_tmp_var_raw (ptr_type_node, "dereftmp");
- struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar);
+ struct constraint_expr tmplhs = get_constraint_exp_for_temp (tmpvar);
process_constraint (new_constraint (tmplhs, *c));
c->var = tmplhs.var;
}
@@ -2752,7 +2776,7 @@ do_deref (VEC (ce_s, heap) **constraints)
/* Given a tree T, return the constraint expression for it. */
static void
-get_constraint_for (tree t, VEC (ce_s, heap) **results)
+get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
{
struct constraint_expr temp;
@@ -2796,32 +2820,8 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
struct constraint_expr *c;
unsigned int i;
tree exp = TREE_OPERAND (t, 0);
- tree pttype = TREE_TYPE (TREE_TYPE (t));
-
- get_constraint_for (exp, results);
-
- /* Complex types are special. Taking the address of one
- allows you to access either part of it through that
- pointer. */
- if (VEC_length (ce_s, *results) == 1 &&
- TREE_CODE (pttype) == COMPLEX_TYPE)
- {
- struct constraint_expr *origrhs;
- varinfo_t origvar;
- struct constraint_expr tmp;
-
- gcc_assert (VEC_length (ce_s, *results) == 1);
- origrhs = VEC_last (ce_s, *results);
- tmp = *origrhs;
- VEC_pop (ce_s, *results);
- origvar = get_varinfo (origrhs->var);
- for (; origvar; origvar = origvar->next)
- {
- tmp.var = origvar->id;
- VEC_safe_push (ce_s, heap, *results, &tmp);
- }
- }
+ get_constraint_for_1 (exp, results, true);
for (i = 0; VEC_iterate (ce_s, *results, i, c); i++)
{
@@ -2888,14 +2888,14 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
{
case INDIRECT_REF:
{
- get_constraint_for (TREE_OPERAND (t, 0), results);
+ get_constraint_for_1 (TREE_OPERAND (t, 0), results, address_p);
do_deref (results);
return;
}
case ARRAY_REF:
case ARRAY_RANGE_REF:
case COMPONENT_REF:
- get_constraint_for_component_ref (t, results);
+ get_constraint_for_component_ref (t, results, address_p);
return;
default:
{
@@ -2920,7 +2920,7 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
if (!(POINTER_TYPE_P (TREE_TYPE (t))
&& ! POINTER_TYPE_P (TREE_TYPE (op))))
{
- get_constraint_for (op, results);
+ get_constraint_for_1 (op, results, address_p);
return;
}
@@ -2942,15 +2942,13 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
{
case PHI_NODE:
{
- get_constraint_for (PHI_RESULT (t), results);
+ get_constraint_for_1 (PHI_RESULT (t), results, address_p);
return;
}
break;
case SSA_NAME:
{
- struct constraint_expr temp;
- temp = get_constraint_exp_from_ssa_var (t);
- VEC_safe_push (ce_s, heap, *results, &temp);
+ get_constraint_for_ssa_var (t, results, address_p);
return;
}
break;
@@ -2966,9 +2964,7 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
}
case tcc_declaration:
{
- struct constraint_expr temp;
- temp = get_constraint_exp_from_ssa_var (t);
- VEC_safe_push (ce_s, heap, *results, &temp);
+ get_constraint_for_ssa_var (t, results, address_p);
return;
}
default:
@@ -2982,6 +2978,15 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
}
}
+/* Given a gimple tree T, return the constraint expression vector for it. */
+
+static void
+get_constraint_for (tree t, VEC (ce_s, heap) **results)
+{
+ gcc_assert (VEC_length (ce_s, *results) == 0);
+
+ get_constraint_for_1 (t, results, false);
+}
/* Handle the structure copy case where we have a simple structure copy
between LHS and RHS that is of SIZE (in bits)
@@ -3118,8 +3123,8 @@ collapse_rest_of_var (unsigned int var)
fprintf (dump_file, "Type safety: Collapsing var %s into %s\n",
field->name, currvar->name);
- gcc_assert (!field->collapsed_to);
- field->collapsed_to = currvar;
+ gcc_assert (field->collapsed_to == 0);
+ field->collapsed_to = currvar->id;
}
currvar->next = NULL;
@@ -3140,8 +3145,10 @@ do_structure_copy (tree lhsop, tree rhsop)
unsigned HOST_WIDE_INT lhssize;
unsigned HOST_WIDE_INT rhssize;
- get_constraint_for (lhsop, &lhsc);
- get_constraint_for (rhsop, &rhsc);
+ /* Pretend we are taking the address of the constraint exprs.
+ We deal with walking the sub-fields ourselves. */
+ get_constraint_for_1 (lhsop, &lhsc, true);
+ get_constraint_for_1 (rhsop, &rhsc, true);
gcc_assert (VEC_length (ce_s, lhsc) == 1);
gcc_assert (VEC_length (ce_s, rhsc) == 1);
lhs = *(VEC_last (ce_s, lhsc));
@@ -3436,8 +3443,9 @@ handle_const_call (tree stmt)
struct constraint_expr rhsc;
unsigned int j;
struct constraint_expr *lhsp;
- tree arg;
+ tree arg, tmpvar;
call_expr_arg_iterator iter;
+ struct constraint_expr tmpc;
get_constraint_for (lhs, &lhsc);
@@ -3453,12 +3461,18 @@ handle_const_call (tree stmt)
return;
}
+ /* We always use a temporary here, otherwise we end up with a quadratic
+ amount of constraints for
+ large_struct = const_call (large_struct);
+ in field-sensitive PTA. */
+ tmpvar = create_tmp_var_raw (ptr_type_node, "consttmp");
+ tmpc = get_constraint_exp_for_temp (tmpvar);
+
/* May return addresses of globals. */
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = ADDRESSOF;
- for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
- process_constraint (new_constraint (*lhsp, rhsc));
+ process_constraint (new_constraint (tmpc, rhsc));
/* May return arguments. */
FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
@@ -3467,13 +3481,16 @@ handle_const_call (tree stmt)
VEC(ce_s, heap) *argc = NULL;
struct constraint_expr *argp;
int i;
+
get_constraint_for (arg, &argc);
for (i = 0; VEC_iterate (ce_s, argc, i, argp); i++)
- for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
- process_constraint (new_constraint (*lhsp, *argp));
+ process_constraint (new_constraint (tmpc, *argp));
VEC_free (ce_s, heap, argc);
}
+ for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
+ process_constraint (new_constraint (*lhsp, tmpc));
+
VEC_free (ce_s, heap, lhsc);
}
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
new file mode 100644
index 00000000000..68d6b50d1bd
--- /dev/null
+++ b/gcc/tree-switch-conversion.c
@@ -0,0 +1,880 @@
+/* Switch Conversion converts variable initializations based on switch
+ statements to initializations from a static array.
+ Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+ Contributed by Martin Jambor <jamborm@suse.cz>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+/*
+ Switch initialization conversion
+
+The following pass changes simple initializations of scalars in a switch
+statement into initializations from a static array. Obviously, the values must
+be constant and known at compile time and a default branch must be
+provided. For example, the following code:
+
+ int a,b;
+
+ switch (argc)
+ {
+ case 1:
+ case 2:
+ a_1 = 8;
+ b_1 = 6;
+ break;
+ case 3:
+ a_2 = 9;
+ b_2 = 5;
+ break;
+ case 12:
+ a_3 = 10;
+ b_3 = 4;
+ break;
+ default:
+ a_4 = 16;
+ b_4 = 1;
+ }
+ a_5 = PHI <a_1, a_2, a_3, a_4>
+ b_5 = PHI <b_1, b_2, b_3, b_4>
+
+
+is changed into:
+
+ static const int = CSWTCH01[] = {6, 6, 5, 1, 1, 1, 1, 1, 1, 1, 1, 4};
+ static const int = CSWTCH02[] = {8, 8, 9, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 10};
+
+ if (((unsigned) argc) - 1 < 11)
+ {
+ a_6 = CSWTCH02[argc - 1];
+ b_6 = CSWTCH01[argc - 1];
+ }
+ else
+ {
+ a_7 = 16;
+ b_7 = 1;
+ }
+ a_5 = PHI <a_6, a_7>
+ b_b = PHI <b_6, b_7>
+
+There are further constraints. Specifically, the range of values across all
+case labels must not be bigger than SWITCH_CONVERSION_BRANCH_RATIO (default
+eight) times the number of the actual switch branches. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include <signal.h>
+
+#include "line-map.h"
+#include "params.h"
+#include "flags.h"
+#include "tree.h"
+#include "basic-block.h"
+#include "tree-flow.h"
+#include "tree-flow-inline.h"
+#include "tree-ssa-operands.h"
+#include "output.h"
+#include "input.h"
+#include "tree-pass.h"
+#include "diagnostic.h"
+#include "tree-dump.h"
+#include "timevar.h"
+
+/* The main structure of the pass. */
+struct switch_conv_info
+{
+ /* The expression used to decide the switch branch. (It is subsequently used
+ as the index to the created array.) */
+ tree index_expr;
+
+ /* The following integer constants store the minimum value covered by the
+ cases. */
+ tree range_min;
+
+ /* The difference between the above two numbers, i.e. The size of the array
+ that would have to be created by the transformation. */
+ tree range_size;
+
+ /* Basic block that contains the actual SWITCH_EXPR. */
+ basic_block switch_bb;
+
+ /* All branches of the switch statement must have a single successor stored in
+ the following variable. */
+ basic_block final_bb;
+
+ /* Number of phi nodes in the final bb (that we'll be replacing). */
+ int phi_count;
+
+ /* Array of default values, in the same order as phi nodes. */
+ tree *default_values;
+
+ /* Constructors of new static arrays. */
+ VEC (constructor_elt, gc) **constructors;
+
+ /* Array of ssa names that are initialized with a value from a new static
+ array. */
+ tree *target_inbound_names;
+
+ /* Array of ssa names that are initialized with the default value if the
+ switch expression is out of range. */
+ tree *target_outbound_names;
+
+ /* The probability of the default edge in the replaced switch. */
+ int default_prob;
+
+ /* The count of the default edge in the replaced switch. */
+ gcov_type default_count;
+
+ /* Combined count of all other (non-default) edges in the replaced switch. */
+ gcov_type other_count;
+
+ /* The first load statement that loads a temporary from a new static array.
+ */
+ tree arr_ref_first;
+
+ /* The last load statement that loads a temporary from a new static array. */
+ tree arr_ref_last;
+
+ /* String reason why the case wasn't a good candidate that is written to the
+ dump file, if there is one. */
+ const char *reason;
+};
+
+/* Global pass info. */
+static struct switch_conv_info info;
+
+
+/* Checks whether the range given by individual case statements of the SWTCH
+ switch statement isn't too big and whether the number of branches actually
+ satisfies the size of the new array. */
+
+static bool
+check_range (tree swtch)
+{
+ tree min_case, max_case;
+ tree cases = SWITCH_LABELS (swtch);
+ unsigned int branch_num = TREE_VEC_LENGTH (cases);
+ tree range_max;
+
+ /* The gimplifier has already sorted the cases by CASE_LOW and ensured there
+ is a default label which is the last in the vector. */
+
+ min_case = TREE_VEC_ELT (cases, 0);
+ info.range_min = CASE_LOW (min_case);
+
+ gcc_assert (branch_num > 1);
+ gcc_assert (CASE_LOW (TREE_VEC_ELT (cases, branch_num - 1)) == NULL_TREE);
+ max_case = TREE_VEC_ELT (cases, branch_num - 2);
+ if (CASE_HIGH (max_case) != NULL_TREE)
+ range_max = CASE_HIGH (max_case);
+ else
+ range_max = CASE_LOW (max_case);
+
+ gcc_assert (info.range_min);
+ gcc_assert (range_max);
+
+ info.range_size = int_const_binop (MINUS_EXPR, range_max, info.range_min, 0);
+
+ gcc_assert (info.range_size);
+ if (!host_integerp (info.range_size, 1))
+ {
+ info.reason = "index range way too large or otherwise unusable.\n";
+ return false;
+ }
+
+ if ((unsigned HOST_WIDE_INT) tree_low_cst (info.range_size, 1)
+ > ((unsigned) branch_num * SWITCH_CONVERSION_BRANCH_RATIO))
+ {
+ info.reason = "the maximum range-branch ratio exceeded.\n";
+ return false;
+ }
+
+ return true;
+}
+
+/* Checks the given CS switch case whether it is suitable for conversion
+ (whether all but the default basic blocks are empty and so on). If it is,
+ adds the case to the branch list along with values for the defined variables
+ and returns true. Otherwise returns false. */
+
+static bool
+check_process_case (tree cs)
+{
+ tree ldecl;
+ basic_block label_bb, following_bb;
+ edge e;
+
+ ldecl = CASE_LABEL (cs);
+ label_bb = label_to_block (ldecl);
+
+ e = find_edge (info.switch_bb, label_bb);
+ gcc_assert (e);
+
+ if (CASE_LOW (cs) == NULL_TREE)
+ {
+ /* Default branch. */
+ info.default_prob = e->probability;
+ info.default_count = e->count;
+ }
+ else
+ info.other_count += e->count;
+
+ if (!label_bb)
+ {
+ info.reason = " Bad case - cs BB label is NULL\n";
+ return false;
+ }
+
+ if (!single_pred_p (label_bb))
+ {
+ if (info.final_bb && info.final_bb != label_bb)
+ {
+ info.reason = " Bad case - a non-final BB has two predecessors\n";
+ return false; /* sth complex going on in this branch */
+ }
+
+ following_bb = label_bb;
+ }
+ else
+ {
+ if (!empty_block_p (label_bb))
+ {
+ info.reason = " Bad case - a non-final BB not empty\n";
+ return false;
+ }
+
+ e = single_succ_edge (label_bb);
+ following_bb = single_succ (label_bb);
+ }
+
+ if (!info.final_bb)
+ info.final_bb = following_bb;
+ else if (info.final_bb != following_bb)
+ {
+ info.reason = " Bad case - different final BB\n";
+ return false; /* the only successor is not common for all the branches */
+ }
+
+ return true;
+}
+
+/* This function checks whether all required values in phi nodes in final_bb
+ are constants. Required values are those that correspond to a basic block
+ which is a part of the examined switch statement. It returns true if the
+ phi nodes are OK, otherwise false. */
+
+static bool
+check_final_bb (void)
+{
+ tree phi;
+
+ info.phi_count = 0;
+ for (phi = phi_nodes (info.final_bb); phi; phi = PHI_CHAIN (phi))
+ {
+ int i;
+
+ info.phi_count++;
+
+ for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+ {
+ basic_block bb = PHI_ARG_EDGE (phi, i)->src;
+
+ if ((bb == info.switch_bb
+ || (single_pred_p (bb) && single_pred (bb) == info.switch_bb))
+ && !is_gimple_min_invariant (PHI_ARG_ELT (phi, i).def))
+ {
+ info.reason = " Non-invariant value from a case\n";
+ return false; /* non invariant argument */
+ }
+ }
+ }
+
+ return true;
+}
+
+/* The following function allocates default_values, target_{in,out}_names and
+ constructors arrays. The last one is also populated with pointers to
+ vectors that will become constructors of new arrays. */
+
+static void
+create_temp_arrays (void)
+{
+ int i;
+
+ info.default_values = (tree *) xcalloc (info.phi_count, sizeof (tree));
+ info.constructors = (VEC (constructor_elt, gc) **) xcalloc (info.phi_count,
+ sizeof (tree));
+ info.target_inbound_names = (tree *) xcalloc (info.phi_count, sizeof (tree));
+ info.target_outbound_names = (tree *) xcalloc (info.phi_count,
+ sizeof (tree));
+
+ for (i = 0; i < info.phi_count; i++)
+ {
+ info.constructors[i] = VEC_alloc (constructor_elt, gc,
+ tree_low_cst (info.range_size, 1) + 1);
+ }
+}
+
+/* Free the arrays created by create_temp_arrays(). The vectors that are
+ created by that function are not freed here, however, because they have
+ already become constructors and must be preserved. */
+
+static void
+free_temp_arrays (void)
+{
+ free (info.constructors);
+ free (info.default_values);
+ free (info.target_inbound_names);
+ free (info.target_outbound_names);
+}
+
+/* Populate the array of default values in the order of phi nodes.
+ DEFAULT_CASE is the CASE_LABEL_EXPR for the default switch branch. */
+
+static void
+gather_default_values (tree default_case)
+{
+ tree phi;
+ basic_block bb = label_to_block (CASE_LABEL (default_case));
+ edge e;
+ int i;
+
+ gcc_assert (CASE_LOW (default_case) == NULL_TREE);
+
+ if (bb == info.final_bb)
+ e = find_edge (info.switch_bb, bb);
+ else
+ e = single_succ_edge (bb);
+
+ for (phi = phi_nodes (info.final_bb), i = 0; phi; phi = PHI_CHAIN (phi), i++)
+ {
+ tree val = PHI_ARG_DEF_FROM_EDGE (phi, e);
+ gcc_assert (val);
+ info.default_values[i] = val;
+ }
+}
+
+/* The following function populates the vectors in the constructors array with
+ future contents of the static arrays. The vectors are populated in the
+ order of phi nodes. SWTCH is the switch statement being converted. */
+
+static void
+build_constructors (tree swtch)
+{
+ int i;
+ tree cases = SWITCH_LABELS (swtch);
+ tree pos = info.range_min;
+
+ for (i = 0; i < TREE_VEC_LENGTH (cases) - 1; i++)
+ {
+ tree cs = TREE_VEC_ELT (cases, i);
+ basic_block bb = label_to_block (CASE_LABEL (cs));
+ edge e;
+ tree phi, high;
+ int j;
+
+ if (bb == info.final_bb)
+ e = find_edge (info.switch_bb, bb);
+ else
+ e = single_succ_edge (bb);
+ gcc_assert (e);
+
+ while (tree_int_cst_lt (pos, CASE_LOW (cs)))
+ {
+ int k;
+ for (k = 0; k < info.phi_count; k++)
+ {
+ constructor_elt *elt;
+
+ elt = VEC_quick_push (constructor_elt,
+ info.constructors[k], NULL);
+ elt->index = int_const_binop (MINUS_EXPR, pos, info.range_min, 0);
+ elt->value = info.default_values[k];
+ }
+
+ pos = int_const_binop (PLUS_EXPR, pos, integer_one_node, 0);
+ }
+ gcc_assert (tree_int_cst_equal (pos, CASE_LOW (cs)));
+
+ j = 0;
+ if (CASE_HIGH (cs))
+ high = CASE_HIGH (cs);
+ else
+ high = CASE_LOW (cs);
+ for (phi = phi_nodes (info.final_bb); phi; phi = PHI_CHAIN (phi))
+ {
+ tree val = PHI_ARG_DEF_FROM_EDGE (phi, e);
+ pos = CASE_LOW (cs);
+
+ while (!tree_int_cst_lt (high, pos))
+ {
+ constructor_elt *elt;
+
+ elt = VEC_quick_push (constructor_elt,
+ info.constructors[j], NULL);
+ elt->index = int_const_binop (MINUS_EXPR, pos, info.range_min, 0);
+ elt->value = val;
+
+ pos = int_const_binop (PLUS_EXPR, pos, integer_one_node, 0);
+ }
+ j++;
+ }
+ }
+}
+
+/* Create an appropriate array type and declaration and assemble a static array
+ variable. Also create a load statement that initializes the variable in
+ question with a value from the static array. SWTCH is the switch statement
+ being converted, NUM is the index to arrays of constructors, default values
+ and target SSA names for this particular array. ARR_INDEX_TYPE is the type
+ of the index of the new array, PHI is the phi node of the final BB that
+ corresponds to the value that will be loaded from the created array. TIDX
+ is a temporary variable holding the index for loads from the new array. */
+
+static void
+build_one_array (tree swtch, int num, tree arr_index_type, tree phi, tree tidx)
+{
+ tree array_type;
+ tree ctor;
+ tree decl;
+ tree value_type;
+ tree name;
+ tree fetch, load;
+ block_stmt_iterator bsi;
+
+ gcc_assert (info.default_values[num]);
+ value_type = TREE_TYPE (info.default_values[num]);
+ array_type = build_array_type (value_type, arr_index_type);
+
+ ctor = build_constructor (array_type, info.constructors[num]);
+ TREE_CONSTANT (ctor) = true;
+
+ decl = build_decl (VAR_DECL, NULL_TREE, array_type);
+ TREE_STATIC (decl) = 1;
+ DECL_INITIAL (decl) = ctor;
+
+ DECL_NAME (decl) = create_tmp_var_name ("CSWTCH");
+ DECL_ARTIFICIAL (decl) = 1;
+ TREE_CONSTANT (decl) = 1;
+ add_referenced_var (decl);
+ assemble_variable (decl, 0, 0, 0);
+ mark_sym_for_renaming (decl);
+
+ name = make_ssa_name (SSA_NAME_VAR (PHI_RESULT (phi)), NULL_TREE);
+ info.target_inbound_names[num] = name;
+
+ fetch = build4 (ARRAY_REF, value_type, decl, tidx, NULL_TREE,
+ NULL_TREE);
+ load = build2 (GIMPLE_MODIFY_STMT, void_type_node, name, fetch);
+ SSA_NAME_DEF_STMT (name) = load;
+
+ bsi = bsi_for_stmt (swtch);
+ bsi_insert_before (&bsi, load, BSI_SAME_STMT);
+ mark_symbols_for_renaming (load);
+
+ info.arr_ref_last = load;
+
+ return;
+}
+
+/* Builds and initializes static arrays initialized with values gathered from
+ the SWTCH switch statement. Also creates statements that load values from
+ them. */
+
+static void
+build_arrays (tree swtch)
+{
+ tree arr_index_type;
+ tree tidx, sub;
+ block_stmt_iterator bsi;
+ tree phi = phi_nodes (info.final_bb);
+ int i;
+
+ arr_index_type = build_index_type (info.range_size);
+ tidx = make_rename_temp (arr_index_type, "csti");
+ sub = build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr,
+ fold_convert (TREE_TYPE (info.index_expr), info.range_min));
+ sub = build2 (GIMPLE_MODIFY_STMT, void_type_node, tidx, sub);
+
+ bsi = bsi_for_stmt (swtch);
+ bsi_insert_before (&bsi, sub, BSI_SAME_STMT);
+ mark_symbols_for_renaming (sub);
+ info.arr_ref_first = sub;
+
+ for (phi = phi_nodes (info.final_bb), i = 0; phi; phi = PHI_CHAIN (phi), i++)
+ build_one_array (swtch, i, arr_index_type, phi, tidx);
+
+ return;
+}
+
+/* Generates and appropriately inserts loads of default values at the position
+ given by BSI. Returns the last inserted statement. */
+
+static tree
+gen_def_assigns (block_stmt_iterator *bsi)
+{
+ int i;
+ tree assign = NULL_TREE;
+
+ for (i = 0; i < info.phi_count; i++)
+ {
+ tree name = make_ssa_name (SSA_NAME_VAR (info.target_inbound_names[i]),
+ NULL_TREE);
+
+ info.target_outbound_names[i] = name;
+ assign = build2 (GIMPLE_MODIFY_STMT, void_type_node, name,
+ info.default_values[i]);
+ SSA_NAME_DEF_STMT (name) = assign;
+ bsi_insert_before (bsi, assign, BSI_SAME_STMT);
+ find_new_referenced_vars (&assign);
+ mark_symbols_for_renaming (assign);
+ }
+ return assign;
+}
+
+/* Deletes the unused bbs and edges that now contain the switch statement and
+ its empty branch bbs. BBD is the now dead BB containing the original switch
+ statement, FINAL is the last BB of the converted switch statement (in terms
+ of succession). */
+
+static void
+prune_bbs (basic_block bbd, basic_block final)
+{
+ edge_iterator ei;
+ edge e;
+
+ for (ei = ei_start (bbd->succs); (e = ei_safe_edge (ei)); )
+ {
+ basic_block bb;
+ bb = e->dest;
+ remove_edge (e);
+ if (bb != final)
+ delete_basic_block (bb);
+ }
+ delete_basic_block (bbd);
+}
+
+/* Add values to phi nodes in final_bb for the two new edges. E1F is the edge
+ from the basic block loading values from an array and E2F from the basic
+ block loading default values. BBF is the last switch basic block (see the
+ bbf description in the comment below). */
+
+static void
+fix_phi_nodes (edge e1f, edge e2f, basic_block bbf)
+{
+ tree phi;
+ int i;
+
+ for (phi = phi_nodes (bbf), i = 0; phi; phi = PHI_CHAIN (phi), i++)
+ {
+ add_phi_arg (phi, info.target_inbound_names[i], e1f);
+ add_phi_arg (phi, info.target_outbound_names[i], e2f);
+ }
+
+}
+
+/* Creates a check whether the switch expression value actually falls into the
+ range given by all the cases. If it does not, the temporaries are loaded
+ with default values instead. SWTCH is the switch statement being converted.
+
+ bb0 is the bb with the switch statement, however, we'll end it with a
+ condition instead.
+
+ bb1 is the bb to be used when the range check went ok. It is derived from
+ the switch BB
+
+ bb2 is the bb taken when the expression evaluated outside of the range
+ covered by the created arrays. It is populated by loads of default
+ values.
+
+ bbF is a fall through for both bb1 and bb2 and contains exactly what
+ originally followed the switch statement.
+
+ bbD contains the switch statement (in the end). It is unreachable but we
+ still need to strip off its edges.
+*/
+
+static void
+gen_inbound_check (tree swtch)
+{
+ tree label_decl1 = create_artificial_label ();
+ tree label_decl2 = create_artificial_label ();
+ tree label_decl3 = create_artificial_label ();
+ tree label1, label2, label3;
+
+ tree utype = unsigned_type_for (TREE_TYPE (info.index_expr));
+ tree tmp_u;
+ tree cast, cast_assign;
+ tree ulb, minus, minus_assign;
+ tree bound;
+
+ tree if_expr;
+
+ tree last_assign;
+ block_stmt_iterator bsi;
+ basic_block bb0, bb1, bb2, bbf, bbd;
+ edge e01, e02, e21, e1d, e1f, e2f;
+
+ gcc_assert (info.default_values);
+ bb0 = bb_for_stmt (swtch);
+
+ /* (end of) block 0 */
+ bsi = bsi_for_stmt (info.arr_ref_first);
+ tmp_u = make_rename_temp (utype, "csui");
+
+ cast = build1 (NOP_EXPR, utype, info.index_expr);
+ cast_assign = build2 (GIMPLE_MODIFY_STMT, void_type_node, tmp_u, cast);
+ find_new_referenced_vars (&cast_assign);
+ bsi_insert_before (&bsi, cast_assign, BSI_SAME_STMT);
+ mark_symbols_for_renaming (cast_assign);
+
+ ulb = fold_convert (utype, info.range_min);
+ minus = build2 (MINUS_EXPR, utype, tmp_u, ulb);
+ minus_assign = build2 (GIMPLE_MODIFY_STMT, void_type_node, tmp_u, minus);
+ find_new_referenced_vars (&minus_assign);
+ bsi_insert_before (&bsi, minus_assign, BSI_SAME_STMT);
+ mark_symbols_for_renaming (minus_assign);
+
+ bound = fold_convert (utype, info.range_size);
+
+ if_expr = build3 (COND_EXPR, void_type_node,
+ build2 (LE_EXPR, boolean_type_node, tmp_u, bound),
+ NULL_TREE, NULL_TREE);
+
+ find_new_referenced_vars (&if_expr);
+ bsi_insert_before (&bsi, if_expr, BSI_SAME_STMT);
+ mark_symbols_for_renaming (if_expr);
+
+ /* block 2 */
+ bsi = bsi_for_stmt (info.arr_ref_first);
+ label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
+ bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
+ last_assign = gen_def_assigns (&bsi);
+
+ /* block 1 */
+ bsi = bsi_for_stmt (info.arr_ref_first);
+ label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
+ bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
+
+ /* block F */
+ bsi = bsi_start (info.final_bb);
+ label3 = build1 (LABEL_EXPR, void_type_node, label_decl3);
+ bsi_insert_before (&bsi, label3, BSI_SAME_STMT);
+
+ /* cfg fix */
+ e02 = split_block (bb0, if_expr);
+ bb2 = e02->dest;
+
+ e21 = split_block (bb2, last_assign);
+ bb1 = e21->dest;
+ remove_edge (e21);
+
+ e1d = split_block (bb1, info.arr_ref_last);
+ bbd = e1d->dest;
+ remove_edge (e1d);
+
+ /* flags and profiles of the edge for in-range values */
+ e01 = make_edge (bb0, bb1, EDGE_TRUE_VALUE);
+ e01->probability = REG_BR_PROB_BASE - info.default_prob;
+ e01->count = info.other_count;
+
+ /* flags and profiles of the edge taking care of out-of-range values */
+ e02->flags &= ~EDGE_FALLTHRU;
+ e02->flags |= EDGE_FALSE_VALUE;
+ e02->probability = info.default_prob;
+ e02->count = info.default_count;
+
+ bbf = info.final_bb;
+
+ e1f = make_edge (bb1, bbf, EDGE_FALLTHRU);
+ e1f->probability = REG_BR_PROB_BASE;
+ e1f->count = info.other_count;
+
+ e2f = make_edge (bb2, bbf, EDGE_FALLTHRU);
+ e2f->probability = REG_BR_PROB_BASE;
+ e2f->count = info.default_count;
+
+ /* frequencies of the new BBs */
+ bb1->frequency = EDGE_FREQUENCY (e01);
+ bb2->frequency = EDGE_FREQUENCY (e02);
+ bbf->frequency = EDGE_FREQUENCY (e1f) + EDGE_FREQUENCY (e2f);
+
+ prune_bbs (bbd, info.final_bb); /* to keep calc_dfs_tree() in dominance.c
+ happy */
+
+ fix_phi_nodes (e1f, e2f, bbf);
+
+ free_dominance_info (CDI_DOMINATORS);
+ free_dominance_info (CDI_POST_DOMINATORS);
+}
+
+/* The following function is invoked on every switch statement (the current one
+ is given in SWTCH) and runs the individual phases of switch conversion on it
+ one after another until one fails or the conversion is completed. */
+
+static bool
+process_switch (tree swtch)
+{
+ int i;
+ tree cases;
+ tree index_type;
+
+ /* Operand 2 is either NULL_TREE or a vector of cases (stmt.c). */
+ if (TREE_OPERAND (swtch, 2) == NULL_TREE)
+ {
+ info.reason = "swtch has no labels\n";
+ return false;
+ }
+
+ /* Comment from stmt.c:
+ The switch body is lowered in gimplify.c, we should never have switches
+ with a non-NULL SWITCH_BODY here. */
+ gcc_assert (!SWITCH_BODY (swtch));
+
+ cases = SWITCH_LABELS (swtch);
+ info.final_bb = NULL;
+ info.switch_bb = bb_for_stmt (swtch);
+ info.index_expr = SWITCH_COND (swtch);
+ index_type = TREE_TYPE (info.index_expr);
+ info.arr_ref_first = NULL_TREE;
+ info.arr_ref_last = NULL_TREE;
+ info.default_prob = 0;
+ info.default_count = 0;
+ info.other_count = 0;
+
+ /* An ERROR_MARK occurs for various reasons including invalid data type.
+ (comment from stmt.c) */
+ if (index_type == error_mark_node)
+ {
+ info.reason = "index error.\n";
+ return false;
+ }
+
+ /* Check the case label values are within reasonable range: */
+ if (!check_range (swtch))
+ return false;
+
+ /* For all the cases, see whether they are empty, the assignments they
+ represent constant and so on... */
+ for (i = 0; i < TREE_VEC_LENGTH (cases); i++)
+ {
+ tree part_case = TREE_VEC_ELT (cases, i);
+ if (!check_process_case (part_case))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Processing of case %i failed\n", i);
+ return false;
+ }
+ }
+
+ if (!check_final_bb ())
+ return false;
+
+ /* At this point all checks have passed and we can proceed with the
+ transformation. */
+
+ create_temp_arrays ();
+ gather_default_values (TREE_VEC_ELT (cases, TREE_VEC_LENGTH (cases) - 1));
+ build_constructors (swtch);
+
+ build_arrays (swtch); /* Build the static arrays and assignments. */
+ gen_inbound_check (swtch); /* Build the bounds check. */
+
+ /* Cleanup: */
+ free_temp_arrays ();
+ return true;
+}
+
+/* The main function of the pass scans statements for switches and invokes
+ process_switch on them. */
+
+static unsigned int
+do_switchconv (void)
+{
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ {
+ tree stmt = last_stmt (bb);
+ if (stmt && TREE_CODE (stmt) == SWITCH_EXPR)
+ {
+ expanded_location loc = expand_location (EXPR_LOCATION (stmt));
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "beginning to process the following "
+ "SWITCH statement (%s:%d) : ------- \n",
+ loc.file, loc.line);
+ print_generic_stmt (dump_file, stmt, 2);
+ fprintf (dump_file, "\n");
+ }
+
+ info.reason = NULL;
+ if (process_switch (stmt))
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "Switch converted\n");
+ fprintf (dump_file, "--------------------------------\n");
+ }
+ }
+ else
+ {
+ if (dump_file)
+ {
+ gcc_assert (info.reason);
+ fprintf (dump_file, "Bailing out - ");
+ fprintf (dump_file, info.reason);
+ fprintf (dump_file, "--------------------------------\n");
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* The pass gate. */
+
+static bool
+switchconv_gate (void)
+{
+ return flag_tree_switch_conversion != 0;
+}
+
+struct gimple_opt_pass pass_convert_switch =
+{
+ {
+ GIMPLE_PASS,
+ "switchconv", /* name */
+ switchconv_gate, /* gate */
+ do_switchconv, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_SWITCH_CONVERSION, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_update_ssa | TODO_dump_func
+ | TODO_ggc_collect | TODO_verify_ssa /* todo_flags_finish */
+ }
+};
diff --git a/gcc/tree.c b/gcc/tree.c
index d9e4e7f18db..a8f66dbb895 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1827,6 +1827,26 @@ tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL)
return node;
}
+/* Return the elements of a CONSTRUCTOR as a TREE_LIST. */
+
+tree
+ctor_to_list (tree ctor)
+{
+ tree list = NULL_TREE;
+ tree *p = &list;
+ unsigned ix;
+ constructor_elt *ce;
+
+ for (ix = 0;
+ VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (ctor), ix, ce);
+ ++ix)
+ {
+ *p = build_tree_list (ce->index, ce->value);
+ p = &TREE_CHAIN (*p);
+ }
+
+ return list;
+}
/* Return the size nominally occupied by an object of type TYPE
when it resides in memory. The value is measured in units of bytes,
diff --git a/gcc/tree.h b/gcc/tree.h
index c00ad54cf05..e6b9f9cf65e 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1586,6 +1586,9 @@ struct tree_vec GTY(())
/* In a CONSTRUCTOR node. */
#define CONSTRUCTOR_ELTS(NODE) (CONSTRUCTOR_CHECK (NODE)->constructor.elts)
+#define CONSTRUCTOR_ELT(NODE,IDX) \
+ (VEC_index (constructor_elt, CONSTRUCTOR_ELTS (NODE), IDX))
+#define CONSTRUCTOR_NELTS(NODE) (VEC_length (constructor_elt, CONSTRUCTOR_ELTS (NODE)))
/* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding the
value of each element (stored within VAL). IX must be a scratch variable
@@ -4475,6 +4478,10 @@ extern int fields_length (const_tree);
extern bool initializer_zerop (const_tree);
+/* Given a CONSTRUCTOR CTOR, return the elements as a TREE_LIST. */
+
+extern tree ctor_to_list (tree);
+
/* Examine CTOR to discover:
* how many scalar fields are set to nonzero values,
and place it in *P_NZ_ELTS;
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 751e44cc0d4..6699f52e91c 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -715,7 +715,7 @@ write_modbeg (int dosizeonly)
int totsize = 0;
/* Assumes primary filename has Unix syntax file spec. */
- module_name = xstrdup (basename ((char *) primary_filename));
+ module_name = xstrdup (lbasename (primary_filename));
m = strrchr (module_name, '.');
if (m)
@@ -1510,9 +1510,8 @@ lookup_filename (const char *file_name)
{
file_info_table_allocated += FILE_TABLE_INCREMENT;
- file_info_table = xrealloc (file_info_table,
- (file_info_table_allocated
- * sizeof (dst_file_info_entry)));
+ file_info_table = XRESIZEVEC (dst_file_info_entry, file_info_table,
+ file_info_table_allocated);
}
/* Add the new entry to the end of the filename table. */
@@ -1549,9 +1548,8 @@ vmsdbgout_source_line (register unsigned line, register const char *filename)
if (line_info_table_in_use == line_info_table_allocated)
{
line_info_table_allocated += LINE_INFO_TABLE_INCREMENT;
- line_info_table = xrealloc (line_info_table,
- (line_info_table_allocated
- * sizeof (dst_line_info_entry)));
+ line_info_table = XRESIZEVEC (dst_line_info_entry, line_info_table,
+ line_info_table_allocated);
}
/* Add the new entry at the end of the line_info_table. */
@@ -1600,8 +1598,7 @@ vmsdbgout_init (const char *main_input_filename)
primary_filename = main_input_filename;
/* Allocate the initial hunk of the file_info_table. */
- file_info_table
- = xcalloc (FILE_TABLE_INCREMENT, sizeof (dst_file_info_entry));
+ file_info_table = XCNEWVEC (dst_file_info_entry, FILE_TABLE_INCREMENT);
file_info_table_allocated = FILE_TABLE_INCREMENT;
/* Skip the first entry - file numbers begin at 1 */
@@ -1612,8 +1609,7 @@ vmsdbgout_init (const char *main_input_filename)
func_table_in_use = 1;
/* Allocate the initial hunk of the line_info_table. */
- line_info_table
- = xcalloc (LINE_INFO_TABLE_INCREMENT, sizeof (dst_line_info_entry));
+ line_info_table = XCNEWVEC (dst_line_info_entry, LINE_INFO_TABLE_INCREMENT);
line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
/* zero-th entry is allocated, but unused */
line_info_table_in_use = 1;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 0bcffffc56a..6779c0f7732 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,52 @@
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR boostrap/36702
+ * config.host: Only include 32bit t-fprules-softfp for Darwin/x86
+ and Linux/x86. Include 64bit t-softfp-compat for Linux/x86.
+
+ * config/i386/64/t-fprules-softfp: Moved to ...
+ * config/i386/64/t-softfp-compat: This. New.
+
+2008-07-02 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/32/sfp-machine.h (FP_HANDLE_EXCEPTIONS) [FP_EX_INVALID]:
+ Initialize f with 0.0.
+
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/36669
+ * shared-object.mk ($(base)_s$(objext)): Add -DSHARED.
+
+ * config/i386/64/_divtc3-compat.c: New.
+ * config/i386/64/_multc3-compat.c: Likewise.
+ * config/i386/64/_powitf2-compat.c: Likewise.
+ * config/i386/64/eqtf2.c: Likewise.
+ * config/i386/64/getf2.c: Likewise.
+ * config/i386/64/letf2.c: Likewise.
+ * config/i386/64/t-fprules-softfp: Likewise.
+
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.host: Add i386/${host_address}/t-fprules-softfp to
+ tmake_file for i[34567]86-*-darwin*, x86_64-*-darwin*,
+ i[34567]86-*-linux*, x86_64-*-linux*.
+
+ * configure.ac: Set host_address to 64 or 32 for x86.
+ * configure: Regenerated.
+
+ * Makefile.in (config.status): Also depend on
+ $(srcdir)/config.host.
+
+ * config/i386/32/t-fprules-softfp: New.
+ * config/i386/32/tf-signs.c: Likewise.
+
+ * config/i386/64/sfp-machine.h: New. Moved from gcc.
+
+2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/32/sfp-machine.h: New.
+
2008-06-26 Nathan Froyd <froydnj@codesourcery.com>
* config/rs6000/t-ppccomm: Remove rules that conflict with
@@ -73,8 +122,8 @@
Paolo Bonzini <bonzini@gnu.org>
PR target/30572
- * Makefile.in: Use @shlib_slibdir@ substitution to get correct install name
- on darwin.
+ * Makefile.in: Use @shlib_slibdir@ substitution to get
+ correct install name on darwin.
* config/t-slibgcc-darwin: Use @shlib_slibdir@ for -install_name.
2007-12-15 Hans-Peter Nilsson <hp@axis.com>
@@ -178,7 +227,7 @@
* config/i386/t-crtpc: New file.
* config.host (i[34567]86-*-linux*): Add i386/t-crtpc to tm-file.
- (x86_64-*-linux*): Ditto.
+ (x86_64-*-linux*): Ditto.
2007-02-30 Kai Tietz <kai.tietz@onevision.com>
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 94b6440f011..369c7fecb58 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -138,7 +138,7 @@ config.h: stamp-h ; @true
stamp-h: $(srcdir)/config.in config.status Makefile
CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
-config.status: $(srcdir)/configure
+config.status: $(srcdir)/configure $(srcdir)/config.host
$(SHELL) ./config.status --recheck
include $(gcc_objdir)/libgcc.mvars
diff --git a/libgcc/config.host b/libgcc/config.host
index da652de0ed8..93d1dbfacbb 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -578,3 +578,21 @@ i[34567]86-*-linux* | x86_64-*-linux*)
tmake_file="${tmake_file} t-tls"
;;
esac
+
+case ${host} in
+i[34567]86-*-darwin* | x86_64-*-darwin* | \
+ i[34567]86-*-linux* | x86_64-*-linux*)
+ if test "${host_address}" = 32; then
+ tmake_file="${tmake_file} i386/${host_address}/t-fprules-softfp"
+ fi
+ ;;
+esac
+
+case ${host} in
+i[34567]86-*-linux* | x86_64-*-linux*)
+ # Provide backward binary compatibility for 64bit Linux/x86.
+ if test "${host_address}" = 64; then
+ tmake_file="${tmake_file} i386/${host_address}/t-softfp-compat"
+ fi
+ ;;
+esac
diff --git a/libgcc/config/i386/32/sfp-machine.h b/libgcc/config/i386/32/sfp-machine.h
new file mode 100644
index 00000000000..a872546d966
--- /dev/null
+++ b/libgcc/config/i386/32/sfp-machine.h
@@ -0,0 +1,217 @@
+#define _FP_W_TYPE_SIZE 32
+#define _FP_W_TYPE unsigned int
+#define _FP_WS_TYPE signed int
+#define _FP_I_TYPE int
+
+/* The type of the result of a floating point comparison. This must
+ match `__libgcc_cmp_return__' in GCC for the target. */
+typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
+#define CMPtype __gcc_CMPtype
+
+#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
+ __asm__ ("add{l} {%11,%3|%3,%11}\n\t" \
+ "adc{l} {%9,%2|%2,%9}\n\t" \
+ "adc{l} {%7,%1|%1,%7}\n\t" \
+ "adc{l} {%5,%0|%0,%5}" \
+ : "=r" ((USItype) (r3)), \
+ "=&r" ((USItype) (r2)), \
+ "=&r" ((USItype) (r1)), \
+ "=&r" ((USItype) (r0)) \
+ : "%0" ((USItype) (x3)), \
+ "g" ((USItype) (y3)), \
+ "%1" ((USItype) (x2)), \
+ "g" ((USItype) (y2)), \
+ "%2" ((USItype) (x1)), \
+ "g" ((USItype) (y1)), \
+ "%3" ((USItype) (x0)), \
+ "g" ((USItype) (y0)))
+
+#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
+ __asm__ ("add{l} {%8,%2|%2,%8}\n\t" \
+ "adc{l} {%6,%1|%1,%6}\n\t" \
+ "adc{l} {%4,%0|%0,%4}" \
+ : "=r" ((USItype) (r2)), \
+ "=&r" ((USItype) (r1)), \
+ "=&r" ((USItype) (r0)) \
+ : "%0" ((USItype) (x2)), \
+ "g" ((USItype) (y2)), \
+ "%1" ((USItype) (x1)), \
+ "g" ((USItype) (y1)), \
+ "%2" ((USItype) (x0)), \
+ "g" ((USItype) (y0)))
+
+/* FIXME: The last constraint should be "g" instead of "im" if reload
+ works properly. */
+#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
+ __asm__ ("sub{l} {%11,%3|%3,%11}\n\t" \
+ "sbb{l} {%9,%2|%2,%9}\n\t" \
+ "sbb{l} {%7,%1|%1,%7}\n\t" \
+ "sbb{l} {%5,%0|%0,%5}" \
+ : "=r" ((USItype) (r3)), \
+ "=&r" ((USItype) (r2)), \
+ "=&r" ((USItype) (r1)), \
+ "=&r" ((USItype) (r0)) \
+ : "0" ((USItype) (x3)), \
+ "g" ((USItype) (y3)), \
+ "1" ((USItype) (x2)), \
+ "g" ((USItype) (y2)), \
+ "2" ((USItype) (x1)), \
+ "g" ((USItype) (y1)), \
+ "3" ((USItype) (x0)), \
+ "im" ((USItype) (y0)))
+
+#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
+ __asm__ ("sub{l} {%8,%2|%2,%8}\n\t" \
+ "sbb{l} {%6,%1|%1,%6}\n\t" \
+ "sbb{l} {%4,%0|%0,%4}" \
+ : "=r" ((USItype) (r2)), \
+ "=&r" ((USItype) (r1)), \
+ "=&r" ((USItype) (r0)) \
+ : "0" ((USItype) (x2)), \
+ "g" ((USItype) (y2)), \
+ "1" ((USItype) (x1)), \
+ "g" ((USItype) (y1)), \
+ "2" ((USItype) (x0)), \
+ "g" ((USItype) (y0)))
+
+
+#define _FP_MUL_MEAT_S(R,X,Y) \
+ _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_D(R,X,Y) \
+ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
+#define _FP_MUL_MEAT_Q(R,X,Y) \
+ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
+#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
+
+#define _FP_NANFRAC_S _FP_QNANBIT_S
+#define _FP_NANFRAC_D _FP_QNANBIT_D, 0
+/* Even if XFmode is 12byte, we have to pad it to 16byte since soft-fp
+ emulation is done in 16byte. */
+#define _FP_NANFRAC_E _FP_QNANBIT_E, 0, 0, 0
+#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0
+#define _FP_NANSIGN_S 1
+#define _FP_NANSIGN_D 1
+#define _FP_NANSIGN_E 1
+#define _FP_NANSIGN_Q 1
+
+#define _FP_KEEPNANFRACP 1
+
+/* Here is something Intel misdesigned: the specs don't define
+ the case where we have two NaNs with same mantissas, but
+ different sign. Different operations pick up different NaNs. */
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+ do { \
+ if (_FP_FRAC_GT_##wc(X, Y) \
+ || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc(R,X); \
+ } \
+ else \
+ { \
+ R##_s = Y##_s; \
+ _FP_FRAC_COPY_##wc(R,Y); \
+ } \
+ R##_c = FP_CLS_NAN; \
+ } while (0)
+
+#define FP_EX_INVALID 0x01
+#define FP_EX_DENORM 0x02
+#define FP_EX_DIVZERO 0x04
+#define FP_EX_OVERFLOW 0x08
+#define FP_EX_UNDERFLOW 0x10
+#define FP_EX_INEXACT 0x20
+
+struct fenv
+{
+ unsigned short int __control_word;
+ unsigned short int __unused1;
+ unsigned short int __status_word;
+ unsigned short int __unused2;
+ unsigned short int __tags;
+ unsigned short int __unused3;
+ unsigned int __eip;
+ unsigned short int __cs_selector;
+ unsigned int __opcode:11;
+ unsigned int __unused4:5;
+ unsigned int __data_offset;
+ unsigned short int __data_selector;
+ unsigned short int __unused5;
+};
+
+#define FP_HANDLE_EXCEPTIONS \
+ do { \
+ if (_fex & FP_EX_INVALID) \
+ { \
+ float f = 0.0; \
+ __asm__ __volatile__ ("fdiv %0" : "+t" (f)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ if (_fex & FP_EX_DIVZERO) \
+ { \
+ float f = 1.0, g = 0.0; \
+ __asm__ __volatile__ ("fdivp" : "=t" (f) \
+ : "0" (f), "u" (g) \
+ : "st(1)"); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ if (_fex & FP_EX_OVERFLOW) \
+ { \
+ struct fenv temp; \
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
+ temp.__status_word |= FP_EX_OVERFLOW; \
+ __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ if (_fex & FP_EX_UNDERFLOW) \
+ { \
+ struct fenv temp; \
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
+ temp.__status_word |= FP_EX_UNDERFLOW; \
+ __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ if (_fex & FP_EX_INEXACT) \
+ { \
+ struct fenv temp; \
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
+ temp.__status_word |= FP_EX_INEXACT; \
+ __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ } while (0)
+
+#define FP_RND_NEAREST 0
+#define FP_RND_ZERO 0xc00
+#define FP_RND_PINF 0x800
+#define FP_RND_MINF 0x400
+
+#define _FP_DECL_EX \
+ unsigned short _fcw __attribute__ ((unused)) = FP_RND_NEAREST
+
+#define FP_INIT_ROUNDMODE \
+ do { \
+ __asm__ ("fnstcw %0" : "=m" (_fcw)); \
+ } while (0)
+
+#define FP_ROUNDMODE (_fcw & 0xc00)
+
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
+
+/* Define ALIASNAME as a strong alias for NAME. */
+#if defined __MACH__
+/* Mach-O doesn't support aliasing. If these functions ever return
+ anything but CMPtype we need to revisit this... */
+#define strong_alias(name, aliasname) \
+ CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
+#else
+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+# define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#endif
diff --git a/libgcc/config/i386/32/t-fprules-softfp b/libgcc/config/i386/32/t-fprules-softfp
new file mode 100644
index 00000000000..8e7f3233b71
--- /dev/null
+++ b/libgcc/config/i386/32/t-fprules-softfp
@@ -0,0 +1,8 @@
+# Filter out TImode functions
+tifunctions = fixtfti.c fixunstfti.c floattitf.c floatuntitf.c
+tifunctions := $(addprefix $(gcc_srcdir)/config/soft-fp/, $(tifunctions))
+
+LIB2ADD := $(filter-out $(tifunctions), $(LIB2ADD))
+
+# Provide fallbacks for __builtin_copysignq and __builtin_fabsq.
+LIB2ADD += $(srcdir)/config/i386/32/tf-signs.c
diff --git a/libgcc/config/i386/32/tf-signs.c b/libgcc/config/i386/32/tf-signs.c
new file mode 100644
index 00000000000..1b19b601269
--- /dev/null
+++ b/libgcc/config/i386/32/tf-signs.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+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 COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+union _FP_UNION_Q
+{
+ __float128 flt;
+ struct
+ {
+ unsigned long frac0 : 32;
+ unsigned long frac1 : 32;
+ unsigned long frac2 : 32;
+ unsigned long frac3 : 16;
+ unsigned exp : 15;
+ unsigned sign : 1;
+ } bits __attribute__((packed));
+};
+
+__float128
+__copysigntf3 (__float128 a, __float128 b)
+{
+ union _FP_UNION_Q A, B;
+
+ A.flt = a;
+ B.flt = b;
+ A.bits.sign = B.bits.sign;
+
+ return A.flt;
+}
+
+__float128
+__fabstf2 (__float128 a)
+{
+ union _FP_UNION_Q A;
+
+ A.flt = a;
+ A.bits.sign = 0;
+
+ return A.flt;
+}
diff --git a/libgcc/config/i386/64/_divtc3-compat.c b/libgcc/config/i386/64/_divtc3-compat.c
new file mode 100644
index 00000000000..57ee350b7cd
--- /dev/null
+++ b/libgcc/config/i386/64/_divtc3-compat.c
@@ -0,0 +1,14 @@
+#ifdef SHARED
+#define __divtc3 __divtc3_shared
+#endif
+
+#define L_divtc3
+#include "libgcc2.c"
+
+#ifdef SHARED
+#undef __divtc3
+extern __typeof__ (__divtc3_shared) __divtc3_compat __attribute__((alias ("__divtc3_shared")));
+
+asm (".symver __divtc3_compat,__divtc3@GCC_4.0.0");
+asm (".symver __divtc3_shared,__divtc3@@GCC_4.3.0");
+#endif
diff --git a/libgcc/config/i386/64/_multc3-compat.c b/libgcc/config/i386/64/_multc3-compat.c
new file mode 100644
index 00000000000..49141a9384f
--- /dev/null
+++ b/libgcc/config/i386/64/_multc3-compat.c
@@ -0,0 +1,14 @@
+#ifdef SHARED
+#define __multc3 __multc3_shared
+#endif
+
+#define L_multc3
+#include "libgcc2.c"
+
+#ifdef SHARED
+#undef __multc3
+extern __typeof__ (__multc3_shared) __multc3_compat __attribute__((alias ("__multc3_shared")));
+
+asm (".symver __multc3_compat,__multc3@GCC_4.0.0");
+asm (".symver __multc3_shared,__multc3@@GCC_4.3.0");
+#endif
diff --git a/libgcc/config/i386/64/_powitf2-compat.c b/libgcc/config/i386/64/_powitf2-compat.c
new file mode 100644
index 00000000000..3bc3c904de7
--- /dev/null
+++ b/libgcc/config/i386/64/_powitf2-compat.c
@@ -0,0 +1,14 @@
+#ifdef SHARED
+#define __powitf2 __powitf2_shared
+#endif
+
+#define L_powitf2
+#include "libgcc2.c"
+
+#ifdef SHARED
+#undef __powitf2
+extern __typeof__ (__powitf2_shared) __powitf2_compat __attribute__((alias ("__powitf2_shared")));
+
+asm (".symver __powitf2_compat,__powitf2@GCC_4.0.0");
+asm (".symver __powitf2_shared,__powitf2@@GCC_4.3.0");
+#endif
diff --git a/libgcc/config/i386/64/eqtf2.c b/libgcc/config/i386/64/eqtf2.c
new file mode 100644
index 00000000000..d9baba689be
--- /dev/null
+++ b/libgcc/config/i386/64/eqtf2.c
@@ -0,0 +1,13 @@
+#ifdef SHARED
+#define __netf2 __netf2_shared
+#endif
+
+#include "config/soft-fp/eqtf2.c"
+
+#ifdef SHARED
+#undef __netf2
+strong_alias (__netf2_shared, __netf2_compat);
+
+asm (".symver __netf2_compat,__netf2@GCC_3.0");
+asm (".symver __netf2_shared,__netf2@@GCC_4.3.0");
+#endif
diff --git a/libgcc/config/i386/64/getf2.c b/libgcc/config/i386/64/getf2.c
new file mode 100644
index 00000000000..30885cc0caf
--- /dev/null
+++ b/libgcc/config/i386/64/getf2.c
@@ -0,0 +1,13 @@
+#ifdef SHARED
+#define __gttf2 __gttf2_shared
+#endif
+
+#include "config/soft-fp/getf2.c"
+
+#ifdef SHARED
+#undef __gttf2
+strong_alias (__gttf2_shared, __gttf2_compat);
+
+asm (".symver __gttf2_compat,__gttf2@GCC_3.0");
+asm (".symver __gttf2_shared,__gttf2@@GCC_4.3.0");
+#endif
diff --git a/libgcc/config/i386/64/letf2.c b/libgcc/config/i386/64/letf2.c
new file mode 100644
index 00000000000..231f981c84c
--- /dev/null
+++ b/libgcc/config/i386/64/letf2.c
@@ -0,0 +1,13 @@
+#ifdef SHARED
+#define __lttf2 __lttf2_shared
+#endif
+
+#include "config/soft-fp/letf2.c"
+
+#ifdef SHARED
+#undef __lttf2
+strong_alias (__lttf2_shared, __lttf2_compat);
+
+asm (".symver __lttf2_compat,__lttf2@GCC_3.0");
+asm (".symver __lttf2_shared,__lttf2@@GCC_4.3.0");
+#endif
diff --git a/libgcc/config/i386/64/sfp-machine.h b/libgcc/config/i386/64/sfp-machine.h
new file mode 100644
index 00000000000..190e3cb0e81
--- /dev/null
+++ b/libgcc/config/i386/64/sfp-machine.h
@@ -0,0 +1,143 @@
+#define _FP_W_TYPE_SIZE 64
+#define _FP_W_TYPE unsigned long
+#define _FP_WS_TYPE signed long
+#define _FP_I_TYPE long
+
+typedef int TItype __attribute__ ((mode (TI)));
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+
+#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
+
+/* The type of the result of a floating point comparison. This must
+ match `__libgcc_cmp_return__' in GCC for the target. */
+typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
+#define CMPtype __gcc_CMPtype
+
+#define _FP_MUL_MEAT_Q(R,X,Y) \
+ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
+
+#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
+
+#define _FP_NANFRAC_S _FP_QNANBIT_S
+#define _FP_NANFRAC_D _FP_QNANBIT_D
+#define _FP_NANFRAC_E _FP_QNANBIT_E, 0
+#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0
+#define _FP_NANSIGN_S 1
+#define _FP_NANSIGN_D 1
+#define _FP_NANSIGN_E 1
+#define _FP_NANSIGN_Q 1
+
+#define _FP_KEEPNANFRACP 1
+
+/* Here is something Intel misdesigned: the specs don't define
+ the case where we have two NaNs with same mantissas, but
+ different sign. Different operations pick up different NaNs. */
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+ do { \
+ if (_FP_FRAC_GT_##wc(X, Y) \
+ || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc(R,X); \
+ } \
+ else \
+ { \
+ R##_s = Y##_s; \
+ _FP_FRAC_COPY_##wc(R,Y); \
+ } \
+ R##_c = FP_CLS_NAN; \
+ } while (0)
+
+#define FP_EX_INVALID 0x01
+#define FP_EX_DENORM 0x02
+#define FP_EX_DIVZERO 0x04
+#define FP_EX_OVERFLOW 0x08
+#define FP_EX_UNDERFLOW 0x10
+#define FP_EX_INEXACT 0x20
+
+struct fenv
+{
+ unsigned short int __control_word;
+ unsigned short int __unused1;
+ unsigned short int __status_word;
+ unsigned short int __unused2;
+ unsigned short int __tags;
+ unsigned short int __unused3;
+ unsigned int __eip;
+ unsigned short int __cs_selector;
+ unsigned int __opcode:11;
+ unsigned int __unused4:5;
+ unsigned int __data_offset;
+ unsigned short int __data_selector;
+ unsigned short int __unused5;
+};
+
+#define FP_HANDLE_EXCEPTIONS \
+ do { \
+ if (_fex & FP_EX_INVALID) \
+ { \
+ float f = 0.0; \
+ __asm__ __volatile__ ("divss %0, %0 " : : "x" (f)); \
+ } \
+ if (_fex & FP_EX_DIVZERO) \
+ { \
+ float f = 1.0, g = 0.0; \
+ __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g)); \
+ } \
+ if (_fex & FP_EX_OVERFLOW) \
+ { \
+ struct fenv temp; \
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
+ temp.__status_word |= FP_EX_OVERFLOW; \
+ __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ if (_fex & FP_EX_UNDERFLOW) \
+ { \
+ struct fenv temp; \
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
+ temp.__status_word |= FP_EX_UNDERFLOW; \
+ __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ if (_fex & FP_EX_INEXACT) \
+ { \
+ struct fenv temp; \
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (temp)); \
+ temp.__status_word |= FP_EX_INEXACT; \
+ __asm__ __volatile__ ("fldenv %0" : : "m" (temp)); \
+ __asm__ __volatile__ ("fwait"); \
+ } \
+ } while (0)
+
+#define FP_RND_NEAREST 0
+#define FP_RND_ZERO 0xc00
+#define FP_RND_PINF 0x800
+#define FP_RND_MINF 0x400
+
+#define _FP_DECL_EX \
+ unsigned short _fcw __attribute__ ((unused)) = FP_RND_NEAREST
+
+#define FP_INIT_ROUNDMODE \
+ do { \
+ __asm__ ("fnstcw %0" : "=m" (_fcw)); \
+ } while (0)
+
+#define FP_ROUNDMODE (_fcw & 0xc00)
+
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
+
+/* Define ALIASNAME as a strong alias for NAME. */
+#if defined __MACH__
+/* Mach-O doesn't support aliasing. If these functions ever return
+ anything but CMPtype we need to revisit this... */
+#define strong_alias(name, aliasname) \
+ CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
+#else
+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+# define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#endif
diff --git a/libgcc/config/i386/64/t-softfp-compat b/libgcc/config/i386/64/t-softfp-compat
new file mode 100644
index 00000000000..e8cda296cbd
--- /dev/null
+++ b/libgcc/config/i386/64/t-softfp-compat
@@ -0,0 +1,12 @@
+# Filter out the following TImode functions and provide backward binary
+# compatibility.
+tf-compats = getf2.c letf2.c eqtf2.c
+tf-functions := $(addprefix $(gcc_srcdir)/config/soft-fp/, $(tf-compats))
+LIB2ADD := $(filter-out $(tf-functions), $(LIB2ADD))
+LIB2ADD += $(addprefix $(srcdir)/config/i386/64/, $(tf-compats))
+
+# Replace _divtc3, _multc3 and _powitf2.
+libgcc2-tf-functions = _divtc3 _multc3 _powitf2
+LIB2FUNCS_EXCLUDE += $(libgcc2-tf-functions)
+libgcc2-tf-compats = $(addsuffix -compat.c, $(libgcc2-tf-functions))
+LIB2ADD += $(addprefix $(srcdir)/config/i386/64/, $(libgcc2-tf-compats))
diff --git a/libgcc/configure b/libgcc/configure
index 80cbebbb426..75bf9034b1a 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -3402,6 +3402,21 @@ echo "${ECHO_T}$libgcc_cv_fixed_point" >&6
fixed_point=$libgcc_cv_fixed_point
+# Check 32bit or 64bit for x86.
+case ${host} in
+i?86*-*-* | x86_64*-*-*)
+ cat > conftest.c <<EOF
+#ifdef __x86_64__
+host_address=64
+#else
+host_address=32
+#endif
+EOF
+ eval `${CC-cc} -E conftest.c | grep host_address=`
+ rm -f conftest.c
+ ;;
+esac
+
# Collect host-machine-specific information.
. ${srcdir}/config.host
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index e3eb80a2148..1238d742450 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -153,6 +153,21 @@ AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point],
fixed_point=$libgcc_cv_fixed_point
AC_SUBST(fixed_point)
+# Check 32bit or 64bit for x86.
+case ${host} in
+i?86*-*-* | x86_64*-*-*)
+ cat > conftest.c <<EOF
+#ifdef __x86_64__
+host_address=64
+#else
+host_address=32
+#endif
+EOF
+ eval `${CC-cc} -E conftest.c | grep host_address=`
+ rm -f conftest.c
+ ;;
+esac
+
# Collect host-machine-specific information.
. ${srcdir}/config.host
diff --git a/libgcc/shared-object.mk b/libgcc/shared-object.mk
index 65171b6aa32..5c0abb32624 100644
--- a/libgcc/shared-object.mk
+++ b/libgcc/shared-object.mk
@@ -12,7 +12,7 @@ $(base)$(objext): $o
$(gcc_compile) $(c_flags) -c $< $(vis_hide)
$(base)_s$(objext): $o
- $(gcc_s_compile) $(c_flags) -c $<
+ $(gcc_s_compile) -DSHARED $(c_flags) -c $<
else
@@ -29,6 +29,6 @@ $(base).vis: $(base)_s$(objext)
$(gen-hide-list)
$(base)_s$(objext): $o
- $(gcc_s_compile) -c -xassembler-with-cpp $<
+ $(gcc_s_compile) -DSHARED -c -xassembler-with-cpp $<
endif
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 69a205949bf..6e3a729fc7a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/36676
+ * io/list_read.c (find_nml_name): Use eat_separator instead of eat_line.
+
2008-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/36657
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 82c288f6c6e..ba8de9750e1 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2922,8 +2922,8 @@ find_nml_name:
goto find_nml_name;
}
- if (c == '!')
- eat_line (dtp);
+ unget_char (dtp, c);
+ eat_separator (dtp);
/* Ready to read namelist objects. If there is an error in input
from stdin, output the error message and continue. */
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 01f31a5e50d..d0c1d068dbb 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,36 @@
+2008-06-30 Joshua Sumali <jsumali@redhat.com>
+ Andrew Haley <aph@redhat.com>
+
+ * configure.ac (java-home): new AC_ARG_ENABLE.
+ (aot-compile-rpm): Likewise.
+ (CREATE_JAVA_HOME): new AM_CONDITIONAL.
+ (INSTALL_AOT_RPM): Likewise.
+ (gcc-suffix): new AC_ARG_WITH.
+ (arch-directory): Likewise.
+ (os-directory): Likewise.
+ (origin-name): Likewise.
+ (arch-suffix): Likewise.
+ (jvm-root-dir): Likewise.
+ (jvm-jar-dir): Likewise.
+ (python-dir): Likewise.
+ (AC_CONFIG_FILES): Add contrib/aotcompile.py, contrib/aot-compile,
+ contrib/aot-compile-rpm, contrib/rebuild-gcj-db.
+ (gcjsubdir): New AC_SUBST.
+ * Makefile.am (install-data-local): Install Python modules for
+ aot-compile. Also install an sdk style directory if
+ --enable-java-home is passed to configure.
+ (bin_SCRIPTS): Add
+ contrib/rebuild-gcj-db and contrib/aot-compile.
+ (gcjsubdir): Add.
+ (db_pathtail): Redefine in terms of gcjsubdir.
+ * contrib/aot-compile.in: New file.
+ * contrib/aotcompile.py.in: Likewise.
+ * contrib/aot-compile-rpm.in: Likewise.
+ * contrib/classfile.py: Likewise.
+ * contrib/rebuild-gcj-db.in: Likewise.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
2008-06-28 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (classpath-0_97_2-release).
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 559f73ab0d9..c074f5752a0 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -74,7 +74,8 @@ endif
## Name of the default .db.
db_name = classmap.db
## Compiler specific component of the .db file
-db_pathtail = gcj-$(gcc_version)/$(db_name)
+gcjsubdir = @gcjsubdir@
+db_pathtail = $(gcjsubdir)/$(db_name)
## For now, only on native systems. FIXME.
if NATIVE
@@ -85,9 +86,13 @@ bin_PROGRAMS = jv-convert gij grmic grmiregistry gcj-dbtool \
## It is convenient to actually build and install the default database
## when gcj-dbtool is available.
dbexec_DATA = $(db_name)
-endif
+endif
-bin_SCRIPTS = addr2name.awk
+bin_SCRIPTS = addr2name.awk contrib/rebuild-gcj-db contrib/aot-compile
+
+if INSTALL_AOT_RPM
+bin_SCRIPTS += contrib/aot-compile-rpm
+endif
if BUILD_ECJ1
## We build ecjx and not ecj1 because in one mode, ecjx will not work
@@ -528,7 +533,140 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/'gnu/java/nio/PipeImpl$$SinkChannelImpl.h' $(DESTDIR)$(gxx_include_dir)/gnu/java/nio/
$(INSTALL_DATA) $(srcdir)/'gnu/java/nio/PipeImpl$$SourceChannelImpl.h' $(DESTDIR)$(gxx_include_dir)/gnu/java/nio/
## Don't install java/nio/DirectByteBufferImpl$$ReadWrite.h here. It's for internal use only.
-
+## Install Python modules for aot-compile.
+ $(mkinstalldirs) $(DESTDIR)$(python_mod_dir); \
+ $(INSTALL_DATA) $(srcdir)/contrib/classfile.py \
+ $(DESTDIR)$(python_mod_dir)/classfile.py; \
+ $(INSTALL_DATA) contrib/aotcompile.py \
+ $(DESTDIR)$(python_mod_dir)/aotcompile.py;
+if CREATE_JAVA_HOME
+## Create sdk style directories
+ $(mkinstalldirs) $(DESTDIR)$(JRE_BIN_DIR)
+ $(mkinstalldirs) $(DESTDIR)$(SDK_BIN_DIR)
+ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)
+ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)
+ $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)
+ $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)/$(OS)
+ relative() { \
+ $(PERL) -e 'use File::Spec; \
+ print File::Spec->abs2rel($$ARGV[0], $$ARGV[1])' $$1 $$2; \
+ }; \
+ RELATIVE=$$(relative $(DESTDIR)$(bindir) $(DESTDIR)$(SDK_BIN_DIR)); \
+ ln -sf $$RELATIVE/`echo gij | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/java; \
+ ln -sf $$RELATIVE/`echo gjar | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/jar; \
+ ln -sf $$RELATIVE/`echo gjdoc | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/javadoc; \
+ ln -sf $$RELATIVE/`echo grmic | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/rmic; \
+ ln -sf $$RELATIVE/`echo gjavah | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/javah; \
+ ln -sf $$RELATIVE/ecj $(DESTDIR)$(SDK_BIN_DIR)/javac; \
+ ln -sf $$RELATIVE/`echo gappletviewer | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/appletviewer; \
+ ln -sf $$RELATIVE/`echo gjarsigner | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/jarsigner; \
+ ln -sf $$RELATIVE/`echo grmiregistry | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/rmiregistry; \
+ ln -sf $$RELATIVE/`echo gkeytool | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/keytool; \
+ ln -sf $$RELATIVE/`echo gorbd | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/orbd; \
+ ln -sf $$RELATIVE/`echo gnative2ascii | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/native2ascii; \
+ ln -sf $$RELATIVE/`echo grmid | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/rmid; \
+ ln -sf $$RELATIVE/`echo gtnameserv | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/tnameserv; \
+ ln -sf $$RELATIVE/`echo gserialver | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(SDK_BIN_DIR)/serialver; \
+ RELATIVE=$$(relative $(DESTDIR)$(bindir) $(DESTDIR)$(JRE_BIN_DIR)); \
+ ln -sf $$RELATIVE/`echo grmiregistry | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(JRE_BIN_DIR)/rmiregistry; \
+ ln -sf $$RELATIVE/`echo gkeytool | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(JRE_BIN_DIR)/keytool; \
+ ln -sf $$RELATIVE/`echo gij | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(JRE_BIN_DIR)/java; \
+ ln -sf $$RELATIVE/`echo gorbd | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(JRE_BIN_DIR)/orbd; \
+ ln -sf $$RELATIVE/`echo grmid | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(JRE_BIN_DIR)/rmid; \
+ ln -sf $$RELATIVE/`echo gtnameserv | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+ $(DESTDIR)$(JRE_BIN_DIR)/tnameserv; \
+ $(mkinstalldirs) $(DESTDIR)$(JVM_JAR_DIR); \
+ version=$(JAVA_VERSION).$(BUILD_VERSION); \
+ working_dir=`pwd`; \
+ cd $(DESTDIR)$(JVM_JAR_DIR); \
+ for jarname in jaas jce jdbc-stdext jndi jndi-cos jndi-dns \
+ jndi-ldap jndi-rmi jsse sasl; \
+ do \
+ ln -s $$RELATIVE/$$jarname.jar $$jarname-$$version.jar; \
+ done; \
+ for jar in *-$$version.jar; \
+ do \
+ ln -sf $$jar $$(echo $$jar | sed "s|-$$version.jar|-$(JAVA_VERSION).jar|g"); \
+ ln -sf $$jar $$(echo $$jar | sed "s|-$$version.jar|.jar|g"); \
+ done; \
+ cd $$working_dir; \
+ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/security; \
+ RELATIVE=$$(relative $(DESTDIR)$(libdir)/security \
+ $(DESTDIR)$(JRE_LIB_DIR)/security); \
+ cd $(DESTDIR)$(JRE_LIB_DIR)/security; \
+ ln -sf $$RELATIVE/classpath.security java.security; \
+ cd $$working_dir; \
+ $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)/linux; \
+ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client; \
+ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server; \
+ $(mkinstalldirs) $(DESTDIR)$(SDK_LIB_DIR); \
+ cd $(DESTDIR)$(JRE_LIB_DIR); \
+ for jarname in jaas jce jdbc-stdext jndi jndi-cos jndi-dns \
+ jndi-ldap jndi-rmi jsse sasl; \
+ do \
+ ln -s rt.jar $$jarname.jar; \
+ done; \
+ cd $$working_dir; \
+ RELATIVE=$$(relative $(DESTDIR)$(datarootdir)/java \
+ $(DESTDIR)$(JRE_LIB_DIR)); \
+ ln -sf $$RELATIVE/libgcj-$(gcc_version).jar \
+ $(DESTDIR)$(JRE_LIB_DIR)/rt.jar; \
+ RELATIVE=$$(relative $(DESTDIR)$(dbexecdir) \
+ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)); \
+ ln -sf $$RELATIVE/libjawt.so \
+ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/libjawt.so; \
+ RELATIVE=$$(relative $(DESTDIR)$(dbexecdir) \
+ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client); \
+ ln -sf $$RELATIVE/libjvm.so \
+ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client/libjvm.so; \
+ RELATIVE=$$(relative $(DESTDIR)$(dbexecdir) \
+ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server); \
+ ln -sf $$RELATIVE/libjvm.so \
+ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server/libjvm.so; \
+ RELATIVE=$$(relative $(DESTDIR)$(datarootdir)/java \
+ $(DESTDIR)$(SDK_LIB_DIR)); \
+ ln -sf $$RELATIVE/libgcj-tools-$(gcc_version).jar \
+ $(DESTDIR)$(SDK_LIB_DIR)/tools.jar; \
+ for headername in jawt jni; do \
+ DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
+ -print-file-name=include/$$headername.h)); \
+ RELATIVE=$$(relative $(DESTDIR)$$DIRECTORY \
+ $(DESTDIR)$(SDK_INCLUDE_DIR)); \
+ ln -sf $$RELATIVE/$$headername.h \
+ $(DESTDIR)$(SDK_INCLUDE_DIR)/$$headername.h; \
+ done; \
+ for headername in jawt_md jni_md; do \
+ DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
+ -print-file-name=include/$$headername.h)); \
+ RELATIVE=$$(relative $(DESTDIR)$$DIRECTORY \
+ $(DESTDIR)$(SDK_INCLUDE_DIR)/linux); \
+ ln -sf $$RELATIVE/$$headername.h \
+ $(DESTDIR)$(SDK_INCLUDE_DIR)/linux/$$headername.h; \
+ done; \
+ RELATIVE=$$(relative $(DESTDIR)$(datarootdir)/java \
+ $(DESTDIR)$(JVM_ROOT_DIR)/$(SDK_DIR)); \
+ ln -sf $$RELATIVE/src-$(gcc_version).zip \
+ $(DESTDIR)$(JVM_ROOT_DIR)/$(SDK_DIR)/src.zip;
+endif
## ################################################################
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index c42c692cef7..ba487885efc 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -52,18 +52,19 @@ target_triplet = @target@
@NATIVE_TRUE@ gnative2ascii$(EXEEXT) gorbd$(EXEEXT) \
@NATIVE_TRUE@ grmid$(EXEEXT) gserialver$(EXEEXT) \
@NATIVE_TRUE@ gtnameserv$(EXEEXT) gc-analyze$(EXEEXT)
+@INSTALL_AOT_RPM_TRUE@am__append_5 = contrib/aot-compile-rpm
@BUILD_ECJ1_TRUE@libexecsub_PROGRAMS = ecjx$(EXEEXT)
-@ANONVERSCRIPT_TRUE@am__append_5 = -Wl,--version-script=$(srcdir)/libgcj.ver
-@USING_GCC_TRUE@am__append_6 = $(WARNINGS)
-@USING_BOEHMGC_TRUE@am__append_7 = boehm.cc
-@USING_NOGC_TRUE@am__append_8 = nogc.cc
-@USING_POSIX_PLATFORM_TRUE@am__append_9 = posix.cc
-@USING_WIN32_PLATFORM_TRUE@am__append_10 = win32.cc
-@USING_DARWIN_CRT_TRUE@am__append_11 = darwin.cc
-@USING_POSIX_THREADS_TRUE@am__append_12 = posix-threads.cc
-@USING_WIN32_THREADS_TRUE@am__append_13 = win32-threads.cc
-@USING_NO_THREADS_TRUE@am__append_14 = no-threads.cc
-@ANONVERSCRIPT_TRUE@am__append_15 = $(srcdir)/libgcj.ver
+@ANONVERSCRIPT_TRUE@am__append_6 = -Wl,--version-script=$(srcdir)/libgcj.ver
+@USING_GCC_TRUE@am__append_7 = $(WARNINGS)
+@USING_BOEHMGC_TRUE@am__append_8 = boehm.cc
+@USING_NOGC_TRUE@am__append_9 = nogc.cc
+@USING_POSIX_PLATFORM_TRUE@am__append_10 = posix.cc
+@USING_WIN32_PLATFORM_TRUE@am__append_11 = win32.cc
+@USING_DARWIN_CRT_TRUE@am__append_12 = darwin.cc
+@USING_POSIX_THREADS_TRUE@am__append_13 = posix-threads.cc
+@USING_WIN32_THREADS_TRUE@am__append_14 = win32-threads.cc
+@USING_NO_THREADS_TRUE@am__append_15 = no-threads.cc
+@ANONVERSCRIPT_TRUE@am__append_16 = $(srcdir)/libgcj.ver
DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
$(srcdir)/../config.guess $(srcdir)/../config.sub \
$(srcdir)/../depcomp $(srcdir)/../install-sh \
@@ -72,11 +73,15 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
$(srcdir)/Makefile.in $(srcdir)/libgcj-test.spec.in \
$(srcdir)/libgcj.pc.in $(srcdir)/libgcj.spec.in \
$(srcdir)/sources.am $(top_srcdir)/configure \
+ $(top_srcdir)/contrib/aot-compile-rpm.in \
+ $(top_srcdir)/contrib/aot-compile.in \
+ $(top_srcdir)/contrib/aotcompile.py.in \
+ $(top_srcdir)/contrib/rebuild-gcj-db.in \
$(top_srcdir)/scripts/jar.in COPYING ChangeLog NEWS THANKS
@MAINTAINER_MODE_TRUE@@NATIVE_TRUE@noinst_PROGRAMS = \
@MAINTAINER_MODE_TRUE@@NATIVE_TRUE@ gen-from-JIS$(EXEEXT)
-@NATIVE_TRUE@@USE_LIBGCJ_BC_TRUE@am__append_16 = libgcj_bc.la
-@XLIB_AWT_TRUE@am__append_17 = $(xlib_nat_headers)
+@NATIVE_TRUE@@USE_LIBGCJ_BC_TRUE@am__append_17 = libgcj_bc.la
+@XLIB_AWT_TRUE@am__append_18 = $(xlib_nat_headers)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libltdl/acinclude.m4 \
@@ -109,7 +114,9 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
CONFIG_HEADER = $(top_builddir)/include/config.h \
$(top_builddir)/gcj/libgcj-config.h
CONFIG_CLEAN_FILES = libgcj.pc libgcj.spec libgcj-test.spec \
- scripts/jar java/io/natFile.cc java/lang/natConcreteProcess.cc \
+ contrib/aotcompile.py contrib/aot-compile \
+ contrib/aot-compile-rpm contrib/rebuild-gcj-db scripts/jar \
+ java/io/natFile.cc java/lang/natConcreteProcess.cc \
java/net/natVMInetAddress.cc java/net/natVMNetworkInterface.cc \
gnu/java/net/natPlainSocketImpl.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
@@ -581,6 +588,7 @@ AWK = @AWK@
BACKTRACESPEC = @BACKTRACESPEC@
BUILD_ECJ1_FALSE = @BUILD_ECJ1_FALSE@
BUILD_ECJ1_TRUE = @BUILD_ECJ1_TRUE@
+BUILD_VERSION = @BUILD_VERSION@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -588,6 +596,9 @@ CHECKREFSPEC = @CHECKREFSPEC@
CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPU = @CPU@
+CREATE_JAVA_HOME_FALSE = @CREATE_JAVA_HOME_FALSE@
+CREATE_JAVA_HOME_TRUE = @CREATE_JAVA_HOME_TRUE@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -617,6 +628,7 @@ GCJDEPMODE = @GCJDEPMODE@
GCJFLAGS = @GCJFLAGS@
GCJH = @GCJH@
GCJVERSION = @GCJVERSION@
+GCJ_BIN_DIR = @GCJ_BIN_DIR@
GCJ_FOR_ECJX = @GCJ_FOR_ECJX@
GCLIBS = @GCLIBS@
GCSPEC = @GCSPEC@
@@ -629,6 +641,8 @@ GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
INCLTDL = @INCLTDL@
+INSTALL_AOT_RPM_FALSE = @INSTALL_AOT_RPM_FALSE@
+INSTALL_AOT_RPM_TRUE = @INSTALL_AOT_RPM_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_ECJ_JAR_FALSE = @INSTALL_ECJ_JAR_FALSE@
INSTALL_ECJ_JAR_TRUE = @INSTALL_ECJ_JAR_TRUE@
@@ -644,13 +658,22 @@ JAVA_HOME_SET_FALSE = @JAVA_HOME_SET_FALSE@
JAVA_HOME_SET_TRUE = @JAVA_HOME_SET_TRUE@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
+JAVA_VERSION = @JAVA_VERSION@
JC1GCSPEC = @JC1GCSPEC@
+JRE_BIN_DIR = @JRE_BIN_DIR@
+JRE_DIR = @JRE_DIR@
+JRE_LIB_DIR = @JRE_LIB_DIR@
+JRE_LNK = @JRE_LNK@
+JVM_JAR_DIR = @JVM_JAR_DIR@
+JVM_JAR_ROOT_DIR = @JVM_JAR_ROOT_DIR@
+JVM_ROOT_DIR = @JVM_ROOT_DIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
LD_FINISH_STATIC_SPEC = @LD_FINISH_STATIC_SPEC@
LD_START_STATIC_SPEC = @LD_START_STATIC_SPEC@
LIBART_CFLAGS = @LIBART_CFLAGS@
LIBART_LIBS = @LIBART_LIBS@
+LIBDIR = @LIBDIR@
LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -673,6 +696,7 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
NATIVE_FALSE = @NATIVE_FALSE@
NATIVE_TRUE = @NATIVE_TRUE@
@@ -680,6 +704,7 @@ NEEDS_DATA_START_FALSE = @NEEDS_DATA_START_FALSE@
NEEDS_DATA_START_TRUE = @NEEDS_DATA_START_TRUE@
NM = nm
OBJEXT = @OBJEXT@
+OS = @OS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -691,6 +716,11 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PLATFORM = @PLATFORM@
RANLIB = @RANLIB@
+SDK_BIN_DIR = @SDK_BIN_DIR@
+SDK_DIR = @SDK_DIR@
+SDK_INCLUDE_DIR = @SDK_INCLUDE_DIR@
+SDK_LIB_DIR = @SDK_LIB_DIR@
+SDK_LNK = @SDK_LNK@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -777,7 +807,9 @@ dbexecdir = @dbexecdir@
exec_prefix = @exec_prefix@
extra_gij_ldflags = @extra_gij_ldflags@
extra_ldflags = @extra_ldflags@
-extra_ldflags_libjava = @extra_ldflags_libjava@ $(am__append_5)
+extra_ldflags_libjava = @extra_ldflags_libjava@ $(am__append_6)
+gcc_suffix = @gcc_suffix@
+gcjsubdir = @gcjsubdir@
gxx_include_dir = @gxx_include_dir@
here = @here@
host = @host@
@@ -802,6 +834,8 @@ multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+python_mod_dir = @python_mod_dir@
+python_mod_dir_expanded = @python_mod_dir_expanded@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
@@ -858,9 +892,10 @@ jar_DATA = libgcj-$(gcc_version).jar libgcj-tools-$(gcc_version).jar \
@JAVA_HOME_SET_FALSE@BOOT_CLASS_PATH_DIR = $(jardir)/libgcj-$(gcc_version).jar
@JAVA_HOME_SET_TRUE@BOOT_CLASS_PATH_DIR = $(JAVA_HOME)/lib/rt.jar
db_name = classmap.db
-db_pathtail = gcj-$(gcc_version)/$(db_name)
+db_pathtail = $(gcjsubdir)/$(db_name)
@NATIVE_TRUE@dbexec_DATA = $(db_name)
-bin_SCRIPTS = addr2name.awk
+bin_SCRIPTS = addr2name.awk contrib/rebuild-gcj-db contrib/aot-compile \
+ $(am__append_5)
GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated
GCJLINK = $(LIBTOOL) --tag=GCJ --mode=link $(GCJ) -L$(here) $(JC1FLAGS) \
$(LDFLAGS) -o $@
@@ -898,7 +933,7 @@ AM_GCJFLAGS = \
--encoding=UTF-8 \
-Wno-deprecated -fbootstrap-classes
-AM_CFLAGS = @LIBGCJ_CFLAGS@ $(am__append_6)
+AM_CFLAGS = @LIBGCJ_CFLAGS@ $(am__append_7)
@SUPPRESS_LIBGCJ_BC_FALSE@LIBGCJ_BC_FLAGS = -findirect-dispatch -fno-indirect-classes
@SUPPRESS_LIBGCJ_BC_TRUE@LIBGCJ_BC_FLAGS =
PEDANTIC_CFLAGS = -ansi -pedantic -Wall -Wno-long-long
@@ -923,9 +958,9 @@ libgij_la_LDFLAGS = -rpath $(toolexeclibdir) \
@INTERPRETER_TRUE@libgcj_interpret_source_files = jvmti.cc interpret.cc
libgcj_la_SOURCES = prims.cc jni.cc exception.cc stacktrace.cc link.cc \
defineclass.cc verify.cc $(libgcj_interpret_source_files) \
- $(nat_source_files) $(am__append_7) $(am__append_8) \
- $(am__append_9) $(am__append_10) $(am__append_11) \
- $(am__append_12) $(am__append_13) $(am__append_14)
+ $(nat_source_files) $(am__append_8) $(am__append_9) \
+ $(am__append_10) $(am__append_11) $(am__append_12) \
+ $(am__append_13) $(am__append_14) $(am__append_15)
nat_files = $(nat_source_files:.cc=.lo)
xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
@@ -949,7 +984,7 @@ libgcj_la_LIBADD = \
libgcj_la_DEPENDENCIES = libgcj-$(gcc_version).jar java/lang/Object.lo \
java/lang/Class.lo java/process-$(PLATFORM).lo \
$(all_packages_source_files:.list=.lo) $(LIBLTDL) \
- $(libgcj_la_LIBADD) $(am__append_15)
+ $(libgcj_la_LIBADD) $(am__append_16)
libgcj_la_LINK = $(LIBLINK)
EXTRA_libgcj_la_SOURCES = java/lang/Object.java
libgcj_tools_la_SOURCES = classpath/tools/tools.zip
@@ -8192,7 +8227,7 @@ ECJX_BASE_FLAGS = -findirect-dispatch \
@NATIVE_TRUE@ecjx_LDADD = -L$(here)/.libs libgcj.la
@NATIVE_FALSE@ecjx_DEPENDENCIES =
@NATIVE_TRUE@ecjx_DEPENDENCIES = libgcj.la libgcj.spec \
-@NATIVE_TRUE@ $(am__append_16)
+@NATIVE_TRUE@ $(am__append_17)
gappletviewer_SOURCES =
gappletviewer_LDFLAGS = --main=gnu.classpath.tools.appletviewer.Main \
-rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS) $(extra_ldflags)
@@ -8401,7 +8436,7 @@ gnu/gcj/xlib/natXImage.cc \
gnu/gcj/xlib/natXUnmapEvent.cc
sourcesdir = $(jardir)
-headers_to_make = $(nat_headers) $(am__append_17)
+headers_to_make = $(nat_headers) $(am__append_18)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -8500,6 +8535,14 @@ libgcj.spec: $(top_builddir)/config.status $(srcdir)/libgcj.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
libgcj-test.spec: $(top_builddir)/config.status $(srcdir)/libgcj-test.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+contrib/aotcompile.py: $(top_builddir)/config.status $(top_srcdir)/contrib/aotcompile.py.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+contrib/aot-compile: $(top_builddir)/config.status $(top_srcdir)/contrib/aot-compile.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+contrib/aot-compile-rpm: $(top_builddir)/config.status $(top_srcdir)/contrib/aot-compile-rpm.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+contrib/rebuild-gcj-db: $(top_builddir)/config.status $(top_srcdir)/contrib/rebuild-gcj-db.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
scripts/jar: $(top_builddir)/config.status $(top_srcdir)/scripts/jar.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-dbexecLTLIBRARIES: $(dbexec_LTLIBRARIES)
@@ -9972,7 +10015,7 @@ distclean-tags:
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/. $(distdir)/.. $(distdir)/../config $(distdir)/libltdl $(distdir)/scripts
+ $(mkdir_p) $(distdir)/. $(distdir)/.. $(distdir)/../config $(distdir)/contrib $(distdir)/libltdl $(distdir)/scripts
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@@ -12189,6 +12232,136 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/'gnu/java/net/PlainSocketImpl$$SocketOutputStream.h' $(DESTDIR)$(gxx_include_dir)/gnu/java/net/
$(INSTALL_DATA) $(srcdir)/'gnu/java/nio/PipeImpl$$SinkChannelImpl.h' $(DESTDIR)$(gxx_include_dir)/gnu/java/nio/
$(INSTALL_DATA) $(srcdir)/'gnu/java/nio/PipeImpl$$SourceChannelImpl.h' $(DESTDIR)$(gxx_include_dir)/gnu/java/nio/
+ $(mkinstalldirs) $(DESTDIR)$(python_mod_dir); \
+ $(INSTALL_DATA) $(srcdir)/contrib/classfile.py \
+ $(DESTDIR)$(python_mod_dir)/classfile.py; \
+ $(INSTALL_DATA) contrib/aotcompile.py \
+ $(DESTDIR)$(python_mod_dir)/aotcompile.py;
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JRE_BIN_DIR)
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(SDK_BIN_DIR)
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)/$(OS)
+@CREATE_JAVA_HOME_TRUE@ relative() { \
+@CREATE_JAVA_HOME_TRUE@ $(PERL) -e 'use File::Spec; \
+@CREATE_JAVA_HOME_TRUE@ print File::Spec->abs2rel($$ARGV[0], $$ARGV[1])' $$1 $$2; \
+@CREATE_JAVA_HOME_TRUE@ }; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(bindir) $(DESTDIR)$(SDK_BIN_DIR)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gij | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/java; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gjar | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/jar; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gjdoc | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/javadoc; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo grmic | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/rmic; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gjavah | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/javah; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/ecj $(DESTDIR)$(SDK_BIN_DIR)/javac; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gappletviewer | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/appletviewer; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gjarsigner | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/jarsigner; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo grmiregistry | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/rmiregistry; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gkeytool | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/keytool; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gorbd | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/orbd; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gnative2ascii | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/native2ascii; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo grmid | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/rmid; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gtnameserv | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/tnameserv; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gserialver | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_BIN_DIR)/serialver; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(bindir) $(DESTDIR)$(JRE_BIN_DIR)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo grmiregistry | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_BIN_DIR)/rmiregistry; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gkeytool | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_BIN_DIR)/keytool; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gij | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_BIN_DIR)/java; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gorbd | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_BIN_DIR)/orbd; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo grmid | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_BIN_DIR)/rmid; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/`echo gtnameserv | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_BIN_DIR)/tnameserv; \
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JVM_JAR_DIR); \
+@CREATE_JAVA_HOME_TRUE@ version=$(JAVA_VERSION).$(BUILD_VERSION); \
+@CREATE_JAVA_HOME_TRUE@ working_dir=`pwd`; \
+@CREATE_JAVA_HOME_TRUE@ cd $(DESTDIR)$(JVM_JAR_DIR); \
+@CREATE_JAVA_HOME_TRUE@ for jarname in jaas jce jdbc-stdext jndi jndi-cos jndi-dns \
+@CREATE_JAVA_HOME_TRUE@ jndi-ldap jndi-rmi jsse sasl; \
+@CREATE_JAVA_HOME_TRUE@ do \
+@CREATE_JAVA_HOME_TRUE@ ln -s $$RELATIVE/$$jarname.jar $$jarname-$$version.jar; \
+@CREATE_JAVA_HOME_TRUE@ done; \
+@CREATE_JAVA_HOME_TRUE@ for jar in *-$$version.jar; \
+@CREATE_JAVA_HOME_TRUE@ do \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$jar $$(echo $$jar | sed "s|-$$version.jar|-$(JAVA_VERSION).jar|g"); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$jar $$(echo $$jar | sed "s|-$$version.jar|.jar|g"); \
+@CREATE_JAVA_HOME_TRUE@ done; \
+@CREATE_JAVA_HOME_TRUE@ cd $$working_dir; \
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/security; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(libdir)/security \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/security); \
+@CREATE_JAVA_HOME_TRUE@ cd $(DESTDIR)$(JRE_LIB_DIR)/security; \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/classpath.security java.security; \
+@CREATE_JAVA_HOME_TRUE@ cd $$working_dir; \
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(SDK_INCLUDE_DIR)/linux; \
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client; \
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server; \
+@CREATE_JAVA_HOME_TRUE@ $(mkinstalldirs) $(DESTDIR)$(SDK_LIB_DIR); \
+@CREATE_JAVA_HOME_TRUE@ cd $(DESTDIR)$(JRE_LIB_DIR); \
+@CREATE_JAVA_HOME_TRUE@ for jarname in jaas jce jdbc-stdext jndi jndi-cos jndi-dns \
+@CREATE_JAVA_HOME_TRUE@ jndi-ldap jndi-rmi jsse sasl; \
+@CREATE_JAVA_HOME_TRUE@ do \
+@CREATE_JAVA_HOME_TRUE@ ln -s rt.jar $$jarname.jar; \
+@CREATE_JAVA_HOME_TRUE@ done; \
+@CREATE_JAVA_HOME_TRUE@ cd $$working_dir; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(datarootdir)/java \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/libgcj-$(gcc_version).jar \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/rt.jar; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(dbexecdir) \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/libjawt.so \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/libjawt.so; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(dbexecdir) \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/libjvm.so \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/client/libjvm.so; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(dbexecdir) \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/libjvm.so \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JRE_LIB_DIR)/$(CPU)/server/libjvm.so; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(datarootdir)/java \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_LIB_DIR)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/libgcj-tools-$(gcc_version).jar \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_LIB_DIR)/tools.jar; \
+@CREATE_JAVA_HOME_TRUE@ for headername in jawt jni; do \
+@CREATE_JAVA_HOME_TRUE@ DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
+@CREATE_JAVA_HOME_TRUE@ -print-file-name=include/$$headername.h)); \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$$DIRECTORY \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_INCLUDE_DIR)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/$$headername.h \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_INCLUDE_DIR)/$$headername.h; \
+@CREATE_JAVA_HOME_TRUE@ done; \
+@CREATE_JAVA_HOME_TRUE@ for headername in jawt_md jni_md; do \
+@CREATE_JAVA_HOME_TRUE@ DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
+@CREATE_JAVA_HOME_TRUE@ -print-file-name=include/$$headername.h)); \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$$DIRECTORY \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_INCLUDE_DIR)/linux); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/$$headername.h \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(SDK_INCLUDE_DIR)/linux/$$headername.h; \
+@CREATE_JAVA_HOME_TRUE@ done; \
+@CREATE_JAVA_HOME_TRUE@ RELATIVE=$$(relative $(DESTDIR)$(datarootdir)/java \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JVM_ROOT_DIR)/$(SDK_DIR)); \
+@CREATE_JAVA_HOME_TRUE@ ln -sf $$RELATIVE/src-$(gcc_version).zip \
+@CREATE_JAVA_HOME_TRUE@ $(DESTDIR)$(JVM_ROOT_DIR)/$(SDK_DIR)/src.zip;
maintainer-check: libgcj.la
$(NM) .libs/libgcj.a | grep ' T ' \
diff --git a/libjava/configure b/libjava/configure
index 03a48114eb3..3547e9d1601 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -459,7 +459,7 @@ ac_includes_default="\
#endif"
ac_subdirs_all="$ac_subdirs_all classpath libltdl"
-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 build_libsubdir build_subdir host_subdir target_subdir multi_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs JAVA_MAINTAINER_MODE_TRUE JAVA_MAINTAINER_MODE_FALSE CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB JAR ZIP UNZIP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJ_LD_SYMBOLIC_FUNCTIONS LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE X_AWT_TRUE X_AWT_FALSE GCJ_FOR_ECJX GCJH host_exeext INCLTDL LIBLTDL DIRLTDL LIBTOOL SED EGREP FGREP GREP DUMPBIN ac_ct_DUMPBIN NM lt_ECHO CPP CPPFLAGS CXXCPP GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE ECJ_BUILD_JAR ECJ_JAR BUILD_ECJ1_TRUE BUILD_ECJ1_FALSE INSTALL_ECJ_JAR_TRUE INSTALL_ECJ_JAR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME SUPPRESS_LIBGCJ_BC_TRUE SUPPRESS_LIBGCJ_BC_FALSE INTERPRETER INTERPRETER_TRUE INTERPRETER_FALSE LIBFFI LIBFFIINCS PLATFORM USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS extra_ldflags_libjava extra_gij_ldflags extra_ldflags LIBSTDCXXSPEC LIBGCJTESTSPEC GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADSTARTFILESPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE USE_LIBGCJ_BC_TRUE USE_LIBGCJ_BC_FALSE LIBGCJ_SPEC HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV PKG_CONFIG GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE ENABLE_SHARED_TRUE ENABLE_SHARED_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir GCJVERSION dbexecdir gxx_include_dir libstdcxx_incdir PERL SYSDEP_SOURCES ANONVERSCRIPT_TRUE ANONVERSCRIPT_FALSE LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here 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 build_libsubdir build_subdir host_subdir target_subdir multi_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs JAVA_MAINTAINER_MODE_TRUE JAVA_MAINTAINER_MODE_FALSE CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB JAR ZIP UNZIP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJ_LD_SYMBOLIC_FUNCTIONS LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE X_AWT_TRUE X_AWT_FALSE GCJ_FOR_ECJX GCJH host_exeext INCLTDL LIBLTDL DIRLTDL LIBTOOL SED EGREP FGREP GREP DUMPBIN ac_ct_DUMPBIN NM lt_ECHO CPP CPPFLAGS CXXCPP GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE ECJ_BUILD_JAR ECJ_JAR BUILD_ECJ1_TRUE BUILD_ECJ1_FALSE INSTALL_ECJ_JAR_TRUE INSTALL_ECJ_JAR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME SUPPRESS_LIBGCJ_BC_TRUE SUPPRESS_LIBGCJ_BC_FALSE INTERPRETER INTERPRETER_TRUE INTERPRETER_FALSE LIBFFI LIBFFIINCS PLATFORM USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS extra_ldflags_libjava extra_gij_ldflags extra_ldflags LIBSTDCXXSPEC LIBGCJTESTSPEC GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADSTARTFILESPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE USE_LIBGCJ_BC_TRUE USE_LIBGCJ_BC_FALSE LIBGCJ_SPEC HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV PKG_CONFIG GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE ENABLE_SHARED_TRUE ENABLE_SHARED_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir GCJVERSION dbexecdir gcjsubdir gxx_include_dir libstdcxx_incdir PERL SYSDEP_SOURCES ANONVERSCRIPT_TRUE ANONVERSCRIPT_FALSE LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here python_mod_dir python_mod_dir_expanded MAKE INSTALL_AOT_RPM_TRUE INSTALL_AOT_RPM_FALSE CREATE_JAVA_HOME_TRUE CREATE_JAVA_HOME_FALSE gcc_suffix JAVA_VERSION BUILD_VERSION JVM_ROOT_DIR JVM_JAR_ROOT_DIR JVM_JAR_DIR JRE_DIR SDK_DIR JRE_LNK SDK_LNK SDK_BIN_DIR SDK_LIB_DIR SDK_INCLUDE_DIR JRE_BIN_DIR JRE_LIB_DIR GCJ_BIN_DIR CPU OS LIBDIR LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -1047,6 +1047,10 @@ Optional Features:
--enable-java-gc=TYPE choose garbage collector (default is boehm)
--disable-rpath do not hardcode runtime library paths
--enable-tls Use thread-local storage [default=yes]
+ --enable-aot-compile-rpm
+ enable installation of aot-compile-rpm [default=no]
+ --enable-java-home create a standard JDK-style directory layout in the
+ install tree [default=no]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1072,6 +1076,20 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
+ --with-python-dir the location to install Python modules. This path
+ should NOT include the prefix.
+ --with-gcc-suffix the GCC tool suffix (defaults to empty string)
+ --with-arch-directory the arch directory under jre/lib (defaults to
+ auto-detect)
+ --with-os-directory the os directory under include (defaults to
+ auto-detect)
+ --with-origin-name the JPackage origin name of this package (default is
+ gcj${gcc_suffix}
+ --with-arch-suffix the arch directory suffix (default is the empty
+ string
+ --with-jvm-root-dir where to install SDK (default is ${prefix}/lib/jvm)
+ --with-jvm-jar-dir where to install jars (default is
+ ${prefix}/lib/jvm-exports)
Some influential environment variables:
CC C compiler command
@@ -6003,13 +6021,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:6006: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:6024: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:6009: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:6027: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:6012: output\"" >&5)
+ (eval echo "\"\$as_me:6030: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -7053,7 +7071,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 7056 "configure"' > conftest.$ac_ext
+ echo '#line 7074 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8754,11 +8772,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8757: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8775: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8761: \$? = $ac_status" >&5
+ echo "$as_me:8779: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9076,11 +9094,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9079: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9097: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9083: \$? = $ac_status" >&5
+ echo "$as_me:9101: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9181,11 +9199,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9184: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9202: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9188: \$? = $ac_status" >&5
+ echo "$as_me:9206: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9236,11 +9254,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9239: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9257: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9243: \$? = $ac_status" >&5
+ echo "$as_me:9261: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12088,7 +12106,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12091 "configure"
+#line 12109 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12188,7 +12206,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12191 "configure"
+#line 12209 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14226,11 +14244,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14229: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14247: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14233: \$? = $ac_status" >&5
+ echo "$as_me:14251: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14325,11 +14343,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14328: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14346: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14332: \$? = $ac_status" >&5
+ echo "$as_me:14350: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14377,11 +14395,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14380: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14398: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14384: \$? = $ac_status" >&5
+ echo "$as_me:14402: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15765,11 +15783,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15768: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15786: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15772: \$? = $ac_status" >&5
+ echo "$as_me:15790: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16081,11 +16099,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16084: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16102: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16088: \$? = $ac_status" >&5
+ echo "$as_me:16106: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16180,11 +16198,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16183: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16201: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16187: \$? = $ac_status" >&5
+ echo "$as_me:16205: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16232,11 +16250,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16235: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16253: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16239: \$? = $ac_status" >&5
+ echo "$as_me:16257: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18588,7 +18606,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
:
else
cat > conftest.$ac_ext << EOF
-#line 18591 "configure"
+#line 18609 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -26299,6 +26317,7 @@ esac
+
cat >>confdefs.h <<\_ACEOF
#define JV_VERSION "1.5.0"
_ACEOF
@@ -27872,7 +27891,283 @@ here=`${PWDCMD-pwd}`
# We get this from the environment.
- ac_config_files="$ac_config_files Makefile libgcj.pc libgcj.spec libgcj-test.spec gcj/Makefile include/Makefile testsuite/Makefile"
+
+# Check whether --with-python-dir or --without-python-dir was given.
+if test "${with_python_dir+set}" = set; then
+ withval="$with_python_dir"
+ with_python_dir=$withval
+else
+ with_python_dir=""
+fi;
+
+if test "x${with_python_dir}" = "x"
+then
+ # Needed for installing Python modules during make install.
+ python_mod_dir="\${prefix}/share/python"
+ # Needed for substituting into aot-compile*
+ python_mod_dir_expanded="${prefix}/share/python"
+else
+ python_mod_dir="\${prefix}${with_python_dir}"
+ python_mod_dir_expanded="${prefix}${with_python_dir}"
+fi
+echo "$as_me:$LINENO: result: Python modules dir: ${python_mod_dir_expanded}" >&5
+echo "${ECHO_T}Python modules dir: ${python_mod_dir_expanded}" >&6;
+
+
+
+# needed for aot-compile-rpm
+MAKE=`which make`
+
+
+# Check whether --enable-aot-compile-rpm or --disable-aot-compile-rpm was given.
+if test "${enable_aot_compile_rpm+set}" = set; then
+ enableval="$enable_aot_compile_rpm"
+ case "${enableval}" in
+ yes) AOT_RPM_ENABLED=yes ;;
+ no) AOT_RPM_ENABLED=no ;;
+ *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable aot-compile-rpm" >&5
+echo "$as_me: error: Unknown argument to enable/disable aot-compile-rpm" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ AOT_RPM_ENABLED=no
+
+fi;
+
+
+if test "x${AOT_RPM_ENABLED}" == xyes; then
+ INSTALL_AOT_RPM_TRUE=
+ INSTALL_AOT_RPM_FALSE='#'
+else
+ INSTALL_AOT_RPM_TRUE='#'
+ INSTALL_AOT_RPM_FALSE=
+fi
+
+
+# Check whether --enable-java-home or --disable-java-home was given.
+if test "${enable_java_home+set}" = set; then
+ enableval="$enable_java_home"
+ case "${enableval}" in
+ yes) JAVA_HOME_ENABLED=yes ;;
+ no) JAVA_HOME_ENABLED=no ;;
+ *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable java-home" >&5
+echo "$as_me: error: Unknown argument to enable/disable java-home" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ JAVA_HOME_ENABLED=no
+
+fi;
+
+
+if test "x${JAVA_HOME_ENABLED}" == xyes; then
+ CREATE_JAVA_HOME_TRUE=
+ CREATE_JAVA_HOME_FALSE='#'
+else
+ CREATE_JAVA_HOME_TRUE='#'
+ CREATE_JAVA_HOME_FALSE=
+fi
+
+
+# Only do these checks if java-home above is enabled.
+if test "x${JAVA_HOME_ENABLED}" == xyes
+then
+
+
+# Check whether --with-gcc-suffix or --without-gcc-suffix was given.
+if test "${with_gcc_suffix+set}" = set; then
+ withval="$with_gcc_suffix"
+ gcc_suffix=$withval
+else
+ gcc_suffix=""
+fi;
+ echo "$as_me:$LINENO: result: GCC suffix: ${gcc_suffix}" >&5
+echo "${ECHO_T}GCC suffix: ${gcc_suffix}" >&6
+
+
+
+# Check whether --with-arch-directory or --without-arch-directory was given.
+if test "${with_arch_directory+set}" = set; then
+ withval="$with_arch_directory"
+ host_cpu=$withval
+else
+ host_cpu=""
+fi;
+
+
+# Check whether --with-os-directory or --without-os-directory was given.
+if test "${with_os_directory+set}" = set; then
+ withval="$with_os_directory"
+ host_os=$withval
+else
+ host_os=""
+fi;
+
+
+# Check whether --with-origin-name or --without-origin-name was given.
+if test "${with_origin_name+set}" = set; then
+ withval="$with_origin_name"
+ origin_name=$withval
+else
+ origin_name=gcj${gcc_suffix}
+fi;
+ echo "$as_me:$LINENO: result: JPackage origin name: ${origin_name}" >&5
+echo "${ECHO_T}JPackage origin name: ${origin_name}" >&6
+
+
+# Check whether --with-arch-suffix or --without-arch-suffix was given.
+if test "${with_arch_suffix+set}" = set; then
+ withval="$with_arch_suffix"
+ arch_suffix=$withval
+else
+ arch_suffix=""
+fi;
+ echo "$as_me:$LINENO: result: arch suffix: ${arch_suffix}" >&5
+echo "${ECHO_T}arch suffix: ${arch_suffix}" >&6
+
+
+# Check whether --with-jvm-root-dir or --without-jvm-root-dir was given.
+if test "${with_jvm_root_dir+set}" = set; then
+ withval="$with_jvm_root_dir"
+ jvm_root_dir=$withval
+else
+ jvm_root_dir="\${prefix}/lib/jvm"
+fi;
+ echo "$as_me:$LINENO: result: JVM root installation directory: ${jvm_root_dir}" >&5
+echo "${ECHO_T}JVM root installation directory: ${jvm_root_dir}" >&6
+
+
+# Check whether --with-jvm-jar-dir or --without-jvm-jar-dir was given.
+if test "${with_jvm_jar_dir+set}" = set; then
+ withval="$with_jvm_jar_dir"
+ jvm_jar_dir=$withval
+else
+ jvm_jar_dir=\${prefix}/lib/jvm-exports
+fi;
+ echo "$as_me:$LINENO: result: JAR root installation directory: ${jvm_jar_dir}" >&5
+echo "${ECHO_T}JAR root installation directory: ${jvm_jar_dir}" >&6
+
+ JAVA_VERSION=1.5.0
+ BUILD_VERSION=0
+
+
+ echo "$as_me:$LINENO: result: Java version: ${JAVA_VERSION}" >&5
+echo "${ECHO_T}Java version: ${JAVA_VERSION}" >&6
+
+ jre_dir=java-${JAVA_VERSION}-${origin_name}-${JAVA_VERSION}.${BUILD_VERSION}${arch_suffix}/jre
+ sdk_dir=java-${JAVA_VERSION}-${origin_name}-${JAVA_VERSION}.${BUILD_VERSION}${arch_suffix}
+ jre_lnk=jre-${JAVA_VERSION}-${origin_name}
+ sdk_lnk=java-${JAVA_VERSION}-${origin_name}
+
+ JVM_ROOT_DIR=${jvm_root_dir}
+
+ echo "$as_me:$LINENO: result: JVM ROOT directory: ${JVM_ROOT_DIR}" >&5
+echo "${ECHO_T}JVM ROOT directory: ${JVM_ROOT_DIR}" >&6
+
+ JVM_JAR_ROOT_DIR=${jvm_jar_dir}
+
+ echo "$as_me:$LINENO: result: JVM JAR ROOT directory: ${JVM_JAR_ROOT_DIR}" >&5
+echo "${ECHO_T}JVM JAR ROOT directory: ${JVM_JAR_ROOT_DIR}" >&6
+
+ JVM_JAR_DIR=${jvm_jar_dir}/${sdk_dir}
+
+ echo "$as_me:$LINENO: result: JVM JAR directory: ${JVM_JAR_DIR}" >&5
+echo "${ECHO_T}JVM JAR directory: ${JVM_JAR_DIR}" >&6
+
+ JRE_DIR=${jre_dir}
+
+
+ SDK_DIR=${sdk_dir}
+
+
+ JRE_LNK=${jre_lnk}
+
+
+ SDK_LNK=${sdk_lnk}
+
+
+ SDK_BIN_DIR=${jvm_root_dir}/${sdk_dir}/bin
+
+ echo "$as_me:$LINENO: result: SDK tools directory: ${SDK_BIN_DIR}" >&5
+echo "${ECHO_T}SDK tools directory: ${SDK_BIN_DIR}" >&6
+
+ SDK_LIB_DIR=${jvm_root_dir}/${sdk_dir}/lib
+
+ echo "$as_me:$LINENO: result: SDK jar directory: ${SDK_LIB_DIR}" >&5
+echo "${ECHO_T}SDK jar directory: ${SDK_LIB_DIR}" >&6
+
+ SDK_INCLUDE_DIR=${jvm_root_dir}/${sdk_dir}/include
+
+ echo "$as_me:$LINENO: result: SDK include directory: ${SDK_INCLUDE_DIR}" >&5
+echo "${ECHO_T}SDK include directory: ${SDK_INCLUDE_DIR}" >&6
+
+ JRE_BIN_DIR=${jvm_root_dir}/${jre_dir}/bin
+
+ echo "$as_me:$LINENO: result: JRE tools directory: ${JRE_BIN_DIR}" >&5
+echo "${ECHO_T}JRE tools directory: ${JRE_BIN_DIR}" >&6
+
+ JRE_LIB_DIR=${jvm_root_dir}/${jre_dir}/lib
+
+ echo "$as_me:$LINENO: result: JRE lib directory: ${JRE_LIB_DIR}" >&5
+echo "${ECHO_T}JRE lib directory: ${JRE_LIB_DIR}" >&6
+
+ # Find gcj prefix using gcj found in PATH.
+ gcj_prefix=`which gcj${gcc_suffix} | sed "s%/bin/gcj${gcc_suffix}%%"`
+
+ # Where do the gcj binaries live?
+ # For jhbuild based builds, they all live in a sibling of bin called
+ # gcj-bin. Check for gcj-bin first, and use bin otherwise.
+ GCJ_BIN_DIR=`if test -d ${gcj_prefix}/gcj-bin; then echo ${gcj_prefix}/gcj-bin; else echo ${gcj_prefix}/bin; fi`
+
+ echo "$as_me:$LINENO: result: GCJ tools directory: ${GCJ_BIN_DIR}" >&5
+echo "${ECHO_T}GCJ tools directory: ${GCJ_BIN_DIR}" >&6
+
+ echo host is ${host}
+ if test "x${host_cpu}" = "x"
+ then
+ case ${host} in
+ *-mingw* | *-cygwin*)
+ host_cpu=x86;;
+ i486-* | i586-* | i686-*)
+ host_cpu=i386;;
+ *)
+ host_cpu=${host_cpu};;
+ esac
+ fi
+ echo "$as_me:$LINENO: result: arch directory: ${host_cpu}" >&5
+echo "${ECHO_T}arch directory: ${host_cpu}" >&6
+ CPU=${host_cpu}
+
+
+ if test "x${host_os}" = "x"
+ then
+ case ${host} in
+ *-mingw* | *-cygwin*)
+ host_os=win32;;
+ *-linux*)
+ host_os=linux;;
+ *)
+ host_os=${host_os};;
+ esac
+ fi
+ echo os directory: ${host_os}
+ OS=${host_os}
+
+
+ # make an expanded $libdir, for substituting into
+ # scripts (and other non-Makefile things).
+ LIBDIR=$libdir
+ if test "x${exec_prefix}" = "xNONE"
+ then
+ lib_exec_prefix=$prefix
+ else
+ lib_exec_prefix=$exec_prefix
+ fi
+ LIBDIR=`echo $libdir | sed "s:\\\${exec_prefix}:$lib_exec_prefix:g"`
+
+fi
+
+ ac_config_files="$ac_config_files Makefile libgcj.pc libgcj.spec libgcj-test.spec gcj/Makefile include/Makefile testsuite/Makefile contrib/aotcompile.py contrib/aot-compile contrib/aot-compile-rpm contrib/rebuild-gcj-db"
if test ${multilib} = yes; then
@@ -28184,6 +28479,20 @@ echo "$as_me: error: conditional \"ANONVERSCRIPT\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${INSTALL_AOT_RPM_TRUE}" && test -z "${INSTALL_AOT_RPM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"INSTALL_AOT_RPM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"INSTALL_AOT_RPM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${CREATE_JAVA_HOME_TRUE}" && test -z "${CREATE_JAVA_HOME_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CREATE_JAVA_HOME\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CREATE_JAVA_HOME\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
@@ -29064,6 +29373,10 @@ do
"gcj/Makefile" ) CONFIG_FILES="$CONFIG_FILES gcj/Makefile" ;;
"include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"testsuite/Makefile" ) CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+ "contrib/aotcompile.py" ) CONFIG_FILES="$CONFIG_FILES contrib/aotcompile.py" ;;
+ "contrib/aot-compile" ) CONFIG_FILES="$CONFIG_FILES contrib/aot-compile" ;;
+ "contrib/aot-compile-rpm" ) CONFIG_FILES="$CONFIG_FILES contrib/aot-compile-rpm" ;;
+ "contrib/rebuild-gcj-db" ) CONFIG_FILES="$CONFIG_FILES contrib/rebuild-gcj-db" ;;
"scripts/jar" ) CONFIG_FILES="$CONFIG_FILES scripts/jar" ;;
"include/platform.h" ) CONFIG_LINKS="$CONFIG_LINKS include/platform.h:include/$PLATFORMH" ;;
"java/io/natFile.cc" ) CONFIG_LINKS="$CONFIG_LINKS java/io/natFile.cc:java/io/natFile${FILE-${PLATFORM}}.cc" ;;
@@ -29383,6 +29696,7 @@ s,@toolexecmainlibdir@,$toolexecmainlibdir,;t t
s,@toolexeclibdir@,$toolexeclibdir,;t t
s,@GCJVERSION@,$GCJVERSION,;t t
s,@dbexecdir@,$dbexecdir,;t t
+s,@gcjsubdir@,$gcjsubdir,;t t
s,@gxx_include_dir@,$gxx_include_dir,;t t
s,@libstdcxx_incdir@,$libstdcxx_incdir,;t t
s,@PERL@,$PERL,;t t
@@ -29392,6 +29706,32 @@ s,@ANONVERSCRIPT_FALSE@,$ANONVERSCRIPT_FALSE,;t t
s,@LD_START_STATIC_SPEC@,$LD_START_STATIC_SPEC,;t t
s,@LD_FINISH_STATIC_SPEC@,$LD_FINISH_STATIC_SPEC,;t t
s,@here@,$here,;t t
+s,@python_mod_dir@,$python_mod_dir,;t t
+s,@python_mod_dir_expanded@,$python_mod_dir_expanded,;t t
+s,@MAKE@,$MAKE,;t t
+s,@INSTALL_AOT_RPM_TRUE@,$INSTALL_AOT_RPM_TRUE,;t t
+s,@INSTALL_AOT_RPM_FALSE@,$INSTALL_AOT_RPM_FALSE,;t t
+s,@CREATE_JAVA_HOME_TRUE@,$CREATE_JAVA_HOME_TRUE,;t t
+s,@CREATE_JAVA_HOME_FALSE@,$CREATE_JAVA_HOME_FALSE,;t t
+s,@gcc_suffix@,$gcc_suffix,;t t
+s,@JAVA_VERSION@,$JAVA_VERSION,;t t
+s,@BUILD_VERSION@,$BUILD_VERSION,;t t
+s,@JVM_ROOT_DIR@,$JVM_ROOT_DIR,;t t
+s,@JVM_JAR_ROOT_DIR@,$JVM_JAR_ROOT_DIR,;t t
+s,@JVM_JAR_DIR@,$JVM_JAR_DIR,;t t
+s,@JRE_DIR@,$JRE_DIR,;t t
+s,@SDK_DIR@,$SDK_DIR,;t t
+s,@JRE_LNK@,$JRE_LNK,;t t
+s,@SDK_LNK@,$SDK_LNK,;t t
+s,@SDK_BIN_DIR@,$SDK_BIN_DIR,;t t
+s,@SDK_LIB_DIR@,$SDK_LIB_DIR,;t t
+s,@SDK_INCLUDE_DIR@,$SDK_INCLUDE_DIR,;t t
+s,@JRE_BIN_DIR@,$JRE_BIN_DIR,;t t
+s,@JRE_LIB_DIR@,$JRE_LIB_DIR,;t t
+s,@GCJ_BIN_DIR@,$GCJ_BIN_DIR,;t t
+s,@CPU@,$CPU,;t t
+s,@OS@,$OS,;t t
+s,@LIBDIR@,$LIBDIR,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 9d86cd831fb..6b7949f689f 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -1416,6 +1416,7 @@ case $multi_os_directory in
;;
esac
AC_SUBST(dbexecdir)
+AC_SUBST(gcjsubdir)
AC_DEFINE(JV_VERSION, "1.5.0", [Compatibility version string])
AC_DEFINE(JV_API_VERSION, "1.5", [API compatibility version string])
@@ -1628,6 +1629,207 @@ AC_SUBST(here)
# We get this from the environment.
AC_SUBST(GCJFLAGS)
+AC_ARG_WITH([python-dir],
+ AS_HELP_STRING([--with-python-dir],
+ [the location to install Python modules. This path should NOT include the prefix.]),
+ [with_python_dir=$withval], [with_python_dir=""])
+
+if test "x${with_python_dir}" = "x"
+then
+ # Needed for installing Python modules during make install.
+ python_mod_dir="\${prefix}/share/python"
+ # Needed for substituting into aot-compile*
+ python_mod_dir_expanded="${prefix}/share/python"
+else
+ python_mod_dir="\${prefix}${with_python_dir}"
+ python_mod_dir_expanded="${prefix}${with_python_dir}"
+fi
+AC_MSG_RESULT(Python modules dir: ${python_mod_dir_expanded});
+AC_SUBST(python_mod_dir)
+AC_SUBST(python_mod_dir_expanded)
+
+# needed for aot-compile-rpm
+MAKE=`which make`
+AC_SUBST(MAKE)
+
+AC_ARG_ENABLE([aot-compile-rpm],
+ [AS_HELP_STRING([--enable-aot-compile-rpm],
+ [enable installation of aot-compile-rpm [default=no]])],
+ [case "${enableval}" in
+ yes) AOT_RPM_ENABLED=yes ;;
+ no) AOT_RPM_ENABLED=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable aot-compile-rpm]) ;;
+ esac],
+ [AOT_RPM_ENABLED=no]
+)
+AM_CONDITIONAL(INSTALL_AOT_RPM, test "x${AOT_RPM_ENABLED}" == xyes)
+
+AC_ARG_ENABLE([java-home],
+ [AS_HELP_STRING([--enable-java-home],
+ [create a standard JDK-style directory layout in the install tree [default=no]])],
+ [case "${enableval}" in
+ yes) JAVA_HOME_ENABLED=yes ;;
+ no) JAVA_HOME_ENABLED=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable java-home]) ;;
+ esac],
+ [JAVA_HOME_ENABLED=no]
+)
+AM_CONDITIONAL(CREATE_JAVA_HOME, test "x${JAVA_HOME_ENABLED}" == xyes)
+
+# Only do these checks if java-home above is enabled.
+if test "x${JAVA_HOME_ENABLED}" == xyes
+then
+
+ AC_ARG_WITH([gcc-suffix],
+ AS_HELP_STRING([--with-gcc-suffix],
+ [the GCC tool suffix (defaults to empty string)]),
+ [gcc_suffix=$withval], [gcc_suffix=""])
+ AC_MSG_RESULT(GCC suffix: ${gcc_suffix})
+ AC_SUBST(gcc_suffix)
+
+ AC_ARG_WITH([arch-directory],
+ AS_HELP_STRING([--with-arch-directory],
+ [the arch directory under jre/lib (defaults to auto-detect)]),
+ [host_cpu=$withval], [host_cpu=""])
+
+ AC_ARG_WITH([os-directory],
+ AS_HELP_STRING([--with-os-directory],
+ [the os directory under include (defaults to auto-detect)]),
+ [host_os=$withval], [host_os=""])
+
+ AC_ARG_WITH([origin-name],
+ AS_HELP_STRING([--with-origin-name],
+ [the JPackage origin name of this package (default is gcj${gcc_suffix}]),
+ [origin_name=$withval], [origin_name=gcj${gcc_suffix}])
+ AC_MSG_RESULT(JPackage origin name: ${origin_name})
+
+ AC_ARG_WITH([arch-suffix],
+ AS_HELP_STRING([--with-arch-suffix],
+ [the arch directory suffix (default is the empty string]),
+ [arch_suffix=$withval], [arch_suffix=""])
+ AC_MSG_RESULT(arch suffix: ${arch_suffix})
+
+ AC_ARG_WITH([jvm-root-dir],
+ AS_HELP_STRING([--with-jvm-root-dir],
+ [where to install SDK (default is ${prefix}/lib/jvm)]),
+ [jvm_root_dir=$withval], [jvm_root_dir="\${prefix}/lib/jvm"])
+ AC_MSG_RESULT(JVM root installation directory: ${jvm_root_dir})
+
+ AC_ARG_WITH([jvm-jar-dir],
+ AS_HELP_STRING([--with-jvm-jar-dir],
+ [where to install jars (default is ${prefix}/lib/jvm-exports)]),
+ [jvm_jar_dir=$withval], [jvm_jar_dir=\${prefix}/lib/jvm-exports])
+ AC_MSG_RESULT(JAR root installation directory: ${jvm_jar_dir})
+
+ JAVA_VERSION=1.5.0
+ BUILD_VERSION=0
+ AC_SUBST(JAVA_VERSION)
+ AC_SUBST(BUILD_VERSION)
+ AC_MSG_RESULT(Java version: ${JAVA_VERSION})
+
+ jre_dir=java-${JAVA_VERSION}-${origin_name}-${JAVA_VERSION}.${BUILD_VERSION}${arch_suffix}/jre
+ sdk_dir=java-${JAVA_VERSION}-${origin_name}-${JAVA_VERSION}.${BUILD_VERSION}${arch_suffix}
+ jre_lnk=jre-${JAVA_VERSION}-${origin_name}
+ sdk_lnk=java-${JAVA_VERSION}-${origin_name}
+
+ JVM_ROOT_DIR=${jvm_root_dir}
+ AC_SUBST(JVM_ROOT_DIR)
+ AC_MSG_RESULT(JVM ROOT directory: ${JVM_ROOT_DIR})
+
+ JVM_JAR_ROOT_DIR=${jvm_jar_dir}
+ AC_SUBST(JVM_JAR_ROOT_DIR)
+ AC_MSG_RESULT(JVM JAR ROOT directory: ${JVM_JAR_ROOT_DIR})
+
+ JVM_JAR_DIR=${jvm_jar_dir}/${sdk_dir}
+ AC_SUBST(JVM_JAR_DIR)
+ AC_MSG_RESULT(JVM JAR directory: ${JVM_JAR_DIR})
+
+ JRE_DIR=${jre_dir}
+ AC_SUBST(JRE_DIR)
+
+ SDK_DIR=${sdk_dir}
+ AC_SUBST(SDK_DIR)
+
+ JRE_LNK=${jre_lnk}
+ AC_SUBST(JRE_LNK)
+
+ SDK_LNK=${sdk_lnk}
+ AC_SUBST(SDK_LNK)
+
+ SDK_BIN_DIR=${jvm_root_dir}/${sdk_dir}/bin
+ AC_SUBST(SDK_BIN_DIR)
+ AC_MSG_RESULT(SDK tools directory: ${SDK_BIN_DIR})
+
+ SDK_LIB_DIR=${jvm_root_dir}/${sdk_dir}/lib
+ AC_SUBST(SDK_LIB_DIR)
+ AC_MSG_RESULT(SDK jar directory: ${SDK_LIB_DIR})
+
+ SDK_INCLUDE_DIR=${jvm_root_dir}/${sdk_dir}/include
+ AC_SUBST(SDK_INCLUDE_DIR)
+ AC_MSG_RESULT(SDK include directory: ${SDK_INCLUDE_DIR})
+
+ JRE_BIN_DIR=${jvm_root_dir}/${jre_dir}/bin
+ AC_SUBST(JRE_BIN_DIR)
+ AC_MSG_RESULT(JRE tools directory: ${JRE_BIN_DIR})
+
+ JRE_LIB_DIR=${jvm_root_dir}/${jre_dir}/lib
+ AC_SUBST(JRE_LIB_DIR)
+ AC_MSG_RESULT(JRE lib directory: ${JRE_LIB_DIR})
+
+ # Find gcj prefix using gcj found in PATH.
+ gcj_prefix=`which gcj${gcc_suffix} | sed "s%/bin/gcj${gcc_suffix}%%"`
+
+ # Where do the gcj binaries live?
+ # For jhbuild based builds, they all live in a sibling of bin called
+ # gcj-bin. Check for gcj-bin first, and use bin otherwise.
+ GCJ_BIN_DIR=`if test -d ${gcj_prefix}/gcj-bin; then echo ${gcj_prefix}/gcj-bin; else echo ${gcj_prefix}/bin; fi`
+ AC_SUBST(GCJ_BIN_DIR)
+ AC_MSG_RESULT(GCJ tools directory: ${GCJ_BIN_DIR})
+
+ echo host is ${host}
+ if test "x${host_cpu}" = "x"
+ then
+ case ${host} in
+ *-mingw* | *-cygwin*)
+ host_cpu=x86;;
+ i486-* | i586-* | i686-*)
+ host_cpu=i386;;
+ *)
+ host_cpu=${host_cpu};;
+ esac
+ fi
+ AC_MSG_RESULT(arch directory: ${host_cpu})
+ CPU=${host_cpu}
+ AC_SUBST(CPU)
+
+ if test "x${host_os}" = "x"
+ then
+ case ${host} in
+ *-mingw* | *-cygwin*)
+ host_os=win32;;
+ *-linux*)
+ host_os=linux;;
+ *)
+ host_os=${host_os};;
+ esac
+ fi
+ echo os directory: ${host_os}
+ OS=${host_os}
+ AC_SUBST(OS)
+
+ # make an expanded $libdir, for substituting into
+ # scripts (and other non-Makefile things).
+ LIBDIR=$libdir
+ if test "x${exec_prefix}" = "xNONE"
+ then
+ lib_exec_prefix=$prefix
+ else
+ lib_exec_prefix=$exec_prefix
+ fi
+ LIBDIR=`echo $libdir | sed "s:\\\${exec_prefix}:$lib_exec_prefix:g"`
+ AC_SUBST(LIBDIR)
+fi
+
AC_CONFIG_FILES([
Makefile
libgcj.pc
@@ -1636,6 +1838,10 @@ libgcj-test.spec
gcj/Makefile
include/Makefile
testsuite/Makefile
+contrib/aotcompile.py
+contrib/aot-compile
+contrib/aot-compile-rpm
+contrib/rebuild-gcj-db
])
if test ${multilib} = yes; then
diff --git a/libjava/contrib/aot-compile-rpm.in b/libjava/contrib/aot-compile-rpm.in
new file mode 100644
index 00000000000..c3bdb165096
--- /dev/null
+++ b/libjava/contrib/aot-compile-rpm.in
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+
+## Copyright (C) 2005, 2006, 2007 Free Software Foundation
+## Written by Gary Benson <gbenson@redhat.com>
+##
+## This program 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 of the License, or
+## (at your option) any later version.
+##
+## This program 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.
+
+import sys
+sys.path.append("@python_mod_dir_expanded@")
+import aotcompile
+import os
+
+def libdir():
+ cmd = "%s -p" % aotcompile.PATHS["dbtool"]
+ dir = os.path.abspath(os.popen(cmd, "r").readline().rstrip())
+ dir, base = os.path.split(dir)
+ if base != "classmap.db":
+ raise aotcompile.Error, "%s: unexpected output" % cmd
+ dir, base = os.path.split(dir)
+ if not base.startswith("gcj-"):
+ raise aotcompile.Error, "%s: unexpected output" % cmd
+ return dir
+
+def writeSourceList(srcdir, dstpath):
+ def visit(fp, dir, items):
+ for item in items:
+ path = os.path.join(dir, item)
+ if os.path.isfile(path):
+ print >>fp, path
+ dstdir = os.path.dirname(dstpath)
+ if not os.path.isdir(dstdir):
+ os.makedirs(dstdir)
+ os.path.walk(srcdir, visit, open(dstpath, "w"))
+
+def copy(srcdir, dstdir, suffix):
+ srcdir = os.path.join(srcdir, suffix.lstrip(os.sep))
+ dstdir = os.path.join(dstdir, suffix.lstrip(os.sep))
+ os.makedirs(os.path.dirname(dstdir))
+ aotcompile.system(("/bin/cp", "-a", srcdir, dstdir))
+
+try:
+ name = os.environ.get("RPM_PACKAGE_NAME")
+ if name is None:
+ raise aotcompile.Error, "not for use outside rpm specfiles"
+ arch = os.environ.get("RPM_ARCH")
+ if arch == "noarch":
+ raise aotcompile.Error, "cannot be used on noarch packages"
+ srcdir = os.environ.get("RPM_BUILD_ROOT")
+ if srcdir in (None, "/"):
+ raise aotcompile.Error, "bad $RPM_BUILD_ROOT"
+ tmpdir = os.path.join(os.getcwd(), "aot-compile-rpm")
+ if os.path.exists(tmpdir):
+ raise aotcompile.Error, "%s exists" % tmpdir
+ dstdir = os.path.join(libdir(), "gcj", name)
+
+ compiler = aotcompile.Compiler(srcdir, dstdir, tmpdir)
+ compiler.gcjflags[0:0] = os.environ.get("RPM_OPT_FLAGS", "").split()
+
+ # XXX: This script should not accept options, because having
+ # them it cannot be integrated into rpm. But, gcj cannot
+ # build each and every jarfile yet, so we must be able to
+ # exclude until it can.
+ # XXX --exclude is also used in the jonas rpm to stop
+ # everything being made a subset of the mammoth client
+ # jarfile. Should adjust the subset checker's bias to
+ # favour many small jarfiles over one big one.
+ try:
+ options, exclusions = sys.argv[1:], []
+ while options:
+ if options.pop(0) != "--exclude":
+ raise ValueError
+ compiler.exclusions.append(
+ os.path.join(srcdir, options.pop(0).lstrip(os.sep)))
+ except:
+ print >>sys.stderr, "usage: %s [--exclude PATH]..." % (
+ os.path.basename(sys.argv[0]))
+ sys.exit(1)
+
+ sourcelist = os.path.join(tmpdir, "sources.list")
+ writeSourceList(os.getcwd(), sourcelist)
+ compiler.gcjflags.append("-fsource-filename=" + sourcelist)
+
+ compiler.compile()
+ copy(tmpdir, srcdir, dstdir)
+
+except aotcompile.Error, e:
+ print >>sys.stderr, "%s: error: %s" % (
+ os.path.basename(sys.argv[0]), e)
+ sys.exit(1)
diff --git a/libjava/contrib/aot-compile.in b/libjava/contrib/aot-compile.in
new file mode 100644
index 00000000000..b891f20b85f
--- /dev/null
+++ b/libjava/contrib/aot-compile.in
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+
+## Copyright (C) 2006 Free Software Foundation
+## Written by Gary Benson <gbenson@redhat.com>
+##
+## This program 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 of the License, or
+## (at your option) any later version.
+##
+## This program 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.
+
+import sys
+sys.path.append("@python_mod_dir_expanded@")
+import aotcompile
+import getopt
+import os
+
+usage = """\
+Usage: %s [OPTION...] SRCDIR DSTDIR
+AOT-compile all Java bytecode in SRCDIR into DSTDIR.
+
+Options:
+ -M, --make=PATH make executable to use (%s)
+ -C, --gcj=PATH gcj executable to use (%s)
+ -D, --dbtool=PATH gcj-dbtool executable to use (%s)
+ -m, --makeflags=FLAGS flags to pass to make during build
+ -c, --gcjflags=FLAGS flags to pass to gcj during compilation
+ in addition to %s
+ -l, --ldflags=FLAGS flags to pass to gcj during linking
+ in addition to %s
+ -e, --exclude=PATH do not compile PATH
+
+Extra flags may also be passed using the AOT_MAKEFLAGS, AOT_GCJFLAGS
+and AOT_LDFLAGS environment variables.""" % (
+ os.path.basename(sys.argv[0]),
+ aotcompile.PATHS["make"],
+ aotcompile.PATHS["gcj"],
+ aotcompile.PATHS["dbtool"],
+ repr(" ".join(aotcompile.GCJFLAGS)),
+ repr(" ".join(aotcompile.LDFLAGS)))
+
+try:
+ if os.environ.has_key("RPM_PACKAGE_NAME"):
+ raise aotcompile.Error, "not for use within rpm specfiles"
+
+ try:
+ opts, args = getopt.getopt(
+ sys.argv[1:],
+ "M:C:D:m:c:l:e:",
+ ["make=", "gcj=", "dbtool=",
+ "makeflags=" "gcjflags=", "ldflags=",
+ "exclude="])
+ srcdir, dstdir = args
+ except:
+ print >>sys.stderr, usage
+ sys.exit(1)
+
+ compiler = aotcompile.Compiler(srcdir, dstdir)
+ for o, a in opts:
+ if o in ("-M", "--make"):
+ aotcompile.PATHS["make"] = a
+ if o in ("-C", "--gcj"):
+ aotcompile.PATHS["gcj"] = a
+ if o in ("-D", "--dbtool"):
+ aotcompile.PATHS["dbtool"] = a
+ if o in ("-m", "--makeflags"):
+ compiler.makeflags[0:0] = a.split()
+ if o in ("-c", "--gcjflags"):
+ compiler.gcjflags[0:0] = a.split()
+ if o in ("-l", "--ldflags"):
+ compiler.ldflags[0:0] = a.split()
+ if o in ("-e", "--exclude"):
+ compiler.exclusions.append(a)
+
+ compiler.makeflags[0:0] = os.environ.get("AOT_MAKEFLAGS", "").split()
+ compiler.gcjflags[0:0] = os.environ.get("AOT_GCJFLAGS", "").split()
+ compiler.ldflags[0:0] = os.environ.get("AOT_LDFLAGS", "").split()
+
+ compiler.compile()
+
+except aotcompile.Error, e:
+ print >>sys.stderr, "%s: error: %s" % (
+ os.path.basename(sys.argv[0]), e)
+ sys.exit(1)
diff --git a/libjava/contrib/aotcompile.py.in b/libjava/contrib/aotcompile.py.in
new file mode 100644
index 00000000000..9e25c9061a1
--- /dev/null
+++ b/libjava/contrib/aotcompile.py.in
@@ -0,0 +1,412 @@
+# -*- python -*-
+
+## Copyright (C) 2005, 2006, 2008 Free Software Foundation
+## Written by Gary Benson <gbenson@redhat.com>
+##
+## This program 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 of the License, or
+## (at your option) any later version.
+##
+## This program 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.
+
+import classfile
+import copy
+import md5
+import operator
+import os
+import sys
+import cStringIO as StringIO
+import zipfile
+
+PATHS = {"make": "@MAKE@",
+ "gcj": "@prefix@/bin/gcj@gcc_suffix@",
+ "dbtool": "@prefix@/bin/gcj-dbtool@gcc_suffix@"}
+
+MAKEFLAGS = []
+GCJFLAGS = ["-fPIC", "-findirect-dispatch", "-fjni"]
+LDFLAGS = ["-Wl,-Bsymbolic"]
+
+MAX_CLASSES_PER_JAR = 1024
+MAX_BYTES_PER_JAR = 1048576
+
+MAKEFILE = "Makefile"
+
+MAKEFILE_HEADER = '''\
+GCJ = %(gcj)s
+DBTOOL = %(dbtool)s
+GCJFLAGS = %(gcjflags)s
+LDFLAGS = %(ldflags)s
+
+%%.o: %%.jar
+ $(GCJ) -c $(GCJFLAGS) $< -o $@
+
+TARGETS = \\
+%(targets)s
+
+all: $(TARGETS)'''
+
+MAKEFILE_JOB = '''
+%(base)s_SOURCES = \\
+%(jars)s
+
+%(base)s_OBJECTS = \\
+$(%(base)s_SOURCES:.jar=.o)
+
+%(dso)s: $(%(base)s_OBJECTS)
+ $(GCJ) -shared $(GCJFLAGS) $(LDFLAGS) $^ -o $@
+
+%(db)s: $(%(base)s_SOURCES)
+ $(DBTOOL) -n $@ 64
+ for jar in $^; do \\
+ $(DBTOOL) -f $@ $$jar \\
+ %(libdir)s/%(dso)s; \\
+ done'''
+
+ZIPMAGIC, CLASSMAGIC = "PK\x03\x04", "\xca\xfe\xba\xbe"
+
+class Error(Exception):
+ pass
+
+class Compiler:
+ def __init__(self, srcdir, libdir, prefix = None):
+ self.srcdir = os.path.abspath(srcdir)
+ self.libdir = os.path.abspath(libdir)
+ if prefix is None:
+ self.dstdir = self.libdir
+ else:
+ self.dstdir = os.path.join(prefix, self.libdir.lstrip(os.sep))
+
+ # Calling code may modify these parameters
+ self.gcjflags = copy.copy(GCJFLAGS)
+ self.ldflags = copy.copy(LDFLAGS)
+ self.makeflags = copy.copy(MAKEFLAGS)
+ self.exclusions = []
+
+ def compile(self):
+ """Search srcdir for classes and jarfiles, then generate
+ solibs and mappings databases for them all in libdir."""
+ if not os.path.isdir(self.dstdir):
+ os.makedirs(self.dstdir)
+ oldcwd = os.getcwd()
+ os.chdir(self.dstdir)
+ try:
+ jobs = self.getJobList()
+ if not jobs:
+ raise Error, "nothing to do"
+ self.writeMakefile(MAKEFILE, jobs)
+ for job in jobs:
+ job.writeJars()
+ system([PATHS["make"]] + self.makeflags)
+ for job in jobs:
+ job.clean()
+ os.unlink(MAKEFILE)
+ finally:
+ os.chdir(oldcwd)
+
+ def getJobList(self):
+ """Return all jarfiles and class collections in srcdir."""
+ jobs = weed_jobs(find_jobs(self.srcdir, self.exclusions))
+ set_basenames(jobs)
+ return jobs
+
+ def writeMakefile(self, path, jobs):
+ """Generate a makefile to build the solibs and mappings
+ databases for the specified list of jobs."""
+ fp = open(path, "w")
+ print >>fp, MAKEFILE_HEADER % {
+ "gcj": PATHS["gcj"],
+ "dbtool": PATHS["dbtool"],
+ "gcjflags": " ".join(self.gcjflags),
+ "ldflags": " ".join(self.ldflags),
+ "targets": " \\\n".join(reduce(operator.add, [
+ (job.dsoName(), job.dbName()) for job in jobs]))}
+ for job in jobs:
+ values = job.ruleArguments()
+ values["libdir"] = self.libdir
+ print >>fp, MAKEFILE_JOB % values
+ fp.close()
+
+def find_jobs(dir, exclusions = ()):
+ """Scan a directory and find things to compile: jarfiles (zips,
+ wars, ears, rars, etc: we go by magic rather than file extension)
+ and directories of classes."""
+ def visit((classes, zips), dir, items):
+ for item in items:
+ path = os.path.join(dir, item)
+ if os.path.islink(path) or not os.path.isfile(path):
+ continue
+ magic = open(path, "r").read(4)
+ if magic == ZIPMAGIC:
+ zips.append(path)
+ elif magic == CLASSMAGIC:
+ classes.append(path)
+ classes, paths = [], []
+ os.path.walk(dir, visit, (classes, paths))
+ # Convert the list of classes into a list of directories
+ while classes:
+ # XXX this requires the class to be correctly located in its heirachy.
+ path = classes[0][:-len(os.sep + classname(classes[0]) + ".class")]
+ paths.append(path)
+ classes = [cls for cls in classes if not cls.startswith(path)]
+ # Handle exclusions. We're really strict about them because the
+ # option is temporary in aot-compile-rpm and dead options left in
+ # specfiles will hinder its removal.
+ for path in exclusions:
+ if path in paths:
+ paths.remove(path)
+ else:
+ raise Error, "%s: path does not exist or is not a job" % path
+ # Build the list of jobs
+ jobs = []
+ paths.sort()
+ for path in paths:
+ if os.path.isfile(path):
+ job = JarJob(path)
+ else:
+ job = DirJob(path)
+ if len(job.classes):
+ jobs.append(job)
+ return jobs
+
+class Job:
+ """A collection of classes that will be compiled as a unit."""
+
+ def __init__(self, path):
+ self.path, self.classes, self.blocks = path, {}, None
+
+ def addClass(self, bytes):
+ """Subclasses call this from their __init__ method for
+ every class they find."""
+ self.classes[md5.new(bytes).digest()] = bytes
+
+ def __makeBlocks(self):
+ """Split self.classes into chunks that can be compiled to
+ native code by gcj. In the majority of cases this is not
+ necessary -- the job will have come from a jarfile which will
+ be equivalent to the one we generate -- but this only happens
+ _if_ the job was a jarfile and _if_ the jarfile isn't too big
+ and _if_ the jarfile has the correct extension and _if_ all
+ classes are correctly named and _if_ the jarfile has no
+ embedded jarfiles. Fitting a special case around all these
+ conditions is tricky to say the least.
+
+ Note that this could be called at the end of each subclass's
+ __init__ method. The reason this is not done is because we
+ need to parse every class file. This is slow, and unnecessary
+ if the job is subsetted."""
+ names = {}
+ for hash, bytes in self.classes.items():
+ name = classname(bytes)
+ if not names.has_key(name):
+ names[name] = []
+ names[name].append(hash)
+ names = names.items()
+ # We have to sort somehow, or the jars we generate
+ # We sort by name in a simplistic attempt to keep related
+ # classes together so inter-class optimisation can happen.
+ names.sort()
+ self.blocks, bytes = [[]], 0
+ for name, hashes in names:
+ for hash in hashes:
+ if len(self.blocks[-1]) >= MAX_CLASSES_PER_JAR \
+ or bytes >= MAX_BYTES_PER_JAR:
+ self.blocks.append([])
+ bytes = 0
+ self.blocks[-1].append((name, hash))
+ bytes += len(self.classes[hash])
+
+ # From Archit Shah:
+ # The implementation and the documentation don't seem to match.
+ #
+ # [a, b].isSubsetOf([a]) => True
+ #
+ # Identical copies of all classes this collection do not exist
+ # in the other. I think the method should be named isSupersetOf
+ # and the documentation should swap uses of "this" and "other"
+ #
+ # XXX think about this when I've had more sleep...
+ def isSubsetOf(self, other):
+ """Returns True if identical copies of all classes in this
+ collection exist in the other."""
+ for item in other.classes.keys():
+ if not self.classes.has_key(item):
+ return False
+ return True
+
+ def __targetName(self, ext):
+ return self.basename + ext
+
+ def tempJarName(self, num):
+ return self.__targetName(".%d.jar" % (num + 1))
+
+ def tempObjName(self, num):
+ return self.__targetName(".%d.o" % (num + 1))
+
+ def dsoName(self):
+ """Return the filename of the shared library that will be
+ built from this job."""
+ return self.__targetName(".so")
+
+ def dbName(self):
+ """Return the filename of the mapping database that will be
+ built from this job."""
+ return self.__targetName(".db")
+
+ def ruleArguments(self):
+ """Return a dictionary of values that when substituted
+ into MAKEFILE_JOB will create the rules required to build
+ the shared library and mapping database for this job."""
+ if self.blocks is None:
+ self.__makeBlocks()
+ return {
+ "base": "".join(
+ [c.isalnum() and c or "_" for c in self.dsoName()]),
+ "jars": " \\\n".join(
+ [self.tempJarName(i) for i in xrange(len(self.blocks))]),
+ "dso": self.dsoName(),
+ "db": self.dbName()}
+
+ def writeJars(self):
+ """Generate jarfiles that can be native compiled by gcj."""
+ if self.blocks is None:
+ self.__makeBlocks()
+ for block, i in zip(self.blocks, xrange(len(self.blocks))):
+ jar = zipfile.ZipFile(self.tempJarName(i), "w", zipfile.ZIP_STORED)
+ for name, hash in block:
+ jar.writestr(
+ zipfile.ZipInfo("%s.class" % name), self.classes[hash])
+ jar.close()
+
+ def clean(self):
+ """Delete all temporary files created during this job's build."""
+ if self.blocks is None:
+ self.__makeBlocks()
+ for i in xrange(len(self.blocks)):
+ os.unlink(self.tempJarName(i))
+ os.unlink(self.tempObjName(i))
+
+class JarJob(Job):
+ """A Job whose origin was a jarfile."""
+
+ def __init__(self, path):
+ Job.__init__(self, path)
+ self._walk(zipfile.ZipFile(path, "r"))
+
+ def _walk(self, zf):
+ for name in zf.namelist():
+ bytes = zf.read(name)
+ if bytes.startswith(ZIPMAGIC):
+ self._walk(zipfile.ZipFile(StringIO.StringIO(bytes)))
+ elif bytes.startswith(CLASSMAGIC):
+ self.addClass(bytes)
+
+class DirJob(Job):
+ """A Job whose origin was a directory of classfiles."""
+
+ def __init__(self, path):
+ Job.__init__(self, path)
+ os.path.walk(path, DirJob._visit, self)
+
+ def _visit(self, dir, items):
+ for item in items:
+ path = os.path.join(dir, item)
+ if os.path.islink(path) or not os.path.isfile(path):
+ continue
+ fp = open(path, "r")
+ magic = fp.read(4)
+ if magic == CLASSMAGIC:
+ self.addClass(magic + fp.read())
+
+def weed_jobs(jobs):
+ """Remove any jarfiles that are completely contained within
+ another. This is more common than you'd think, and we only
+ need one nativified copy of each class after all."""
+ jobs = copy.copy(jobs)
+ while True:
+ for job1 in jobs:
+ for job2 in jobs:
+ if job1 is job2:
+ continue
+ if job1.isSubsetOf(job2):
+ msg = "subsetted %s" % job2.path
+ if job2.isSubsetOf(job1):
+ if (isinstance(job1, DirJob) and
+ isinstance(job2, JarJob)):
+ # In the braindead case where a package
+ # contains an expanded copy of a jarfile
+ # the jarfile takes precedence.
+ continue
+ msg += " (identical)"
+ warn(msg)
+ jobs.remove(job2)
+ break
+ else:
+ continue
+ break
+ else:
+ break
+ continue
+ return jobs
+
+def set_basenames(jobs):
+ """Ensure that each jarfile has a different basename."""
+ names = {}
+ for job in jobs:
+ name = os.path.basename(job.path)
+ if not names.has_key(name):
+ names[name] = []
+ names[name].append(job)
+ for name, set in names.items():
+ if len(set) == 1:
+ set[0].basename = name
+ continue
+ # prefix the jar filenames to make them unique
+ # XXX will not work in most cases -- needs generalising
+ set = [(job.path.split(os.sep), job) for job in set]
+ minlen = min([len(bits) for bits, job in set])
+ set = [(bits[-minlen:], job) for bits, job in set]
+ bits = apply(zip, [bits for bits, job in set])
+ while True:
+ row = bits[-2]
+ for bit in row[1:]:
+ if bit != row[0]:
+ break
+ else:
+ del bits[-2]
+ continue
+ break
+ set = zip(
+ ["_".join(name) for name in apply(zip, bits[-2:])],
+ [job for bits, job in set])
+ for name, job in set:
+ warn("building %s as %s" % (job.path, name))
+ job.basename = name
+ # XXX keep this check until we're properly general
+ names = {}
+ for job in jobs:
+ name = job.basename
+ if names.has_key(name):
+ raise Error, "%s: duplicate jobname" % name
+ names[name] = 1
+
+def system(command):
+ """Execute a command."""
+ status = os.spawnv(os.P_WAIT, command[0], command)
+ if status > 0:
+ raise Error, "%s exited with code %d" % (command[0], status)
+ elif status < 0:
+ raise Error, "%s killed by signal %d" % (command[0], -status)
+
+def warn(msg):
+ """Print a warning message."""
+ print >>sys.stderr, "%s: warning: %s" % (
+ os.path.basename(sys.argv[0]), msg)
+
+def classname(bytes):
+ """Extract the class name from the bytes of a class file."""
+ klass = classfile.Class(bytes)
+ return klass.constants[klass.constants[klass.name][1]][1]
diff --git a/libjava/contrib/classfile.py b/libjava/contrib/classfile.py
new file mode 100644
index 00000000000..a8bb14c0b8f
--- /dev/null
+++ b/libjava/contrib/classfile.py
@@ -0,0 +1,221 @@
+## Copyright (C) 2004, 2005 Free Software Foundation
+## Written by Gary Benson <gbenson@redhat.com>
+##
+## This program 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 of the License, or
+## (at your option) any later version.
+##
+## This program 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.
+
+"""Read Java(TM) class files."""
+
+import cStringIO as StringIO
+import struct
+
+class Class:
+ def __init__(self, arg):
+ if hasattr(arg, "read"):
+ self.fp = arg
+ elif type(arg) == type(""):
+ if arg.startswith("\xca\xfe\xba\xbe"):
+ self.fp = StringIO.StringIO(arg)
+ else:
+ self.fp = open(arg, "r")
+ else:
+ raise TypeError, type(arg)
+
+ magic = self._read_int()
+ assert magic == 0xcafebabeL
+ minor, major = self._read(">HH")
+ self.version = (major, minor)
+
+ self.pool_integrity_checks = None
+ try:
+ assert False
+ except AssertionError:
+ self.pool_integrity_checks = []
+
+ self._read_constants_pool()
+
+ self.access_flags = self._read_short()
+ self.name = self._read_reference_Class()
+ self.super = self._read_reference_Class()
+
+ self.interfaces = self._read_interfaces()
+ self.fields = self._read_fieldsormethods()
+ self.methods = self._read_fieldsormethods()
+ self.attributes = self._read_attributes()
+
+ if self.pool_integrity_checks is not None:
+ for index, tag in self.pool_integrity_checks:
+ assert self.constants[index][0] == tag
+
+ del self.fp, self.pool_integrity_checks
+
+ def __repr__(self):
+ result = []
+ attrs = [attr for attr in dir(self)
+ if not attr.startswith("_") and attr != "Member"]
+ attrs.sort()
+ for attr in attrs:
+ result.append("%-13s %s" % (
+ attr + ":", attr == "constants" and
+ "<ELIDED>" or repr(getattr(self, attr))))
+ return "\n".join(result)
+
+ def _read_constants_pool(self):
+ self.constants = {}
+ skip = False
+ for i in xrange(1, self._read_short()):
+ if skip:
+ skip = False
+ continue
+ tag = {
+ 1: "Utf8", 3: "Integer", 4: "Float", 5: "Long",
+ 6: "Double", 7: "Class", 8: "String", 9: "Fieldref",
+ 10: "Methodref", 11: "InterfaceMethodref",
+ 12: "NameAndType"}[self._read_byte()]
+ skip = tag in ("Long", "Double") # crack crack crack!
+ self.constants[i] = (tag, getattr(self, "_read_constant_" + tag)())
+
+ def _read_interfaces(self):
+ result = []
+ for i in xrange(self._read_short()):
+ result.append(self._read_reference_Class())
+ return result
+
+ def _read_fieldsormethods(self):
+ result = []
+ for i in xrange(self._read_short()):
+ result.append(self.Member(self))
+ return result
+
+ class Member:
+ def __init__(self, source):
+ self.access_flags = source._read_short()
+ self.name = source._read_reference_Utf8()
+ self.descriptor = source._read_reference_Utf8()
+ self.attributes = source._read_attributes()
+
+ def __repr__(self):
+ result = []
+ attrs = [attr for attr in dir(self) if not attr.startswith("_")]
+ attrs.sort()
+ for attr in attrs:
+ value = getattr(self, attr)
+ if attr == "attributes" and value.has_key("Code"):
+ value = value.copy()
+ value.update({"Code": "<ELIDED>"})
+ result.append("%-13s %s" % (
+ attr + ":", repr(value).replace(
+ "'Code': '<ELIDED>'", "'Code': <ELIDED>")))
+ return ("\n%s" % (15 * " ")).join(result)
+
+ def _read_attributes(self):
+ result = {}
+ for i in xrange(self._read_short()):
+ name = self._read_reference_Utf8()
+ data = self.fp.read(self._read_int())
+ assert not result.has_key(name)
+ result[name] = data
+ return result
+
+ # Constants pool reference reader convenience functions
+
+ def _read_reference_Utf8(self):
+ return self._read_references("Utf8")[0]
+
+ def _read_reference_Class(self):
+ return self._read_references("Class")[0]
+
+ def _read_reference_Class_NameAndType(self):
+ return self._read_references("Class", "NameAndType")
+
+ def _read_references(self, *args):
+ result = []
+ for arg in args:
+ index = self._read_short()
+ if self.pool_integrity_checks is not None:
+ self.pool_integrity_checks.append((index, arg))
+ result.append(index)
+ return result
+
+ # Constants pool constant reader functions
+
+ def _read_constant_Utf8(self):
+ constant = self.fp.read(self._read_short())
+ try:
+ constant = constant.decode("utf-8")
+ except UnicodeError:
+ constant = _bork_utf8_decode(constant)
+ try:
+ constant = constant.encode("us-ascii")
+ except UnicodeError:
+ pass
+ return constant
+
+ def _read_constant_Integer(self):
+ return self._read_int()
+
+ def _read_constant_Float(self):
+ return self._read(">f")[0]
+
+ def _read_constant_Long(self):
+ return self._read(">q")[0]
+
+ def _read_constant_Double(self):
+ return self._read(">d")[0]
+
+ _read_constant_Class = _read_reference_Utf8
+ _read_constant_String = _read_reference_Utf8
+ _read_constant_Fieldref = _read_reference_Class_NameAndType
+ _read_constant_Methodref = _read_reference_Class_NameAndType
+ _read_constant_InterfaceMethodref = _read_reference_Class_NameAndType
+
+ def _read_constant_NameAndType(self):
+ return self._read_reference_Utf8(), self._read_reference_Utf8()
+
+ # Generic reader functions
+
+ def _read_int(self):
+ # XXX how else to read 32 bits on a 64-bit box?
+ h, l = map(long, self._read(">HH"))
+ return (h << 16) + l
+
+ def _read_short(self):
+ return self._read(">H")[0]
+
+ def _read_byte(self):
+ return self._read("B")[0]
+
+ def _read(self, fmt):
+ return struct.unpack(fmt, self.fp.read(struct.calcsize(fmt)))
+
+def _bork_utf8_decode(data):
+ # more crack!
+ bytes, unicode = map(ord, data), ""
+ while bytes:
+ b1 = bytes.pop(0)
+ if b1 & 0x80:
+ assert b1 & 0x40
+ b2 = bytes.pop(0)
+ assert b2 & 0xC0 == 0x80
+ if b1 & 0x20:
+ assert not b1 & 0x10
+ b3 = bytes.pop(0)
+ assert b3 & 0xC0 == 0x80
+ unicode += unichr(
+ ((b1 & 0x0f) << 12) + ((b2 & 0x3f) << 6) + (b3 & 0x3f))
+ else:
+ unicode += unichr(((b1 & 0x1f) << 6) + (b2 & 0x3f))
+ else:
+ unicode += unichr(b1)
+ return unicode
+
+if __name__ == "__main__":
+ print Class("/usr/share/katana/build/ListDependentClasses.class")
+
diff --git a/libjava/contrib/rebuild-gcj-db.in b/libjava/contrib/rebuild-gcj-db.in
new file mode 100644
index 00000000000..39861ff55f9
--- /dev/null
+++ b/libjava/contrib/rebuild-gcj-db.in
@@ -0,0 +1,27 @@
+#!/bin/bash
+# rebuild-gcj-db
+
+## Copyright (C) 2000, 2002, 2003, 2008 Free Software Foundation
+##
+## This file is part of libgcj.
+##
+## This software is copyrighted work licensed under the terms of the
+## Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+## details.
+
+# Rebuild all the standard databases.
+for i in `@prefix@/bin/gcc --print-multi-lib 2>/dev/null`; do
+ multilib=`echo $i | sed -e 's/^.*;//' | sed -e 's/\@/ -/g'`
+ dirname=`@prefix@/bin/gcc -print-multi-os-directory $multilib 2>/dev/null`
+ base=@prefix@/lib/$dirname
+ dbLocation=`@prefix@/bin/gcj-dbtool -p $base`
+ libdir=$base/gcj
+ if ! test -d $libdir; then
+ # No shared libraries here.
+ continue
+ fi
+ dirname $dbLocation | xargs mkdir -p
+ @prefix@/bin/gcj-dbtool -n $dbLocation 64
+ find $libdir -follow -name '*.db' -print0 | \
+ @prefix@/bin/gcj-dbtool -0 -m $dbLocation $dbLocation
+done
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
index b5b98364c8d..3a1c18f4a76 100644
--- a/libjava/gcj/Makefile.in
+++ b/libjava/gcj/Makefile.in
@@ -99,6 +99,7 @@ AWK = @AWK@
BACKTRACESPEC = @BACKTRACESPEC@
BUILD_ECJ1_FALSE = @BUILD_ECJ1_FALSE@
BUILD_ECJ1_TRUE = @BUILD_ECJ1_TRUE@
+BUILD_VERSION = @BUILD_VERSION@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -106,6 +107,9 @@ CHECKREFSPEC = @CHECKREFSPEC@
CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPU = @CPU@
+CREATE_JAVA_HOME_FALSE = @CREATE_JAVA_HOME_FALSE@
+CREATE_JAVA_HOME_TRUE = @CREATE_JAVA_HOME_TRUE@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -135,6 +139,7 @@ GCJDEPMODE = @GCJDEPMODE@
GCJFLAGS = @GCJFLAGS@
GCJH = @GCJH@
GCJVERSION = @GCJVERSION@
+GCJ_BIN_DIR = @GCJ_BIN_DIR@
GCJ_FOR_ECJX = @GCJ_FOR_ECJX@
GCLIBS = @GCLIBS@
GCSPEC = @GCSPEC@
@@ -147,6 +152,8 @@ GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
INCLTDL = @INCLTDL@
+INSTALL_AOT_RPM_FALSE = @INSTALL_AOT_RPM_FALSE@
+INSTALL_AOT_RPM_TRUE = @INSTALL_AOT_RPM_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_ECJ_JAR_FALSE = @INSTALL_ECJ_JAR_FALSE@
INSTALL_ECJ_JAR_TRUE = @INSTALL_ECJ_JAR_TRUE@
@@ -162,13 +169,22 @@ JAVA_HOME_SET_FALSE = @JAVA_HOME_SET_FALSE@
JAVA_HOME_SET_TRUE = @JAVA_HOME_SET_TRUE@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
+JAVA_VERSION = @JAVA_VERSION@
JC1GCSPEC = @JC1GCSPEC@
+JRE_BIN_DIR = @JRE_BIN_DIR@
+JRE_DIR = @JRE_DIR@
+JRE_LIB_DIR = @JRE_LIB_DIR@
+JRE_LNK = @JRE_LNK@
+JVM_JAR_DIR = @JVM_JAR_DIR@
+JVM_JAR_ROOT_DIR = @JVM_JAR_ROOT_DIR@
+JVM_ROOT_DIR = @JVM_ROOT_DIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
LD_FINISH_STATIC_SPEC = @LD_FINISH_STATIC_SPEC@
LD_START_STATIC_SPEC = @LD_START_STATIC_SPEC@
LIBART_CFLAGS = @LIBART_CFLAGS@
LIBART_LIBS = @LIBART_LIBS@
+LIBDIR = @LIBDIR@
LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -191,6 +207,7 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
NATIVE_FALSE = @NATIVE_FALSE@
NATIVE_TRUE = @NATIVE_TRUE@
@@ -198,6 +215,7 @@ NEEDS_DATA_START_FALSE = @NEEDS_DATA_START_FALSE@
NEEDS_DATA_START_TRUE = @NEEDS_DATA_START_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
+OS = @OS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -209,6 +227,11 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PLATFORM = @PLATFORM@
RANLIB = @RANLIB@
+SDK_BIN_DIR = @SDK_BIN_DIR@
+SDK_DIR = @SDK_DIR@
+SDK_INCLUDE_DIR = @SDK_INCLUDE_DIR@
+SDK_LIB_DIR = @SDK_LIB_DIR@
+SDK_LNK = @SDK_LNK@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -296,6 +319,8 @@ exec_prefix = @exec_prefix@
extra_gij_ldflags = @extra_gij_ldflags@
extra_ldflags = @extra_ldflags@
extra_ldflags_libjava = @extra_ldflags_libjava@
+gcc_suffix = @gcc_suffix@
+gcjsubdir = @gcjsubdir@
gxx_include_dir = @gxx_include_dir@
here = @here@
host = @host@
@@ -320,6 +345,8 @@ multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+python_mod_dir = @python_mod_dir@
+python_mod_dir_expanded = @python_mod_dir_expanded@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in
index 5ab2321b155..765b9d8ac7d 100644
--- a/libjava/include/Makefile.in
+++ b/libjava/include/Makefile.in
@@ -98,6 +98,7 @@ AWK = @AWK@
BACKTRACESPEC = @BACKTRACESPEC@
BUILD_ECJ1_FALSE = @BUILD_ECJ1_FALSE@
BUILD_ECJ1_TRUE = @BUILD_ECJ1_TRUE@
+BUILD_VERSION = @BUILD_VERSION@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -105,6 +106,9 @@ CHECKREFSPEC = @CHECKREFSPEC@
CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPU = @CPU@
+CREATE_JAVA_HOME_FALSE = @CREATE_JAVA_HOME_FALSE@
+CREATE_JAVA_HOME_TRUE = @CREATE_JAVA_HOME_TRUE@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -134,6 +138,7 @@ GCJDEPMODE = @GCJDEPMODE@
GCJFLAGS = @GCJFLAGS@
GCJH = @GCJH@
GCJVERSION = @GCJVERSION@
+GCJ_BIN_DIR = @GCJ_BIN_DIR@
GCJ_FOR_ECJX = @GCJ_FOR_ECJX@
GCLIBS = @GCLIBS@
GCSPEC = @GCSPEC@
@@ -146,6 +151,8 @@ GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
INCLTDL = @INCLTDL@
+INSTALL_AOT_RPM_FALSE = @INSTALL_AOT_RPM_FALSE@
+INSTALL_AOT_RPM_TRUE = @INSTALL_AOT_RPM_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_ECJ_JAR_FALSE = @INSTALL_ECJ_JAR_FALSE@
INSTALL_ECJ_JAR_TRUE = @INSTALL_ECJ_JAR_TRUE@
@@ -161,13 +168,22 @@ JAVA_HOME_SET_FALSE = @JAVA_HOME_SET_FALSE@
JAVA_HOME_SET_TRUE = @JAVA_HOME_SET_TRUE@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
+JAVA_VERSION = @JAVA_VERSION@
JC1GCSPEC = @JC1GCSPEC@
+JRE_BIN_DIR = @JRE_BIN_DIR@
+JRE_DIR = @JRE_DIR@
+JRE_LIB_DIR = @JRE_LIB_DIR@
+JRE_LNK = @JRE_LNK@
+JVM_JAR_DIR = @JVM_JAR_DIR@
+JVM_JAR_ROOT_DIR = @JVM_JAR_ROOT_DIR@
+JVM_ROOT_DIR = @JVM_ROOT_DIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
LD_FINISH_STATIC_SPEC = @LD_FINISH_STATIC_SPEC@
LD_START_STATIC_SPEC = @LD_START_STATIC_SPEC@
LIBART_CFLAGS = @LIBART_CFLAGS@
LIBART_LIBS = @LIBART_LIBS@
+LIBDIR = @LIBDIR@
LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -190,6 +206,7 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
NATIVE_FALSE = @NATIVE_FALSE@
NATIVE_TRUE = @NATIVE_TRUE@
@@ -197,6 +214,7 @@ NEEDS_DATA_START_FALSE = @NEEDS_DATA_START_FALSE@
NEEDS_DATA_START_TRUE = @NEEDS_DATA_START_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
+OS = @OS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -208,6 +226,11 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PLATFORM = @PLATFORM@
RANLIB = @RANLIB@
+SDK_BIN_DIR = @SDK_BIN_DIR@
+SDK_DIR = @SDK_DIR@
+SDK_INCLUDE_DIR = @SDK_INCLUDE_DIR@
+SDK_LIB_DIR = @SDK_LIB_DIR@
+SDK_LNK = @SDK_LNK@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -295,6 +318,8 @@ exec_prefix = @exec_prefix@
extra_gij_ldflags = @extra_gij_ldflags@
extra_ldflags = @extra_ldflags@
extra_ldflags_libjava = @extra_ldflags_libjava@
+gcc_suffix = @gcc_suffix@
+gcjsubdir = @gcjsubdir@
gxx_include_dir = @gxx_include_dir@
here = @here@
host = @host@
@@ -319,6 +344,8 @@ multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+python_mod_dir = @python_mod_dir@
+python_mod_dir_expanded = @python_mod_dir_expanded@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in
index 8d42a626c80..ba058d6c4ea 100644
--- a/libjava/testsuite/Makefile.in
+++ b/libjava/testsuite/Makefile.in
@@ -87,6 +87,7 @@ AWK = @AWK@
BACKTRACESPEC = @BACKTRACESPEC@
BUILD_ECJ1_FALSE = @BUILD_ECJ1_FALSE@
BUILD_ECJ1_TRUE = @BUILD_ECJ1_TRUE@
+BUILD_VERSION = @BUILD_VERSION@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -94,6 +95,9 @@ CHECKREFSPEC = @CHECKREFSPEC@
CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPU = @CPU@
+CREATE_JAVA_HOME_FALSE = @CREATE_JAVA_HOME_FALSE@
+CREATE_JAVA_HOME_TRUE = @CREATE_JAVA_HOME_TRUE@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -123,6 +127,7 @@ GCJDEPMODE = @GCJDEPMODE@
GCJFLAGS = @GCJFLAGS@
GCJH = @GCJH@
GCJVERSION = @GCJVERSION@
+GCJ_BIN_DIR = @GCJ_BIN_DIR@
GCJ_FOR_ECJX = @GCJ_FOR_ECJX@
GCLIBS = @GCLIBS@
GCSPEC = @GCSPEC@
@@ -135,6 +140,8 @@ GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
INCLTDL = @INCLTDL@
+INSTALL_AOT_RPM_FALSE = @INSTALL_AOT_RPM_FALSE@
+INSTALL_AOT_RPM_TRUE = @INSTALL_AOT_RPM_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_ECJ_JAR_FALSE = @INSTALL_ECJ_JAR_FALSE@
INSTALL_ECJ_JAR_TRUE = @INSTALL_ECJ_JAR_TRUE@
@@ -150,13 +157,22 @@ JAVA_HOME_SET_FALSE = @JAVA_HOME_SET_FALSE@
JAVA_HOME_SET_TRUE = @JAVA_HOME_SET_TRUE@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
+JAVA_VERSION = @JAVA_VERSION@
JC1GCSPEC = @JC1GCSPEC@
+JRE_BIN_DIR = @JRE_BIN_DIR@
+JRE_DIR = @JRE_DIR@
+JRE_LIB_DIR = @JRE_LIB_DIR@
+JRE_LNK = @JRE_LNK@
+JVM_JAR_DIR = @JVM_JAR_DIR@
+JVM_JAR_ROOT_DIR = @JVM_JAR_ROOT_DIR@
+JVM_ROOT_DIR = @JVM_ROOT_DIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
LD_FINISH_STATIC_SPEC = @LD_FINISH_STATIC_SPEC@
LD_START_STATIC_SPEC = @LD_START_STATIC_SPEC@
LIBART_CFLAGS = @LIBART_CFLAGS@
LIBART_LIBS = @LIBART_LIBS@
+LIBDIR = @LIBDIR@
LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -179,6 +195,7 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
NATIVE_FALSE = @NATIVE_FALSE@
NATIVE_TRUE = @NATIVE_TRUE@
@@ -186,6 +203,7 @@ NEEDS_DATA_START_FALSE = @NEEDS_DATA_START_FALSE@
NEEDS_DATA_START_TRUE = @NEEDS_DATA_START_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
+OS = @OS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -197,6 +215,11 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PLATFORM = @PLATFORM@
RANLIB = @RANLIB@
+SDK_BIN_DIR = @SDK_BIN_DIR@
+SDK_DIR = @SDK_DIR@
+SDK_INCLUDE_DIR = @SDK_INCLUDE_DIR@
+SDK_LIB_DIR = @SDK_LIB_DIR@
+SDK_LNK = @SDK_LNK@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -284,6 +307,8 @@ exec_prefix = @exec_prefix@
extra_gij_ldflags = @extra_gij_ldflags@
extra_ldflags = @extra_ldflags@
extra_ldflags_libjava = @extra_ldflags_libjava@
+gcc_suffix = @gcc_suffix@
+gcjsubdir = @gcjsubdir@
gxx_include_dir = @gxx_include_dir@
here = @here@
host = @host@
@@ -308,6 +333,8 @@ multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+python_mod_dir = @python_mod_dir@
+python_mod_dir_expanded = @python_mod_dir_expanded@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 42a56a22a93..4c3689e3421 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-02 Jason Merrill <jason@redhat.com>
+
+ * libsupc++/initializer_list: New file.
+ * include/bits/stl_map.h (insert(initializer_list)): New method.
+
2008-06-30 Alfred E. Heggestad <aeh@db.org>
* include/backward/backward_warning.h: Fix typo.
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index a9486708ffe..cf0c16bc42d 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -64,6 +64,7 @@
#include <bits/functexcept.h>
#include <bits/concept_check.h>
+#include <initializer_list>
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
@@ -469,6 +470,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ return _M_t._M_insert_unique(__x); }
/**
+ * @brief Attempts to insert a list of std::pairs into the %map.
+ * @param list A std::initializer_list<value_type> of pairs to be
+ * inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ *
+ */
+ void
+ insert(std::initializer_list<value_type> list)
+ { insert (list.begin(), list.end()); }
+
+ /**
* @brief Attempts to insert a std::pair into the %map.
* @param position An iterator that serves as a hint as to where the
* pair should be inserted.
diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list
new file mode 100644
index 00000000000..1a3cba3dd02
--- /dev/null
+++ b/libstdc++-v3/libsupc++/initializer_list
@@ -0,0 +1,64 @@
+// std::initializer_list support -*- C++ -*-
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef __CXX_INITIALIZER_LIST
+#define __CXX_INITIALIZER_LIST
+
+#pragma GCC visibility push(default)
+
+#include <cstddef>
+
+namespace std
+{
+ template<class E>
+ class initializer_list
+ {
+ const E* _array;
+ size_t _len;
+
+ // The compiler can call a private constructor.
+ initializer_list(const E* _a, size_t _l)
+ : _array(_a), _len(_l) { }
+
+ public:
+ initializer_list()
+ : _array(NULL), _len(0) {}
+
+ size_t size() const // number of elements
+ { return _len; }
+ const E* begin() const // first element
+ { return _array; }
+ const E* end() const // one past the last element
+ { return begin() + size(); }
+ };
+}
+
+#pragma GCC visibility pop
+#endif // __CXX_INITIALIZER_LIST