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
7947f03a
Commit
7947f03a
authored
14 years ago
by
Dan Gohman
Browse files
Options
Downloads
Patches
Plain Diff
Use C++, not C++-standard-library-internals-ese.
llvm-svn: 101245
parent
f1f0c9de
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/include/llvm/Support/CFG.h
+33
-33
33 additions, 33 deletions
llvm/include/llvm/Support/CFG.h
with
33 additions
and
33 deletions
llvm/include/llvm/Support/CFG.h
+
33
−
33
View file @
7947f03a
...
...
@@ -25,12 +25,12 @@ namespace llvm {
// BasicBlock pred_iterator definition
//===----------------------------------------------------------------------===//
template
<
class
_
Ptr
,
class
_
USE_iterator
>
// Predecessor Iterator
template
<
class
Ptr
,
class
USE_iterator
>
// Predecessor Iterator
class
PredIterator
:
public
std
::
iterator
<
std
::
forward_iterator_tag
,
_
Ptr
,
ptrdiff_t
>
{
typedef
std
::
iterator
<
std
::
forward_iterator_tag
,
_
Ptr
,
ptrdiff_t
>
super
;
typedef
PredIterator
<
_
Ptr
,
_
USE_iterator
>
_
Self
;
_
USE_iterator
It
;
Ptr
,
ptrdiff_t
>
{
typedef
std
::
iterator
<
std
::
forward_iterator_tag
,
Ptr
,
ptrdiff_t
>
super
;
typedef
PredIterator
<
Ptr
,
USE_iterator
>
Self
;
USE_iterator
It
;
inline
void
advancePastNonTerminators
()
{
// Loop to ignore non terminator uses (for example PHI nodes)...
...
...
@@ -41,13 +41,13 @@ class PredIterator : public std::iterator<std::forward_iterator_tag,
public
:
typedef
typename
super
::
pointer
pointer
;
inline
PredIterator
(
_
Ptr
*
bb
)
:
It
(
bb
->
use_begin
())
{
inline
PredIterator
(
Ptr
*
bb
)
:
It
(
bb
->
use_begin
())
{
advancePastNonTerminators
();
}
inline
PredIterator
(
_
Ptr
*
bb
,
bool
)
:
It
(
bb
->
use_end
())
{}
inline
PredIterator
(
Ptr
*
bb
,
bool
)
:
It
(
bb
->
use_end
())
{}
inline
bool
operator
==
(
const
_
Self
&
x
)
const
{
return
It
==
x
.
It
;
}
inline
bool
operator
!=
(
const
_
Self
&
x
)
const
{
return
!
operator
==
(
x
);
}
inline
bool
operator
==
(
const
Self
&
x
)
const
{
return
It
==
x
.
It
;
}
inline
bool
operator
!=
(
const
Self
&
x
)
const
{
return
!
operator
==
(
x
);
}
inline
pointer
operator
*
()
const
{
assert
(
!
It
.
atEnd
()
&&
"pred_iterator out of range!"
);
...
...
@@ -55,14 +55,14 @@ public:
}
inline
pointer
*
operator
->
()
const
{
return
&
(
operator
*
());
}
inline
_
Self
&
operator
++
()
{
// Preincrement
inline
Self
&
operator
++
()
{
// Preincrement
assert
(
!
It
.
atEnd
()
&&
"pred_iterator out of range!"
);
++
It
;
advancePastNonTerminators
();
return
*
this
;
}
inline
_
Self
operator
++
(
int
)
{
// Postincrement
_
Self
tmp
=
*
this
;
++*
this
;
return
tmp
;
inline
Self
operator
++
(
int
)
{
// Postincrement
Self
tmp
=
*
this
;
++*
this
;
return
tmp
;
}
};
...
...
@@ -91,7 +91,7 @@ class SuccIterator : public std::iterator<std::bidirectional_iterator_tag,
const
Term_
Term
;
unsigned
idx
;
typedef
std
::
iterator
<
std
::
bidirectional_iterator_tag
,
BB_
,
ptrdiff_t
>
super
;
typedef
SuccIterator
<
Term_
,
BB_
>
_
Self
;
typedef
SuccIterator
<
Term_
,
BB_
>
Self
;
inline
bool
index_is_valid
(
int
idx
)
{
return
idx
>=
0
&&
(
unsigned
)
idx
<
Term
->
getNumSuccessors
();
...
...
@@ -109,7 +109,7 @@ public:
assert
(
T
&&
"getTerminator returned null!"
);
}
inline
const
_
Self
&
operator
=
(
const
_
Self
&
I
)
{
inline
const
Self
&
operator
=
(
const
Self
&
I
)
{
assert
(
Term
==
I
.
Term
&&
"Cannot assign iterators to two different blocks!"
);
idx
=
I
.
idx
;
return
*
this
;
...
...
@@ -119,64 +119,64 @@ public:
/// operate on terminator instructions directly.
unsigned
getSuccessorIndex
()
const
{
return
idx
;
}
inline
bool
operator
==
(
const
_
Self
&
x
)
const
{
return
idx
==
x
.
idx
;
}
inline
bool
operator
!=
(
const
_
Self
&
x
)
const
{
return
!
operator
==
(
x
);
}
inline
bool
operator
==
(
const
Self
&
x
)
const
{
return
idx
==
x
.
idx
;
}
inline
bool
operator
!=
(
const
Self
&
x
)
const
{
return
!
operator
==
(
x
);
}
inline
pointer
operator
*
()
const
{
return
Term
->
getSuccessor
(
idx
);
}
inline
pointer
operator
->
()
const
{
return
operator
*
();
}
inline
_
Self
&
operator
++
()
{
++
idx
;
return
*
this
;
}
// Preincrement
inline
Self
&
operator
++
()
{
++
idx
;
return
*
this
;
}
// Preincrement
inline
_
Self
operator
++
(
int
)
{
// Postincrement
_
Self
tmp
=
*
this
;
++*
this
;
return
tmp
;
inline
Self
operator
++
(
int
)
{
// Postincrement
Self
tmp
=
*
this
;
++*
this
;
return
tmp
;
}
inline
_
Self
&
operator
--
()
{
--
idx
;
return
*
this
;
}
// Predecrement
inline
_
Self
operator
--
(
int
)
{
// Postdecrement
_
Self
tmp
=
*
this
;
--*
this
;
return
tmp
;
inline
Self
&
operator
--
()
{
--
idx
;
return
*
this
;
}
// Predecrement
inline
Self
operator
--
(
int
)
{
// Postdecrement
Self
tmp
=
*
this
;
--*
this
;
return
tmp
;
}
inline
bool
operator
<
(
const
_
Self
&
x
)
const
{
inline
bool
operator
<
(
const
Self
&
x
)
const
{
assert
(
Term
==
x
.
Term
&&
"Cannot compare iterators of different blocks!"
);
return
idx
<
x
.
idx
;
}
inline
bool
operator
<=
(
const
_
Self
&
x
)
const
{
inline
bool
operator
<=
(
const
Self
&
x
)
const
{
assert
(
Term
==
x
.
Term
&&
"Cannot compare iterators of different blocks!"
);
return
idx
<=
x
.
idx
;
}
inline
bool
operator
>=
(
const
_
Self
&
x
)
const
{
inline
bool
operator
>=
(
const
Self
&
x
)
const
{
assert
(
Term
==
x
.
Term
&&
"Cannot compare iterators of different blocks!"
);
return
idx
>=
x
.
idx
;
}
inline
bool
operator
>
(
const
_
Self
&
x
)
const
{
inline
bool
operator
>
(
const
Self
&
x
)
const
{
assert
(
Term
==
x
.
Term
&&
"Cannot compare iterators of different blocks!"
);
return
idx
>
x
.
idx
;
}
inline
_
Self
&
operator
+=
(
int
Right
)
{
inline
Self
&
operator
+=
(
int
Right
)
{
unsigned
new_idx
=
idx
+
Right
;
assert
(
index_is_valid
(
new_idx
)
&&
"Iterator index out of bound"
);
idx
=
new_idx
;
return
*
this
;
}
inline
_
Self
operator
+
(
int
Right
)
{
_
Self
tmp
=
*
this
;
inline
Self
operator
+
(
int
Right
)
{
Self
tmp
=
*
this
;
tmp
+=
Right
;
return
tmp
;
}
inline
_
Self
&
operator
-=
(
int
Right
)
{
inline
Self
&
operator
-=
(
int
Right
)
{
return
operator
+=
(
-
Right
);
}
inline
_
Self
operator
-
(
int
Right
)
{
inline
Self
operator
-
(
int
Right
)
{
return
operator
+
(
-
Right
);
}
inline
int
operator
-
(
const
_
Self
&
x
)
{
inline
int
operator
-
(
const
Self
&
x
)
{
assert
(
Term
==
x
.
Term
&&
"Cannot work on iterators of different blocks!"
);
int
distance
=
idx
-
x
.
idx
;
return
distance
;
...
...
@@ -187,7 +187,7 @@ public:
// be modified are not available.
//
// inline pointer operator[](int offset) {
//
_
Self tmp = *this;
// Self tmp = *this;
// tmp += offset;
// return tmp.operator*();
// }
...
...
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