From: Andrew Haley Date: Wed, 21 Jul 1999 14:51:24 +0000 (+0000) Subject: lang.c (flag_use_divide_subroutine): New variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b094f655adbcfc286d1e03937814129dd5fa640;p=gcc.git lang.c (flag_use_divide_subroutine): New variable. 1999-07-15 Andrew Haley * lang.c (flag_use_divide_subroutine): New variable. * typeck.c: (convert_ieee_real_to_integer): Bounds check fp-to-integer conversion. (convert): Call convert_ieee_real_to_integer when flag_fast_math is not set. * expr.c (build_java_soft_divmod): New function. (build_java_binop): Call build_java_soft_divmod if flag_use_divide_subroutine is set. * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree soft_lrem_node: new builtin functions. (init_decl_processing) Initialize the new builtins. * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree soft_lrem_node: new builtin functions. (build_java_soft_divmod): New function. * parse.y: Call build_java_soft_divmod if flag_use_divide_subroutine is set. * parse.c: Rebuilt. * jvspec.c (lang_specific_driver): Always allow an extra arg (for a --specs= arg) even if not linking. * lang-options.h (DEFINE_LANG_NAME ("Java")): Add -fuse-divide-subroutine From-SVN: r28209 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 372d294414f..4911d90e9d7 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,23 +1,29 @@ 1999-07-15 Andrew Haley - * lang.c (flag_use_divide_subroutine): New variable. - * typeck.c: (convert_ieee_real_to_integer): Bounds check - fp-to-integer conversion. - (convert): Call convert_ieee_real_to_integer when flag_fast_math - is not set. - - * expr.c (build_java_soft_divmod): New function. - (build_java_binop): Call build_java_soft_divmod if - flag_use_divide_subroutine is set. - * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree - soft_lrem_node: new builtin functions. - (init_decl_processing) Initialize the new builtins. - * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree - soft_lrem_node: new builtin functions. - (build_java_soft_divmod): New function. - * parse.y: Call build_java_soft_divmod if - flag_use_divide_subroutine is set. - + * lang.c (flag_use_divide_subroutine): New variable. + * typeck.c: (convert_ieee_real_to_integer): Bounds check + fp-to-integer conversion. + (convert): Call convert_ieee_real_to_integer when flag_fast_math + is not set. + + * expr.c (build_java_soft_divmod): New function. + (build_java_binop): Call build_java_soft_divmod if + flag_use_divide_subroutine is set. + * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree + soft_lrem_node: new builtin functions. + (init_decl_processing) Initialize the new builtins. + * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree + soft_lrem_node: new builtin functions. + (build_java_soft_divmod): New function. + * parse.y: Call build_java_soft_divmod if + flag_use_divide_subroutine is set. + * parse.c: Rebuilt. + + * jvspec.c (lang_specific_driver): Always allow an extra arg (for + a --specs= arg) even if not linking. + * lang-options.h (DEFINE_LANG_NAME ("Java")): Add + -fuse-divide-subroutine + Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco * parse.y (resolve_and_layout): Check methods only once. diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index eba801cb32a..e962e584fb8 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -376,8 +376,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) } if (saw_g + saw_O == 0) num_args++; - if (will_link) - num_args++; + num_args++; arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *)); for (i = 0, j = 0; i < argc; i++, j++) @@ -408,7 +407,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) continue; } - if (will_link && spec_file == NULL && strncmp (argv[i], "-L", 2) == 0) + if (spec_file == NULL && strncmp (argv[i], "-L", 2) == 0) spec_file = find_spec_file (argv[i] + 2); if (strncmp (argv[i], "-fmain=", 7) == 0) @@ -453,10 +452,10 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) if (saw_g + saw_O == 0) arglist[j++] = "-g1"; - /* Read the specs file corresponding to libgcj, but only if linking. + /* Read the specs file corresponding to libgcj. If we didn't find the spec file on the -L path, then we hope it is somewhere in the standard install areas. */ - if (will_link) + if (! saw_C) arglist[j++] = spec_file == NULL ? "-specs=libgcj.spec" : spec_file; if (saw_C) diff --git a/gcc/java/lang-options.h b/gcc/java/lang-options.h index db80b01cfc4..7ebc7eed786 100644 --- a/gcc/java/lang-options.h +++ b/gcc/java/lang-options.h @@ -43,6 +43,8 @@ DEFINE_LANG_NAME ("Java") { "-fCLASSPATH", "Set class path" }, { "-I", "Add directory to class path" }, { "-foutput-class-dir", "Directory where class files should be written" }, + { "-fuse-divide-subroutine", "" }, + { "-fno-use-divide-subroutine", "Use built-in instructions for division" }, { "-Wredundant-modifiers", "Warn if modifiers are specified when not necessary"}, - { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"}, + { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"} diff --git a/gcc/java/parse.c b/gcc/java/parse.c index e36ef3f3cc9..da19cda26d5 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -2212,7 +2212,7 @@ static const short yycheck[] = { 3, #define YYPURE 1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/misc/bison.simple" +#line 3 "/usr/local/share/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. @@ -2229,7 +2229,7 @@ static const short yycheck[] = { 3, You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -2363,10 +2363,8 @@ int yydebug; /* nonzero means print parse trace */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ -#ifndef YYPARSE_PARAM int yyparse (void); #endif -#endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) @@ -2407,7 +2405,7 @@ __yy_memcpy (char *to, char *from, int count) #endif #endif -#line 196 "/usr/share/misc/bison.simple" +#line 196 "/usr/local/share/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -4696,7 +4694,7 @@ case 495: break;} } /* the action file gets copied in in place of this dollarsign */ -#line 498 "/usr/share/misc/bison.simple" +#line 498 "/usr/local/share/bison.simple" yyvsp -= yylen; yyssp -= yylen; @@ -11998,6 +11996,12 @@ patch_binop (node, wfl_op1, wfl_op2) if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) TREE_SET_CODE (node, TRUNC_DIV_EXPR); + if (TREE_CODE (prom_type) == INTEGER_TYPE + && flag_use_divide_subroutine + && ! flag_emit_class_files + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR)) + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2); + /* This one is more complicated. FLOATs are processed by a function call to soft_fmod. Duplicate the value of the COMPOUND_ASSIGN_P flag. */