Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LLVM bpEVL
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Albano
LLVM bpEVL
Commits
9ee4836d
Commit
9ee4836d
authored
17 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
enumerate the operands of a constant before we enumerate the constant itself
This avoids fwd references in the reader. llvm-svn: 36822
parent
f25f710c
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+22
-9
22 additions, 9 deletions
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
with
22 additions
and
9 deletions
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+
22
−
9
View file @
9ee4836d
...
...
@@ -165,11 +165,10 @@ void ValueEnumerator::EnumerateValue(const Value *V) {
Values
[
ValueID
-
1
].
second
++
;
return
;
}
// Add the value.
Values
.
push_back
(
std
::
make_pair
(
V
,
1U
));
ValueID
=
Values
.
size
();
// Enumerate the type of this value.
EnumerateType
(
V
->
getType
());
if
(
const
Constant
*
C
=
dyn_cast
<
Constant
>
(
V
))
{
if
(
isa
<
GlobalValue
>
(
C
))
{
// Initializers for globals are handled explicitly elsewhere.
...
...
@@ -177,16 +176,30 @@ void ValueEnumerator::EnumerateValue(const Value *V) {
// Do not enumerate the initializers for an array of simple characters.
// The initializers just polute the value table, and we emit the strings
// specially.
}
else
{
// This makes sure that if a constant has uses (for example an array of
// const ints), that they are inserted also.
}
else
if
(
C
->
getNumOperands
())
{
// If a constant has operands, enumerate them. This makes sure that if a
// constant has uses (for example an array of const ints), that they are
// inserted also.
// We prefer to enumerate them with values before we enumerate the user
// itself. This makes it more likely that we can avoid forward references
// in the reader. We know that there can be no cycles in the constants
// graph that don't go through a global variable.
for
(
User
::
const_op_iterator
I
=
C
->
op_begin
(),
E
=
C
->
op_end
();
I
!=
E
;
++
I
)
EnumerateValue
(
*
I
);
// Finally, add the value. Doing this could make the ValueID reference be
// dangling, don't reuse it.
Values
.
push_back
(
std
::
make_pair
(
V
,
1U
));
ValueMap
[
V
]
=
Values
.
size
();
return
;
}
}
EnumerateType
(
V
->
getType
());
// Add the value.
Values
.
push_back
(
std
::
make_pair
(
V
,
1U
));
ValueID
=
Values
.
size
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment