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
e4bbad63
Commit
e4bbad63
authored
17 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
enumerate parameter attr lists.
llvm-svn: 36709
parent
47045275
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+17
-0
17 additions, 0 deletions
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/lib/Bitcode/Writer/ValueEnumerator.h
+16
-0
16 additions, 0 deletions
llvm/lib/Bitcode/Writer/ValueEnumerator.h
with
33 additions
and
0 deletions
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+
17
−
0
View file @
e4bbad63
...
...
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include
"ValueEnumerator.h"
#include
"llvm/DerivedTypes.h"
#include
"llvm/Module.h"
#include
"llvm/TypeSymbolTable.h"
#include
"llvm/ValueSymbolTable.h"
...
...
@@ -143,8 +144,24 @@ void ValueEnumerator::EnumerateType(const Type *Ty) {
for
(
Type
::
subtype_iterator
I
=
Ty
->
subtype_begin
(),
E
=
Ty
->
subtype_end
();
I
!=
E
;
++
I
)
EnumerateType
(
*
I
);
// If this is a function type, enumerate the param attrs.
if
(
const
FunctionType
*
FTy
=
dyn_cast
<
FunctionType
>
(
Ty
))
EnumerateParamAttrs
(
FTy
->
getParamAttrs
());
}
void
ValueEnumerator
::
EnumerateParamAttrs
(
const
ParamAttrsList
*
PAL
)
{
if
(
PAL
==
0
)
return
;
// null is always 0.
// Do a lookup.
unsigned
&
Entry
=
ParamAttrMap
[
PAL
];
if
(
Entry
==
0
)
{
// Never saw this before, add it.
ParamAttrs
.
push_back
(
PAL
);
Entry
=
ParamAttrs
.
size
();
}
}
/// PurgeAggregateValues - If there are any aggregate values at the end of the
/// value list, remove them and return the count of the remaining values. If
/// there are none, return -1.
...
...
This diff is collapsed.
Click to expand it.
llvm/lib/Bitcode/Writer/ValueEnumerator.h
+
16
−
0
View file @
e4bbad63
...
...
@@ -24,6 +24,7 @@ class Value;
class
BasicBlock
;
class
Function
;
class
Module
;
class
ParamAttrsList
;
class
TypeSymbolTable
;
class
ValueSymbolTable
;
...
...
@@ -43,6 +44,10 @@ private:
ValueMapType
ValueMap
;
ValueList
Values
;
typedef
DenseMap
<
const
ParamAttrsList
*
,
unsigned
>
ParamAttrMapType
;
ParamAttrMapType
ParamAttrMap
;
std
::
vector
<
const
ParamAttrsList
*>
ParamAttrs
;
/// BasicBlocks - This contains all the basic blocks for the currently
/// incorporated function. Their reverse mapping is stored in ValueMap.
std
::
vector
<
const
BasicBlock
*>
BasicBlocks
;
...
...
@@ -69,6 +74,13 @@ public:
assert
(
I
!=
TypeMap
.
end
()
&&
"Type not in ValueEnumerator!"
);
return
I
->
second
-
1
;
}
unsigned
getParamAttrID
(
const
ParamAttrsList
*
PAL
)
const
{
if
(
PAL
==
0
)
return
0
;
// Null maps to zero.
ParamAttrMapType
::
const_iterator
I
=
ParamAttrMap
.
find
(
PAL
);
assert
(
I
!=
ParamAttrMap
.
end
()
&&
"ParamAttr not in ValueEnumerator!"
);
return
I
->
second
;
}
/// getFunctionConstantRange - Return the range of values that corresponds to
/// function-local constants.
...
...
@@ -82,6 +94,9 @@ public:
const
std
::
vector
<
const
BasicBlock
*>
&
getBasicBlocks
()
const
{
return
BasicBlocks
;
}
const
std
::
vector
<
const
ParamAttrsList
*>
getParamAttrs
()
const
{
return
ParamAttrs
;
}
/// PurgeAggregateValues - If there are any aggregate values at the end of the
/// value list, remove them and return the count of the remaining values. If
...
...
@@ -97,6 +112,7 @@ public:
private
:
void
EnumerateValue
(
const
Value
*
V
);
void
EnumerateType
(
const
Type
*
T
);
void
EnumerateParamAttrs
(
const
ParamAttrsList
*
PAL
);
void
EnumerateTypeSymbolTable
(
const
TypeSymbolTable
&
ST
);
void
EnumerateValueSymbolTable
(
const
ValueSymbolTable
&
ST
);
...
...
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