* [PATCH] Remove some Pascal trees from the generic
@ 2004-07-07 3:33 Andrew Pinski
2004-07-07 19:47 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2004-07-07 3:33 UTC (permalink / raw)
To: gcc-patches
Since the only front-end uses these trees is the pascal front-end and it
is not part of GCC. The only one I could not remove is RANGE_EXPR,
since that
is used in the Fortran front-end.
OK? Bootstrapped on powerpc-apple-darwin with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* expr.c (expand_expr_real_1): Fix formating.
BUFFER_REF and IN_EXPR are dead.
* fold-const.c (non_lvalue): BUFFER_REF is dead.
* tree-inline.c (estimate_num_insns_1): Likewise.
* tree-pretty-print.c (dump_generic_node): BUFFER_REF,
IN_EXPR, SET_LE_EXPR, and CARD_EXPR are dead.
* tree.def (BUFFER_REF, IN_EXPR, SET_LE_EXPR, CARD_EXPR): Kill.
cp/ChangeLog:
* class.c (instantiate_type): BUFFER_REF is dead.
* lex.c (init_operators): IN_EXPR is dead.
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.670
diff -u -p -r1.670 expr.c
--- expr.c 6 Jul 2004 20:01:08 -0000 1.670
+++ expr.c 7 Jul 2004 03:16:34 -0000
@@ -6443,8 +6443,8 @@ expand_expr_real_1 (tree exp, rtx target
original_target = target;
ignore = (target == const0_rtx
|| ((code == NON_LVALUE_EXPR || code == NOP_EXPR
- || code == CONVERT_EXPR || code == COND_EXPR
- || code == VIEW_CONVERT_EXPR)
+ || code == CONVERT_EXPR || code == COND_EXPR
+ || code == VIEW_CONVERT_EXPR)
&& TREE_CODE (type) == VOID_TYPE));
/* If we are going to ignore this result, we need only do something
@@ -6472,7 +6472,7 @@ expand_expr_real_1 (tree exp, rtx target
}
if (TREE_CODE_CLASS (code) == '1' || code == COMPONENT_REF
- || code == INDIRECT_REF || code == BUFFER_REF)
+ || code == INDIRECT_REF)
return expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
modifier);
@@ -7345,113 +7345,6 @@ expand_expr_real_1 (tree exp, rtx target
case OBJ_TYPE_REF:
return expand_expr (OBJ_TYPE_REF_EXPR (exp), target, tmode,
modifier);
- /* Intended for a reference to a buffer of a file-object in
Pascal.
- But it's not certain that a special tree code will really be
- necessary for these. INDIRECT_REF might work for them. */
- case BUFFER_REF:
- abort ();
-
- case IN_EXPR:
- {
- /* Pascal set IN expression.
-
- Algorithm:
- rlo = set_low - (set_low%bits_per_word);
- the_word = set [ (index - rlo)/bits_per_word ];
- bit_index = index % bits_per_word;
- bitmask = 1 << bit_index;
- return !!(the_word & bitmask); */
-
- tree set = TREE_OPERAND (exp, 0);
- tree index = TREE_OPERAND (exp, 1);
- int iunsignedp = TYPE_UNSIGNED (TREE_TYPE (index));
- tree set_type = TREE_TYPE (set);
- tree set_low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (set_type));
- tree set_high_bound = TYPE_MAX_VALUE (TYPE_DOMAIN (set_type));
- rtx index_val = expand_expr (index, 0, VOIDmode, 0);
- rtx lo_r = expand_expr (set_low_bound, 0, VOIDmode, 0);
- rtx hi_r = expand_expr (set_high_bound, 0, VOIDmode, 0);
- rtx setval = expand_expr (set, 0, VOIDmode, 0);
- rtx setaddr = XEXP (setval, 0);
- enum machine_mode index_mode = TYPE_MODE (TREE_TYPE (index));
- rtx rlow;
- rtx diff, quo, rem, addr, bit, result;
-
- /* If domain is empty, answer is no. Likewise if index is constant
- and out of bounds. */
- if (((TREE_CODE (set_high_bound) == INTEGER_CST
- && TREE_CODE (set_low_bound) == INTEGER_CST
- && tree_int_cst_lt (set_high_bound, set_low_bound))
- || (TREE_CODE (index) == INTEGER_CST
- && TREE_CODE (set_low_bound) == INTEGER_CST
- && tree_int_cst_lt (index, set_low_bound))
- || (TREE_CODE (set_high_bound) == INTEGER_CST
- && TREE_CODE (index) == INTEGER_CST
- && tree_int_cst_lt (set_high_bound, index))))
- return const0_rtx;
-
- if (target == 0)
- target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
-
- /* If we get here, we have to generate the code for both cases
- (in range and out of range). */
-
- op0 = gen_label_rtx ();
- op1 = gen_label_rtx ();
-
- if (! (GET_CODE (index_val) == CONST_INT
- && GET_CODE (lo_r) == CONST_INT))
- emit_cmp_and_jump_insns (index_val, lo_r, LT, NULL_RTX,
- GET_MODE (index_val), iunsignedp, op1);
-
- if (! (GET_CODE (index_val) == CONST_INT
- && GET_CODE (hi_r) == CONST_INT))
- emit_cmp_and_jump_insns (index_val, hi_r, GT, NULL_RTX,
- GET_MODE (index_val), iunsignedp, op1);
-
- /* Calculate the element number of bit zero in the first word
- of the set. */
- if (GET_CODE (lo_r) == CONST_INT)
- rlow = GEN_INT (INTVAL (lo_r)
- & ~((HOST_WIDE_INT) 1 << BITS_PER_UNIT));
- else
- rlow = expand_binop (index_mode, and_optab, lo_r,
- GEN_INT (~((HOST_WIDE_INT) 1 << BITS_PER_UNIT)),
- NULL_RTX, iunsignedp, OPTAB_LIB_WIDEN);
-
- diff = expand_binop (index_mode, sub_optab, index_val, rlow,
- NULL_RTX, iunsignedp, OPTAB_LIB_WIDEN);
-
- quo = expand_divmod (0, TRUNC_DIV_EXPR, index_mode, diff,
- GEN_INT (BITS_PER_UNIT), NULL_RTX, iunsignedp);
- rem = expand_divmod (1, TRUNC_MOD_EXPR, index_mode, index_val,
- GEN_INT (BITS_PER_UNIT), NULL_RTX, iunsignedp);
-
- addr = memory_address (byte_mode,
- expand_binop (index_mode, add_optab, diff,
- setaddr, NULL_RTX, iunsignedp,
- OPTAB_LIB_WIDEN));
-
- /* Extract the bit we want to examine. */
- bit = expand_shift (RSHIFT_EXPR, byte_mode,
- gen_rtx_MEM (byte_mode, addr),
- make_tree (TREE_TYPE (index), rem),
- NULL_RTX, 1);
- result = expand_binop (byte_mode, and_optab, bit, const1_rtx,
- GET_MODE (target) == byte_mode ? target : 0,
- 1, OPTAB_LIB_WIDEN);
-
- if (result != target)
- convert_move (target, result, 1);
-
- /* Output the code to handle the out-of-range case. */
- emit_jump (op0);
- emit_label (op1);
- emit_move_insn (target, const0_rtx);
- emit_label (op0);
- return target;
- }
-
case WITH_CLEANUP_EXPR:
if (WITH_CLEANUP_EXPR_RTL (exp) == 0)
{
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.417
diff -u -p -r1.417 fold-const.c
--- fold-const.c 5 Jul 2004 16:44:17 -0000 1.417
+++ fold-const.c 7 Jul 2004 03:16:34 -0000
@@ -2023,7 +2023,6 @@ non_lvalue (tree x)
case ARRAY_REF:
case ARRAY_RANGE_REF:
case BIT_FIELD_REF:
- case BUFFER_REF:
case OBJ_TYPE_REF:
case REALPART_EXPR:
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.123
diff -u -p -r1.123 tree-inline.c
--- tree-inline.c 6 Jul 2004 20:01:09 -0000 1.123
+++ tree-inline.c 7 Jul 2004 03:16:34 -0000
@@ -1196,7 +1196,6 @@ estimate_num_insns_1 (tree *tp, int *wal
case COMPONENT_REF:
case BIT_FIELD_REF:
case INDIRECT_REF:
- case BUFFER_REF:
case ARRAY_REF:
case ARRAY_RANGE_REF:
case OBJ_TYPE_REF:
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.20
diff -u -p -r2.20 tree-pretty-print.c
--- tree-pretty-print.c 6 Jul 2004 20:01:10 -0000 2.20
+++ tree-pretty-print.c 7 Jul 2004 03:16:34 -0000
@@ -641,10 +641,6 @@ dump_generic_node (pretty_printer *buffe
pp_string (buffer, ">");
break;
- case BUFFER_REF:
- NIY;
- break;
-
case ARRAY_REF:
case ARRAY_RANGE_REF:
op0 = TREE_OPERAND (node, 0);
@@ -1054,18 +1050,6 @@ dump_generic_node (pretty_printer *buffe
pp_character (buffer, '>');
break;
- case IN_EXPR:
- NIY;
- break;
-
- case SET_LE_EXPR:
- NIY;
- break;
-
- case CARD_EXPR:
- NIY;
- break;
-
case RANGE_EXPR:
NIY;
break;
Index: tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.def,v
retrieving revision 1.90
diff -u -p -r1.90 tree.def
--- tree.def 6 Jul 2004 20:01:10 -0000 1.90
+++ tree.def 7 Jul 2004 03:16:35 -0000
@@ -372,9 +372,6 @@ DEFTREECODE (BIT_FIELD_REF, "bit_field_r
/* C unary `*' or Pascal `^'. One operand, an expression for a
pointer. */
DEFTREECODE (INDIRECT_REF, "indirect_ref", 'r', 1)
-/* Pascal `^` on a file. One operand, an expression for the file. */
-DEFTREECODE (BUFFER_REF, "buffer_ref", 'r', 1)
-
/* Array indexing.
Operand 0 is the array; operand 1 is a (single) array index.
Operand 2, if present, is a copy of TYPE_MIN_VALUE of the index.
@@ -693,10 +690,6 @@ DEFTREECODE (UNEQ_EXPR, "uneq_expr", '<'
/* This is the reverse of uneq_expr. */
DEFTREECODE (LTGT_EXPR, "ltgt_expr", '<', 2)
-/* Operations for Pascal sets. Not used now. */
-DEFTREECODE (IN_EXPR, "in_expr", '2', 2)
-DEFTREECODE (SET_LE_EXPR, "set_le_expr", '<', 2)
-DEFTREECODE (CARD_EXPR, "card_expr", '1', 1)
DEFTREECODE (RANGE_EXPR, "range_expr", '2', 2)
/* Represents a conversion of type of a value.
Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.623
diff -u -p -r1.623 class.c
--- cp/class.c 6 Jul 2004 08:51:19 -0000 1.623
+++ cp/class.c 7 Jul 2004 03:16:36 -0000
@@ -6052,7 +6052,6 @@ instantiate_type (tree lhstype, tree rhs
case CONVERT_EXPR:
case SAVE_EXPR:
case CONSTRUCTOR:
- case BUFFER_REF:
abort ();
return error_mark_node;
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.333
diff -u -p -r1.333 lex.c
--- cp/lex.c 30 Jun 2004 18:23:34 -0000 1.333
+++ cp/lex.c 7 Jul 2004 03:16:36 -0000
@@ -150,7 +150,6 @@ init_operators (void)
operator_name_info [(int) ABS_EXPR].name = "abs";
operator_name_info [(int) TRUTH_AND_EXPR].name = "strict &&";
operator_name_info [(int) TRUTH_OR_EXPR].name = "strict ||";
- operator_name_info [(int) IN_EXPR].name = "in";
operator_name_info [(int) RANGE_EXPR].name = "...";
operator_name_info [(int) CONVERT_EXPR].name = "+";
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove some Pascal trees from the generic
2004-07-07 3:33 [PATCH] Remove some Pascal trees from the generic Andrew Pinski
@ 2004-07-07 19:47 ` Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2004-07-07 19:47 UTC (permalink / raw)
To: Andrew Pinski; +Cc: gcc-patches
On Tue, Jul 06, 2004 at 08:28:00PM -0700, Andrew Pinski wrote:
> * expr.c (expand_expr_real_1): Fix formating.
> BUFFER_REF and IN_EXPR are dead.
> * fold-const.c (non_lvalue): BUFFER_REF is dead.
> * tree-inline.c (estimate_num_insns_1): Likewise.
> * tree-pretty-print.c (dump_generic_node): BUFFER_REF,
> IN_EXPR, SET_LE_EXPR, and CARD_EXPR are dead.
> * tree.def (BUFFER_REF, IN_EXPR, SET_LE_EXPR, CARD_EXPR): Kill.
> cp/ChangeLog:
> * class.c (instantiate_type): BUFFER_REF is dead.
> * lex.c (init_operators): IN_EXPR is dead.
Ok.
If Pascal ever gets ported to tree-ssa, these trees can be added to
their language-specific source, and lowered in their gimplify hook.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove some Pascal trees from the generic
@ 2004-07-10 15:53 Waldek Hebisch
0 siblings, 0 replies; 4+ messages in thread
From: Waldek Hebisch @ 2004-07-10 15:53 UTC (permalink / raw)
To: gcc-patches
Richard Henderson wrote:
>On Tue, Jul 06, 2004 at 08:28:00PM -0700, Andrew Pinski wrote:
>> * expr.c (expand_expr_real_1): Fix formating.
>> BUFFER_REF and IN_EXPR are dead.
>> * fold-const.c (non_lvalue): BUFFER_REF is dead.
>> * tree-inline.c (estimate_num_insns_1): Likewise.
>> * tree-pretty-print.c (dump_generic_node): BUFFER_REF,
>> IN_EXPR, SET_LE_EXPR, and CARD_EXPR are dead.
>> * tree.def (BUFFER_REF, IN_EXPR, SET_LE_EXPR, CARD_EXPR): Kill.
>> cp/ChangeLog:
>> * class.c (instantiate_type): BUFFER_REF is dead.
>> * lex.c (init_operators): IN_EXPR is dead.
>
>Ok.
>
>If Pascal ever gets ported to tree-ssa, these trees can be added to
>their language-specific source, and lowered in their gimplify hook.
>
ATM Pascal is not using BUFFER_REF, SET_LE_EXPR, CARD_EXPR and FILE_TYPE
at all. IN_EXPR is expanded in the front-end and never reaches back-end.
In fact Pascal also has SYMDIFF_EXPR for symmetric difference, and in
place where we expand SYMDIFF_EXPR we handle all set operations.
However, the current way is very slow for small sets so I consider a
change. For that a fast way to implement IN_EXPR would be nice (still
x & (1<<i) in C is order of magnitude faster then current Pascal
i IN x).
FYI FILE_TYPE handling is buggy -- back-end can not generate DWARF debug
info for files (and gdb has no support for reading such info), so GNU
Pascal just uses pointers as files.
--
Waldek Hebisch
hebisch@math.uni.wroc.pl
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove some Pascal trees from the generic
@ 2004-07-09 21:25 Waldek Hebisch
0 siblings, 0 replies; 4+ messages in thread
From: Waldek Hebisch @ 2004-07-09 21:25 UTC (permalink / raw)
To: gcc-patches
Richard Henderson wrote:
>On Tue, Jul 06, 2004 at 08:28:00PM -0700, Andrew Pinski wrote:
>> * expr.c (expand_expr_real_1): Fix formating.
>> BUFFER_REF and IN_EXPR are dead.
>> * fold-const.c (non_lvalue): BUFFER_REF is dead.
>> * tree-inline.c (estimate_num_insns_1): Likewise.
>> * tree-pretty-print.c (dump_generic_node): BUFFER_REF,
>> IN_EXPR, SET_LE_EXPR, and CARD_EXPR are dead.
>> * tree.def (BUFFER_REF, IN_EXPR, SET_LE_EXPR, CARD_EXPR): Kill.
>> cp/ChangeLog:
>> * class.c (instantiate_type): BUFFER_REF is dead.
>> * lex.c (init_operators): IN_EXPR is dead.
>
>Ok.
>
>If Pascal ever gets ported to tree-ssa, these trees can be added to
>their language-specific source, and lowered in their gimplify hook.
>
ATM Pascal is not using BUFFER_REF, SET_LE_EXPR, CARD_EXPR and FILE_TYPE
at all. IN_EXPR is expanded in the front-end and never reaches back-end.
In fact Pascal also has SYMDIFF_EXPR for symmetric difference, and in
place where we expand SYMDIFF_EXPR we handle all set operations.
However, the current way is very slow for small sets so I consider a
change. For that a fast way to implement IN_EXPR would be nice (still
x & (1<<i) in C is order of magnitude faster then current Pascal
i IN x).
FYI FILE_TYPE handling is buggy -- back-end can not generate DWARF debug
info for files (and gdb has no support for reading such info), so GNU
Pascal just uses pointers as files.
--
Waldek Hebisch
hebisch@math.uni.wroc.pl
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-10 12:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-07 3:33 [PATCH] Remove some Pascal trees from the generic Andrew Pinski
2004-07-07 19:47 ` Richard Henderson
2004-07-09 21:25 Waldek Hebisch
2004-07-10 15:53 Waldek Hebisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).