• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

Revision0fd259829d491775635493c48875ee5c77b978c2 (tree)
Zeit1998-04-19 08:22:23
AutorRichard Henderson <rth@cygn...>
CommiterJeff Law

Log Message

com.c (ffecom_expr_): Revert Oct 22 change.

        • com.c (ffecom_expr_): Revert Oct 22 change. Instead take a WIDENP
          argument so that we can respect the signedness of the original type.
          (ffecom_init_0): Do sizetype initialization first. Init new
          ssizetype.

From-SVN: r19289

Ändern Zusammenfassung

Diff

--- a/gcc/f/ChangeLog.egcs
+++ b/gcc/f/ChangeLog.egcs
@@ -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+
18 Thu Feb 19 00:54:20 1998 Mumit Khan <khan@xraylith.wisc.edu>
29
310 * Make-lang.in (f77.all.build): Add exeext.
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -275,6 +275,7 @@ static tree ldouble_ftype_ldouble;
275275 inventions should be renamed to be canonical. Note that only
276276 the ones currently required to be global are so. */
277277
278+static tree ssizetype;
278279 static tree ffecom_tree_fun_type_void;
279280 static tree ffecom_tree_ptr_to_fun_type_void;
280281
@@ -433,9 +434,8 @@ static ffecomConcatList_ ffecom_concat_list_new_ (ffebld expr,
433434 static void ffecom_debug_kludge_ (tree aggr, char *aggr_type, ffesymbol member,
434435 tree member_type, ffetargetOffset offset);
435436 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);
439439 static tree ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree,
440440 ffebld dest, bool *dest_used);
441441 static tree ffecom_expr_power_integer_ (ffebld left, ffebld right);
@@ -636,14 +636,6 @@ static char *ffecom_gfrt_argstring_[FFECOM_gfrt]
636636 /* NOTE: g77 currently doesn't use these; see setting of sizetype and
637637 change that if you need to. -- jcb 09/01/91. */
638638
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-
647639 #define ffecom_concat_list_count_(catlist) ((catlist).count)
648640 #define ffecom_concat_list_expr_(catlist,i) ((catlist).exprs[(i)])
649641 #define ffecom_concat_list_maxlen_(catlist) ((catlist).maxlen)
@@ -2666,17 +2658,12 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum)
26662658 Recursive descent on expr while making corresponding tree nodes and
26672659 attaching type info and such. If destination supplied and compatible
26682660 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. */
26742662
26752663 #if FFECOM_targetCURRENT == FFECOM_targetGCC
26762664 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)
26802667 {
26812668 tree item;
26822669 tree list;
@@ -2685,7 +2672,7 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
26852672 ffeinfoKindtype kt;
26862673 tree t;
26872674 tree dt; /* decl_tree for an ffesymbol. */
2688- tree tree_type;
2675+ tree tree_type, tree_type_x;
26892676 tree left, right;
26902677 ffesymbol s;
26912678 enum tree_code code;
@@ -2699,6 +2686,13 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
26992686 kt = ffeinfo_kindtype (ffebld_info (expr));
27002687 tree_type = ffecom_tree_type[bt][kt];
27012688
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+
27022696 switch (ffebld_op (expr))
27032697 {
27042698 case FFEBLD_opACCTER:
@@ -2933,26 +2927,22 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
29332927 t = ffecom_2 (ARRAY_REF,
29342928 TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (t))),
29352929 t,
2936- ffecom_expr_ (dims[--i], sizetype, NULL, NULL,
2937- NULL, FALSE));
2930+ ffecom_expr_ (dims[--i], NULL, NULL, NULL, FALSE, TRUE));
29382931 #endif
29392932
29402933 return t;
29412934 }
29422935
29432936 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);
29462938 return ffecom_1 (NOP_EXPR, tree_type, left);
29472939
29482940 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);
29512942 return ffecom_1 (NOP_EXPR, tree_type, left);
29522943
29532944 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);
29562946 if (tree_type_x)
29572947 {
29582948 tree_type = tree_type_x;
@@ -2961,10 +2951,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
29612951 return ffecom_1 (NEGATE_EXPR, tree_type, left);
29622952
29632953 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);
29682956 if (tree_type_x)
29692957 {
29702958 tree_type = tree_type_x;
@@ -2974,10 +2962,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
29742962 return ffecom_2 (PLUS_EXPR, tree_type, left, right);
29752963
29762964 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);
29812967 if (tree_type_x)
29822968 {
29832969 tree_type = tree_type_x;
@@ -2987,10 +2973,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
29872973 return ffecom_2 (MINUS_EXPR, tree_type, left, right);
29882974
29892975 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);
29942978 if (tree_type_x)
29952979 {
29962980 tree_type = tree_type_x;
@@ -3000,10 +2984,8 @@ ffecom_expr_ (ffebld expr, tree tree_type_x, tree dest_tree,
30002984 return ffecom_2 (MULT_EXPR, tree_type, left, right);
30012985
30022986 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);
30072989 if (tree_type_x)
30082990 {
30092991 tree_type = tree_type_x;
@@ -11461,8 +11443,8 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source)
1146111443
1146211444 if ((TREE_CODE (dest_tree) != VAR_DECL)
1146311445 || 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);
1146611448 else
1146711449 {
1146811450 source_tree = ffecom_expr (source);
@@ -11503,8 +11485,7 @@ ffecom_expand_let_stmt (ffebld dest, ffebld source)
1150311485 tree
1150411486 ffecom_expr (ffebld expr)
1150511487 {
11506- return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL,
11507- FALSE);
11488+ return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, FALSE, FALSE);
1150811489 }
1150911490
1151011491 #endif
@@ -11514,8 +11495,7 @@ ffecom_expr (ffebld expr)
1151411495 tree
1151511496 ffecom_expr_assign (ffebld expr)
1151611497 {
11517- return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL,
11518- TRUE);
11498+ return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE);
1151911499 }
1152011500
1152111501 #endif
@@ -11525,8 +11505,7 @@ ffecom_expr_assign (ffebld expr)
1152511505 tree
1152611506 ffecom_expr_assign_w (ffebld expr)
1152711507 {
11528- return ffecom_expr_ (expr, NULL_TREE, NULL_TREE, NULL, NULL,
11529- TRUE);
11508+ return ffecom_expr_ (expr, NULL_TREE, NULL, NULL, TRUE, FALSE);
1153011509 }
1153111510
1153211511 #endif
@@ -11762,6 +11741,11 @@ ffecom_init_0 ()
1176211741 }
1176311742 }
1176411743
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+
1176511749 #if FFECOM_GCC_INCLUDE
1176611750 ffecom_initialize_char_syntax_ ();
1176711751 #endif
@@ -11805,9 +11789,6 @@ ffecom_init_0 ()
1180511789 pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"),
1180611790 long_long_unsigned_type_node));
1180711791
11808- sizetype
11809- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
11810-
1181111792 TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
1181211793 TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype;
1181311794 TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;