aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/JSBackend/Relooper.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-28 10:50:14 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-12-28 10:50:14 -0800
commitaaea39aa761c07e058366e77095c63aba91b9bfe (patch)
tree35f57a6c520d656a83ed9531784b03b3cfbabcec /lib/Target/JSBackend/Relooper.cpp
parent81afe65c6fa734101c96dc99ec10b1aed3f43602 (diff)
relooper update
Diffstat (limited to 'lib/Target/JSBackend/Relooper.cpp')
-rw-r--r--lib/Target/JSBackend/Relooper.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Target/JSBackend/Relooper.cpp b/lib/Target/JSBackend/Relooper.cpp
index fc7b3ea777..70cf844bd9 100644
--- a/lib/Target/JSBackend/Relooper.cpp
+++ b/lib/Target/JSBackend/Relooper.cpp
@@ -101,9 +101,7 @@ void Branch::Render(Block *Target, bool SetLabel) {
// Block
-int Block::IdCounter = 1; // 0 is reserved for clearings
-
-Block::Block(const char *CodeInit, const char *BranchVarInit) : Parent(NULL), Id(Block::IdCounter++), IsCheckedMultipleEntry(false) {
+Block::Block(const char *CodeInit, const char *BranchVarInit) : Parent(NULL), Id(-1), IsCheckedMultipleEntry(false) {
Code = strdup(CodeInit);
BranchVar = BranchVarInit ? strdup(BranchVarInit) : NULL;
}
@@ -273,10 +271,6 @@ void Block::Render(bool InLoop) {
}
}
-// Shape
-
-int Shape::IdCounter = 0;
-
// MultipleShape
void MultipleShape::RenderLoopPrefix() {
@@ -360,7 +354,7 @@ void EmulatedShape::Render(bool InLoop) {
// Relooper
-Relooper::Relooper() : Root(NULL), Emulate(false) {
+Relooper::Relooper() : Root(NULL), Emulate(false), BlockIdCounter(1), ShapeIdCounter(0) { // block ID 0 is reserved for clearings
}
Relooper::~Relooper() {
@@ -369,6 +363,7 @@ Relooper::~Relooper() {
}
void Relooper::AddBlock(Block *New) {
+ New->Id = BlockIdCounter++;
Blocks.push_back(New);
}
@@ -473,6 +468,7 @@ void Relooper::Calculate(Block *Entry) {
// Add a shape to the list of shapes in this Relooper calculation
void Notice(Shape *New) {
+ New->Id = Parent->ShapeIdCounter++;
Parent->Shapes.push_back(New);
}