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
48f25c7a
Commit
48f25c7a
authored
Sep 10, 1992
by
Timothy Moore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(shorten_branches): Do shorten branches with delay slots
if the number of delay slots is constant. From-SVN: r2098
parent
ed50ab35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
10 deletions
+50
-10
gcc/final.c
+50
-10
No files found.
gcc/final.c
View file @
48f25c7a
...
@@ -527,13 +527,15 @@ shorten_branches (first)
...
@@ -527,13 +527,15 @@ shorten_branches (first)
else
if
(
GET_CODE
(
body
)
==
SEQUENCE
)
else
if
(
GET_CODE
(
body
)
==
SEQUENCE
)
{
{
int
i
;
int
i
;
int
const_delay_slots
;
#ifdef DELAY_SLOTS
const_delay_slots
=
const_num_delay_slots
(
XVECEXP
(
body
,
0
,
1
));
#else
const_delay_slots
=
0
;
#endif
/* Inside a delay slot sequence, we do not do any branch shortening
/* Inside a delay slot sequence, we do not do any branch shortening
(on the only machine known to have both variable-length branches
if the shortening could change the number of delay slots
and delay slots, the ROMP, branch-with-execute is the same size
of the branch. */
as the maximum branch anyway). So we only have to handle normal
insns (actually, reorg never puts ASM insns in a delay slot, but
we don't take advantage of that knowledge here). */
for
(
i
=
0
;
i
<
XVECLEN
(
body
,
0
);
i
++
)
for
(
i
=
0
;
i
<
XVECLEN
(
body
,
0
);
i
++
)
{
{
rtx
inner_insn
=
XVECEXP
(
body
,
0
,
i
);
rtx
inner_insn
=
XVECEXP
(
body
,
0
,
i
);
...
@@ -547,7 +549,16 @@ shorten_branches (first)
...
@@ -547,7 +549,16 @@ shorten_branches (first)
inner_length
=
insn_default_length
(
inner_insn
);
inner_length
=
insn_default_length
(
inner_insn
);
insn_lengths
[
inner_uid
]
=
inner_length
;
insn_lengths
[
inner_uid
]
=
inner_length
;
varying_length
[
inner_uid
]
=
0
;
if
(
const_delay_slots
)
{
if
((
varying_length
[
inner_uid
]
=
insn_variable_length_p
(
inner_insn
))
!=
0
)
varying_length
[
uid
]
=
1
;
insn_addresses
[
inner_uid
]
=
(
insn_current_address
+
insn_lengths
[
uid
]);
}
else
varying_length
[
inner_uid
]
=
0
;
insn_lengths
[
uid
]
+=
inner_length
;
insn_lengths
[
uid
]
+=
inner_length
;
}
}
}
}
...
@@ -572,16 +583,45 @@ shorten_branches (first)
...
@@ -572,16 +583,45 @@ shorten_branches (first)
something_changed
=
0
;
something_changed
=
0
;
for
(
insn_current_address
=
FIRST_INSN_ADDRESS
,
insn
=
first
;
for
(
insn_current_address
=
FIRST_INSN_ADDRESS
,
insn
=
first
;
insn
!=
0
;
insn
!=
0
;
insn
_current_address
+=
insn_lengths
[
uid
],
insn
=
NEXT_INSN
(
insn
))
insn
=
NEXT_INSN
(
insn
))
{
{
int
new_length
;
int
new_length
;
uid
=
INSN_UID
(
insn
);
uid
=
INSN_UID
(
insn
);
insn_addresses
[
uid
]
=
insn_current_address
;
insn_addresses
[
uid
]
=
insn_current_address
;
if
(
!
varying_length
[
uid
])
if
(
!
varying_length
[
uid
])
continue
;
{
insn_current_address
+=
insn_lengths
[
uid
];
continue
;
}
if
(
GET_CODE
(
insn
)
==
INSN
&&
GET_CODE
(
PATTERN
(
insn
))
==
SEQUENCE
)
{
int
i
;
body
=
PATTERN
(
insn
);
new_length
=
0
;
for
(
i
=
0
;
i
<
XVECLEN
(
body
,
0
);
i
++
)
{
rtx
inner_insn
=
XVECEXP
(
body
,
0
,
i
);
int
inner_uid
=
INSN_UID
(
inner_insn
);
int
inner_length
;
new_length
=
insn_current_length
(
insn
);
insn_addresses
[
inner_uid
]
=
insn_current_address
;
inner_length
=
insn_current_length
(
inner_insn
);
if
(
inner_length
!=
insn_lengths
[
inner_uid
])
{
insn_lengths
[
inner_uid
]
=
inner_length
;
something_changed
=
1
;
}
insn_current_address
+=
insn_lengths
[
inner_uid
];
new_length
+=
inner_length
;
}
}
else
{
new_length
=
insn_current_length
(
insn
);
insn_current_address
+=
new_length
;
}
if
(
new_length
!=
insn_lengths
[
uid
])
if
(
new_length
!=
insn_lengths
[
uid
])
{
{
insn_lengths
[
uid
]
=
new_length
;
insn_lengths
[
uid
]
=
new_length
;
...
...
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