diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-10-02 08:52:17 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-10-02 08:52:17 +0000 |
commit | abb5d70537f83ab31d02f0adfc0e9e559b82b41a (patch) | |
tree | fbb3f33157826fbf0d0a9efcc6fccd16a1fe4a48 /gcc/tree.c | |
parent | fee35a4254cab01162ec25944ca5689472566fc7 (diff) | |
download | gcc-abb5d70537f83ab31d02f0adfc0e9e559b82b41a.tar.gz |
* tree.c (build): Don't look at TREE_SIDE_EFFECTS or TREE_RAISES
for non-trees.
(build1): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29764 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index ec85e926b6c..25e2680e1b3 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2990,6 +2990,7 @@ build VPROTO((enum tree_code code, tree tt, ...)) register tree t; register int length; register int i; + int fro; VA_START (p, tt); @@ -3002,6 +3003,12 @@ build VPROTO((enum tree_code code, tree tt, ...)) length = tree_code_length[(int) code]; TREE_TYPE (t) = tt; + /* Below, we automatically set TREE_SIDE_EFFECTS and TREE_RAISED for + the result based on those same flags for the arguments. But, if + the arguments aren't really even `tree' expressions, we shouldn't + be trying to do this. */ + fro = first_rtl_op (code); + if (length == 2) { /* This is equivalent to the loop below, but faster. */ @@ -3009,11 +3016,20 @@ build VPROTO((enum tree_code code, tree tt, ...)) register tree arg1 = va_arg (p, tree); TREE_OPERAND (t, 0) = arg0; TREE_OPERAND (t, 1) = arg1; - if ((arg0 && TREE_SIDE_EFFECTS (arg0)) - || (arg1 && TREE_SIDE_EFFECTS (arg1))) - TREE_SIDE_EFFECTS (t) = 1; - TREE_RAISES (t) - = (arg0 && TREE_RAISES (arg0)) || (arg1 && TREE_RAISES (arg1)); + if (arg0 && fro > 0) + { + if (TREE_SIDE_EFFECTS (arg0)) + TREE_SIDE_EFFECTS (t) = 1; + if (TREE_RAISES (arg0)) + TREE_RAISES (t) = 1; + } + if (arg1 && fro > 1) + { + if (TREE_SIDE_EFFECTS (arg1)) + TREE_SIDE_EFFECTS (t) = 1; + if (TREE_RAISES (arg1)) + TREE_RAISES (t) = 1; + } } else if (length == 1) { @@ -3023,9 +3039,12 @@ build VPROTO((enum tree_code code, tree tt, ...)) if (TREE_CODE_CLASS (code) != 's') abort (); TREE_OPERAND (t, 0) = arg0; - if (arg0 && TREE_SIDE_EFFECTS (arg0)) - TREE_SIDE_EFFECTS (t) = 1; - TREE_RAISES (t) = (arg0 && TREE_RAISES (arg0)); + if (fro > 0) + { + if (arg0 && TREE_SIDE_EFFECTS (arg0)) + TREE_SIDE_EFFECTS (t) = 1; + TREE_RAISES (t) = (arg0 && TREE_RAISES (arg0)); + } } else { @@ -3033,7 +3052,7 @@ build VPROTO((enum tree_code code, tree tt, ...)) { register tree operand = va_arg (p, tree); TREE_OPERAND (t, i) = operand; - if (operand) + if (operand && fro > i) { if (TREE_SIDE_EFFECTS (operand)) TREE_SIDE_EFFECTS (t) = 1; @@ -3090,7 +3109,7 @@ build1 (code, type, node) TREE_PERMANENT (t) = 1; TREE_OPERAND (t, 0) = node; - if (node) + if (node && first_rtl_op (code) != 0) { if (TREE_SIDE_EFFECTS (node)) TREE_SIDE_EFFECTS (t) = 1; |