Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
cd7ece66
Commit
cd7ece66
authored
Feb 10, 1995
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fold): Don't modify tree with newly-allocated nodes; instead make new
tree in those cases. From-SVN: r8901
parent
35c2dbf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
27 deletions
+30
-27
gcc/fold-const.c
+30
-27
No files found.
gcc/fold-const.c
View file @
cd7ece66
...
...
@@ -3663,10 +3663,8 @@ fold (expr)
return
t
;
/* Otherwise return (CON +- ARG1) - VAR. */
TREE_SET_CODE
(
t
,
MINUS_EXPR
);
TREE_OPERAND
(
t
,
1
)
=
var
;
TREE_OPERAND
(
t
,
0
)
=
fold
(
build
(
code
,
TREE_TYPE
(
t
),
con
,
arg1
));
t
=
build
(
MINUS_EXPR
,
type
,
fold
(
build
(
code
,
type
,
con
,
arg1
)),
var
);
}
else
{
...
...
@@ -3682,9 +3680,9 @@ fold (expr)
return
t
;
/* Otherwise return VAR +- (ARG1 +- CON). */
TREE_OPERAND
(
t
,
1
)
=
tem
=
fold
(
build
(
code
,
TREE_TYPE
(
t
),
arg1
,
con
)
);
TREE_OPERAND
(
t
,
0
)
=
var
;
tem
=
fold
(
build
(
code
,
type
,
arg1
,
con
));
t
=
build
(
code
,
type
,
var
,
tem
);
if
(
integer_zerop
(
tem
)
&&
(
code
==
PLUS_EXPR
||
code
==
MINUS_EXPR
))
return
convert
(
type
,
var
);
...
...
@@ -3725,9 +3723,9 @@ fold (expr)
convert
(
TREE_TYPE
(
t
),
con
)));
}
TREE_OPERAND
(
t
,
0
)
=
fold
(
build
(
code
,
TREE_TYPE
(
t
),
arg0
,
con
)
);
TREE_OPERAND
(
t
,
1
)
=
var
;
t
=
build
(
TREE_CODE
(
t
),
type
,
fold
(
build
(
code
,
TREE_TYPE
(
t
),
arg0
,
con
)),
var
);
if
(
integer_zerop
(
TREE_OPERAND
(
t
,
0
))
&&
TREE_CODE
(
t
)
==
PLUS_EXPR
)
return
convert
(
TREE_TYPE
(
t
),
var
);
...
...
@@ -4270,12 +4268,12 @@ fold (expr)
and the other one. */
{
tree
constop
=
0
,
varop
;
tree
*
constoploc
;
int
constopnum
=
-
1
;
if
(
TREE_CONSTANT
(
arg1
))
constop
loc
=
&
TREE_OPERAND
(
t
,
1
)
,
constop
=
arg1
,
varop
=
arg0
;
constop
num
=
1
,
constop
=
arg1
,
varop
=
arg0
;
if
(
TREE_CONSTANT
(
arg0
))
constop
loc
=
&
TREE_OPERAND
(
t
,
0
)
,
constop
=
arg0
,
varop
=
arg1
;
constop
num
=
0
,
constop
=
arg0
,
varop
=
arg1
;
if
(
constop
&&
TREE_CODE
(
varop
)
==
POSTINCREMENT_EXPR
)
{
...
...
@@ -4291,7 +4289,10 @@ fold (expr)
=
fold
(
build
(
PLUS_EXPR
,
TREE_TYPE
(
varop
),
constop
,
TREE_OPERAND
(
varop
,
1
)));
TREE_SET_CODE
(
varop
,
PREINCREMENT_EXPR
);
*
constoploc
=
newconst
;
t
=
build
(
code
,
type
,
TREE_OPERAND
(
t
,
0
),
TREE_OPERAND
(
t
,
1
));
TREE_OPERAND
(
t
,
constopnum
)
=
newconst
;
return
t
;
}
}
...
...
@@ -4305,7 +4306,9 @@ fold (expr)
=
fold
(
build
(
MINUS_EXPR
,
TREE_TYPE
(
varop
),
constop
,
TREE_OPERAND
(
varop
,
1
)));
TREE_SET_CODE
(
varop
,
PREDECREMENT_EXPR
);
*
constoploc
=
newconst
;
t
=
build
(
code
,
type
,
TREE_OPERAND
(
t
,
0
),
TREE_OPERAND
(
t
,
1
));
TREE_OPERAND
(
t
,
constopnum
)
=
newconst
;
return
t
;
}
}
...
...
@@ -4320,16 +4323,15 @@ fold (expr)
{
case
GE_EXPR
:
code
=
GT_EXPR
;
TREE_SET_CODE
(
t
,
code
);
arg1
=
const_binop
(
MINUS_EXPR
,
arg1
,
integer_one_node
,
0
);
TREE_OPERAND
(
t
,
1
)
=
arg1
;
t
=
build
(
code
,
type
,
TREE_OPERAND
(
t
,
0
),
arg1
)
;
break
;
case
LT_EXPR
:
code
=
LE_EXPR
;
TREE_SET_CODE
(
t
,
code
);
arg1
=
const_binop
(
MINUS_EXPR
,
arg1
,
integer_one_node
,
0
);
TREE_OPERAND
(
t
,
1
)
=
arg1
;
t
=
build
(
code
,
type
,
TREE_OPERAND
(
t
,
0
),
arg1
);
break
;
}
}
...
...
@@ -4734,10 +4736,10 @@ fold (expr)
if
(
TREE_CODE
(
tem
)
!=
TRUTH_NOT_EXPR
)
{
arg0
=
TREE_OPERAND
(
t
,
0
)
=
tem
;
t
=
build
(
code
,
type
,
tem
,
TREE_OPERAND
(
t
,
2
),
TREE_OPERAND
(
t
,
1
));
arg0
=
tem
;
arg1
=
TREE_OPERAND
(
t
,
2
);
TREE_OPERAND
(
t
,
2
)
=
TREE_OPERAND
(
t
,
1
);
TREE_OPERAND
(
t
,
1
)
=
arg1
;
STRIP_NOPS
(
arg1
);
}
}
...
...
@@ -4837,8 +4839,9 @@ fold (expr)
{
case
EQ_EXPR
:
/* We can replace A with C1 in this case. */
arg1
=
TREE_OPERAND
(
t
,
1
)
=
convert
(
type
,
TREE_OPERAND
(
arg0
,
1
));
arg1
=
convert
(
type
,
TREE_OPERAND
(
arg0
,
1
));
t
=
build
(
code
,
type
,
TREE_OPERAND
(
t
,
0
),
arg1
,
TREE_OPERAND
(
t
,
2
));
break
;
case
LT_EXPR
:
...
...
@@ -4898,10 +4901,10 @@ fold (expr)
if
(
TREE_CODE
(
tem
)
!=
TRUTH_NOT_EXPR
)
{
arg0
=
TREE_OPERAND
(
t
,
0
)
=
tem
;
t
=
build
(
code
,
type
,
tem
,
TREE_OPERAND
(
t
,
2
),
TREE_OPERAND
(
t
,
1
));
arg0
=
tem
;
arg1
=
TREE_OPERAND
(
t
,
2
);
TREE_OPERAND
(
t
,
2
)
=
TREE_OPERAND
(
t
,
1
);
TREE_OPERAND
(
t
,
1
)
=
arg1
;
STRIP_NOPS
(
arg1
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment