Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
22087499
Commit
22087499
authored
Jul 08, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VRegSet: use a llvm bitvector as representation
parent
ef007829
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
src/core/cfg.h
src/core/cfg.h
+7
-21
No files found.
src/core/cfg.h
View file @
22087499
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
#include <vector>
#include <vector>
#include "llvm/ADT/BitVector.h"
#include "core/ast.h"
#include "core/ast.h"
#include "core/common.h"
#include "core/common.h"
#include "core/stringpool.h"
#include "core/stringpool.h"
...
@@ -203,8 +205,7 @@ public:
...
@@ -203,8 +205,7 @@ public:
class
VRegSet
{
class
VRegSet
{
private:
private:
// TODO: switch just to a bool*?
llvm
::
BitVector
v
;
std
::
vector
<
bool
>
v
;
public:
public:
VRegSet
(
int
num_vregs
)
:
v
(
num_vregs
,
false
)
{}
VRegSet
(
int
num_vregs
)
:
v
(
num_vregs
,
false
)
{}
...
@@ -219,13 +220,7 @@ public:
...
@@ -219,13 +220,7 @@ public:
v
[
vreg
]
=
true
;
v
[
vreg
]
=
true
;
}
}
int
numSet
()
const
{
int
numSet
()
const
{
return
v
.
count
();
}
int
r
=
0
;
for
(
auto
b
:
v
)
if
(
b
)
r
++
;
return
r
;
}
class
iterator
{
class
iterator
{
public:
public:
...
@@ -234,9 +229,7 @@ public:
...
@@ -234,9 +229,7 @@ public:
iterator
(
const
VRegSet
&
set
,
int
i
)
:
set
(
set
),
i
(
i
)
{}
iterator
(
const
VRegSet
&
set
,
int
i
)
:
set
(
set
),
i
(
i
)
{}
iterator
&
operator
++
()
{
iterator
&
operator
++
()
{
do
{
i
=
set
.
v
.
find_next
(
i
);
i
++
;
}
while
(
i
<
set
.
v
.
size
()
&&
!
set
.
v
[
i
]);
return
*
this
;
return
*
this
;
}
}
...
@@ -246,15 +239,8 @@ public:
...
@@ -246,15 +239,8 @@ public:
int
operator
*
()
{
return
i
;
}
int
operator
*
()
{
return
i
;
}
};
};
iterator
begin
()
const
{
iterator
begin
()
const
{
return
iterator
(
*
this
,
v
.
find_first
());
}
for
(
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
iterator
end
()
const
{
return
iterator
(
*
this
,
-
1
);
}
if
(
v
[
i
])
return
iterator
(
*
this
,
i
);
}
return
iterator
(
*
this
,
this
->
v
.
size
());
}
iterator
end
()
const
{
return
iterator
(
*
this
,
this
->
v
.
size
());
}
};
};
// VRegMap: A compact way of representing a value per vreg.
// VRegMap: A compact way of representing a value per vreg.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment