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
72e39580
Commit
72e39580
authored
17 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
add a Constant::getAllOnesValue helper function, which works on integers
AND vectors. llvm-svn: 37586
parent
1edec381
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/include/llvm/Constant.h
+5
-0
5 additions, 0 deletions
llvm/include/llvm/Constant.h
llvm/lib/VMCore/Constants.cpp
+5
-0
5 additions, 0 deletions
llvm/lib/VMCore/Constants.cpp
with
10 additions
and
0 deletions
llvm/include/llvm/Constant.h
+
5
−
0
View file @
72e39580
...
@@ -48,6 +48,11 @@ public:
...
@@ -48,6 +48,11 @@ public:
///
///
static
Constant
*
getNullValue
(
const
Type
*
Ty
);
static
Constant
*
getNullValue
(
const
Type
*
Ty
);
/// Static constructor to get a '-1' constant. This supports integers and
/// vectors.
///
static
Constant
*
getAllOnesValue
(
const
Type
*
Ty
);
/// isNullValue - Return true if this is the value that would be returned by
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
/// getNullValue.
virtual
bool
isNullValue
()
const
=
0
;
virtual
bool
isNullValue
()
const
=
0
;
...
...
This diff is collapsed.
Click to expand it.
llvm/lib/VMCore/Constants.cpp
+
5
−
0
View file @
72e39580
...
@@ -122,6 +122,11 @@ Constant *Constant::getNullValue(const Type *Ty) {
...
@@ -122,6 +122,11 @@ Constant *Constant::getNullValue(const Type *Ty) {
}
}
}
}
Constant
*
Constant
::
getAllOnesValue
(
const
Type
*
Ty
)
{
if
(
const
IntegerType
*
ITy
=
dyn_cast
<
IntegerType
>
(
Ty
))
return
ConstantInt
::
get
(
APInt
::
getAllOnesValue
(
ITy
->
getBitWidth
()));
return
ConstantVector
::
getAllOnesValue
(
cast
<
VectorType
>
(
Ty
));
}
// Static constructor to create an integral constant with all bits set
// Static constructor to create an integral constant with all bits set
ConstantInt
*
ConstantInt
::
getAllOnesValue
(
const
Type
*
Ty
)
{
ConstantInt
*
ConstantInt
::
getAllOnesValue
(
const
Type
*
Ty
)
{
...
...
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