GCC with patches for OS216
Revision | 0fd259829d491775635493c48875ee5c77b978c2 (tree) |
---|---|
Zeit | 1998-04-19 08:22:23 |
Autor | Richard Henderson <rth@cygn...> |
Commiter | Jeff Law |
com.c (ffecom_expr_): Revert Oct 22 change.
From-SVN: r19289
@@ -1,3 +1,10 @@ | ||
1 | +Thu Mar 12 09:53:14 1998 Richard Henderson <rth@cygnus.com> | |
2 | + | |
3 | + * com.c (ffecom_expr_): Revert Oct 22 change. Instead take a WIDENP | |
4 | + argument so that we can respect the signedness of the original type. | |
5 | + (ffecom_init_0): Do sizetype initialization first. Init new | |
6 | + ssizetype. | |
7 | + | |
1 | 8 | Thu Feb 19 00:54:20 1998 Mumit Khan <khan@xraylith.wisc.edu> |
2 | 9 | |
3 | 10 | * Make-lang.in (f77.all.build): Add exeext. |
@@ -275,6 +275,7 @@ static tree ldouble_ftype_ldouble; | ||
275 | 275 | inventions should be renamed to be canonical. Note that only |
276 | 276 | the ones currently required to be global are so. */ |
277 | 277 | |
278 | +static tree ssizetype; | |
278 | 279 | static tree ffecom_tree_fun_type_void; |
279 | 280 | static tree ffecom_tree_ptr_to_fun_type_void; |
280 | 281 |
@@ -433,9 +434,8 @@ static ffecomConcatList_ ffecom_concat_list_new_ (ffebld expr, | ||
433 | 434 | static void ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member, |
434 | 435 | tree member_type, ffetargetOffset offset); |
435 | 436 | static void ffecom_do_entry_ (ffesymbol fn, int entrynum); |
436 | -static tree ffecom_expr_ (ffebld expr, tree type_tree, tree dest_tree, | |
437 | - ffebld dest, bool *dest_used, | |
438 | - bool assignp); | |
437 | +static tree ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest, | |
438 | + bool *dest_used, bool assignp, bool widenp); | |
439 | 439 | static tree ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, |
440 | 440 | ffebld dest, bool *dest_used); |
441 | 441 | static tree ffecom_expr_power_integer_ (ffebld left, ffebld right); |
@@ -636,14 +636,6 @@ static char *ffecom_gfrt_argstring_[FFECOM_gfrt] | ||
636 | 636 | /* NOTE: g77 currently doesn't use these; see setting of sizetype and |
637 | 637 | change that if you need to. -- jcb 09/01/91. */ |
638 | 638 | |
639 | -#ifndef SIZE_TYPE | |
640 | -#define SIZE_TYPE "long unsigned int" | |
641 | -#endif | |
642 | - | |
643 | -#ifndef WCHAR_TYPE | |
644 | -#define WCHAR_TYPE "int" | |
645 | -#endif | |
646 | - | |
647 | 639 | #define ffecom_concat_list_count_(catlist) ((catlist).count) |
648 | 640 | #define ffecom_concat_list_expr_(catlist,i) ((catlist).exprs[(i)]) |
649 | 641 | #define ffecom_concat_list_maxlen_(catlist) ((catlist).maxlen) |
@@ -2666,17 +2658,12 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) | ||
2666 | 2658 | Recursive descent on expr while making corresponding tree nodes and |
2667 | 2659 | attaching type info and such. If destination supplied and compatible |
2668 | 2660 | with temporary that would be made in certain cases, temporary isn't |
2669 | - made, destination used instead, and dest_used flag set TRUE. | |
2670 | - | |
2671 | - If TREE_TYPE is non-null, it overrides the type that the expression | |
2672 | - would normally be computed in. This is most useful for array indices | |
2673 | - which should be done in sizetype for efficiency. */ | |
2661 | + made, destination used instead, and dest_used flag set TRUE. */ | |
2674 | 2662 | |
2675 | 2663 | #if FFECOM_targetCURRENT == FFECOM_targetGCC |
2676 | 2664 | static tree |
2677 | -ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | |
2678 | - ffebld dest, bool *dest_used, | |
2679 | - bool assignp) | |
2665 | +ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest, | |
2666 | + bool *dest_used, bool assignp, bool widenp) | |
2680 | 2667 | { |
2681 | 2668 | tree item; |
2682 | 2669 | tree list; |
@@ -2685,7 +2672,7 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
2685 | 2672 | ffeinfoKindtype kt; |
2686 | 2673 | tree t; |
2687 | 2674 | tree dt; /* decl_tree for an ffesymbol. */ |
2688 | - tree tree_type; | |
2675 | + tree tree_type, tree_type_x; | |
2689 | 2676 | tree left, right; |
2690 | 2677 | ffesymbol s; |
2691 | 2678 | enum tree_code code; |
@@ -2699,6 +2686,13 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
2699 | 2686 | kt = ffeinfo_kindtype (ffebld_info (expr)); |
2700 | 2687 | tree_type = ffecom_tree_type[bt][kt]; |
2701 | 2688 | |
2689 | + /* Widen integral arithmetic as desired while preserving signedness. */ | |
2690 | + tree_type_x = NULL_TREE; | |
2691 | + if (widenp && tree_type | |
2692 | + && GET_MODE_CLASS (TYPE_MODE (tree_type)) == MODE_INT | |
2693 | + && TYPE_PRECISION (tree_type) < TYPE_PRECISION (sizetype)) | |
2694 | + tree_type_x = (TREE_UNSIGNED (tree_type) ? sizetype : ssizetype); | |
2695 | + | |
2702 | 2696 | switch (ffebld_op (expr)) |
2703 | 2697 | { |
2704 | 2698 | case FFEBLD_opACCTER: |
@@ -2933,26 +2927,22 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
2933 | 2927 | t = ffecom_2 (ARRAY_REF, |
2934 | 2928 | TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))), |
2935 | 2929 | t, |
2936 | - ffecom_expr_ (dims[--i], sizetype, NULL, NULL, | |
2937 | - NULL, FALSE)); | |
2930 | + ffecom_expr_ (dims[--i], NULL, NULL, NULL, FALSE, TRUE)); | |
2938 | 2931 | #endif |
2939 | 2932 | |
2940 | 2933 | return t; |
2941 | 2934 | } |
2942 | 2935 | |
2943 | 2936 | case FFEBLD_opUPLUS: |
2944 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
2945 | - NULL, FALSE); | |
2937 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2946 | 2938 | return ffecom_1 (NOP_EXPR, tree_type, left); |
2947 | 2939 | |
2948 | 2940 | case FFEBLD_opPAREN: /* ~~~Make sure Fortran rules respected here */ |
2949 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
2950 | - NULL, FALSE); | |
2941 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2951 | 2942 | return ffecom_1 (NOP_EXPR, tree_type, left); |
2952 | 2943 | |
2953 | 2944 | case FFEBLD_opUMINUS: |
2954 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
2955 | - NULL, FALSE); | |
2945 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2956 | 2946 | if (tree_type_x) |
2957 | 2947 | { |
2958 | 2948 | tree_type = tree_type_x; |
@@ -2961,10 +2951,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
2961 | 2951 | return ffecom_1 (NEGATE_EXPR, tree_type, left); |
2962 | 2952 | |
2963 | 2953 | case FFEBLD_opADD: |
2964 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
2965 | - NULL, FALSE); | |
2966 | - right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL, | |
2967 | - NULL, FALSE); | |
2954 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2955 | + right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp); | |
2968 | 2956 | if (tree_type_x) |
2969 | 2957 | { |
2970 | 2958 | tree_type = tree_type_x; |
@@ -2974,10 +2962,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
2974 | 2962 | return ffecom_2 (PLUS_EXPR, tree_type, left, right); |
2975 | 2963 | |
2976 | 2964 | case FFEBLD_opSUBTRACT: |
2977 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
2978 | - NULL, FALSE); | |
2979 | - right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL, | |
2980 | - NULL, FALSE); | |
2965 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2966 | + right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp); | |
2981 | 2967 | if (tree_type_x) |
2982 | 2968 | { |
2983 | 2969 | tree_type = tree_type_x; |
@@ -2987,10 +2973,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
2987 | 2973 | return ffecom_2 (MINUS_EXPR, tree_type, left, right); |
2988 | 2974 | |
2989 | 2975 | case FFEBLD_opMULTIPLY: |
2990 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
2991 | - NULL, FALSE); | |
2992 | - right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL, | |
2993 | - NULL, FALSE); | |
2976 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2977 | + right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp); | |
2994 | 2978 | if (tree_type_x) |
2995 | 2979 | { |
2996 | 2980 | tree_type = tree_type_x; |
@@ -3000,10 +2984,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree, | ||
3000 | 2984 | return ffecom_2 (MULT_EXPR, tree_type, left, right); |
3001 | 2985 | |
3002 | 2986 | case FFEBLD_opDIVIDE: |
3003 | - left = ffecom_expr_ (ffebld_left (expr), tree_type_x, NULL, NULL, | |
3004 | - NULL, FALSE); | |
3005 | - right = ffecom_expr_ (ffebld_right (expr), tree_type_x, NULL, NULL, | |
3006 | - NULL, FALSE); | |
2987 | + left = ffecom_expr_ (ffebld_left (expr), NULL, NULL, NULL, FALSE, widenp); | |
2988 | + right = ffecom_expr_ (ffebld_right (expr), NULL, NULL, NULL, FALSE, widenp); | |
3007 | 2989 | if (tree_type_x) |
3008 | 2990 | { |
3009 | 2991 | tree_type = tree_type_x; |
@@ -11461,8 +11443,8 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source) | ||
11461 | 11443 | |
11462 | 11444 | if ((TREE_CODE (dest_tree) != VAR_DECL) |
11463 | 11445 | || TREE_ADDRESSABLE (dest_tree)) |
11464 | - source_tree = ffecom_expr_ (source, NULL_TREE, dest_tree, dest, | |
11465 | - &dest_used, FALSE); | |
11446 | + source_tree = ffecom_expr_ (source, dest_tree, dest, &dest_used, | |
11447 | + FALSE, FALSE); | |
11466 | 11448 | else |
11467 | 11449 | { |
11468 | 11450 | source_tree = ffecom_expr (source); |
@@ -11503,8 +11485,7 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source) | ||
11503 | 11485 | tree |
11504 | 11486 | ffecom_expr (ffebld expr) |
11505 | 11487 | { |
11506 | - return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL, | |
11507 | - FALSE); | |
11488 | + return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, FALSE, FALSE); | |
11508 | 11489 | } |
11509 | 11490 | |
11510 | 11491 | #endif |
@@ -11514,8 +11495,7 @@ ffecom_expr (ffebld expr) | ||
11514 | 11495 | tree |
11515 | 11496 | ffecom_expr_assign (ffebld expr) |
11516 | 11497 | { |
11517 | - return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL, | |
11518 | - TRUE); | |
11498 | + return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE); | |
11519 | 11499 | } |
11520 | 11500 | |
11521 | 11501 | #endif |
@@ -11525,8 +11505,7 @@ ffecom_expr_assign (ffebld expr) | ||
11525 | 11505 | tree |
11526 | 11506 | ffecom_expr_assign_w (ffebld expr) |
11527 | 11507 | { |
11528 | - return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL, | |
11529 | - TRUE); | |
11508 | + return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE); | |
11530 | 11509 | } |
11531 | 11510 | |
11532 | 11511 | #endif |
@@ -11762,6 +11741,11 @@ ffecom_init_0 () | ||
11762 | 11741 | } |
11763 | 11742 | } |
11764 | 11743 | |
11744 | + /* Set the sizetype before we do anything else. */ | |
11745 | + | |
11746 | + sizetype = make_unsigned_type (POINTER_SIZE); | |
11747 | + ssizetype = make_signed_type (POINTER_SIZE); | |
11748 | + | |
11765 | 11749 | #if FFECOM_GCC_INCLUDE |
11766 | 11750 | ffecom_initialize_char_syntax_ (); |
11767 | 11751 | #endif |
@@ -11805,9 +11789,6 @@ ffecom_init_0 () | ||
11805 | 11789 | pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"), |
11806 | 11790 | long_long_unsigned_type_node)); |
11807 | 11791 | |
11808 | - sizetype | |
11809 | - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))); | |
11810 | - | |
11811 | 11792 | TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype; |
11812 | 11793 | TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype; |
11813 | 11794 | TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype; |