Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
d5f67d8c
Commit
d5f67d8c
authored
20 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
Implement UndefValue class
llvm-svn: 17040
parent
38a69698
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/lib/VMCore/Constants.cpp
+45
-0
45 additions, 0 deletions
llvm/lib/VMCore/Constants.cpp
with
45 additions
and
0 deletions
llvm/lib/VMCore/Constants.cpp
+
45
−
0
View file @
d5f67d8c
...
...
@@ -1098,6 +1098,51 @@ void ConstantPointerNull::destroyConstant() {
}
//---- UndefValue::get() implementation...
//
namespace
llvm
{
// UndefValue does not take extra "value" argument...
template
<
class
ValType
>
struct
ConstantCreator
<
UndefValue
,
Type
,
ValType
>
{
static
UndefValue
*
create
(
const
Type
*
Ty
,
const
ValType
&
V
)
{
return
new
UndefValue
(
Ty
);
}
};
template
<
>
struct
ConvertConstantType
<
UndefValue
,
Type
>
{
static
void
convert
(
UndefValue
*
OldC
,
const
Type
*
NewTy
)
{
// Make everyone now use a constant of the new type.
Constant
*
New
=
UndefValue
::
get
(
NewTy
);
assert
(
New
!=
OldC
&&
"Didn't replace constant??"
);
OldC
->
uncheckedReplaceAllUsesWith
(
New
);
OldC
->
destroyConstant
();
// This constant is now dead, destroy it.
}
};
}
static
ValueMap
<
char
,
Type
,
UndefValue
>
UndefValueConstants
;
static
char
getValType
(
UndefValue
*
)
{
return
0
;
}
UndefValue
*
UndefValue
::
get
(
const
Type
*
Ty
)
{
return
UndefValueConstants
.
getOrCreate
(
Ty
,
0
);
}
// destroyConstant - Remove the constant from the constant table.
//
void
UndefValue
::
destroyConstant
()
{
UndefValueConstants
.
remove
(
this
);
destroyConstantImpl
();
}
//---- ConstantExpr::get() implementations...
//
typedef
std
::
pair
<
unsigned
,
std
::
vector
<
Constant
*>
>
ExprMapKeyType
;
...
...
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