aboutsummaryrefslogtreecommitdiff
path: root/src/relooper/Relooper.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-02 12:24:21 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-02-02 12:24:21 -0800
commit73313a7ef6ab384a3130e50f4904b8ae232cf4a5 (patch)
tree03c12a015074df956b930ea38e9b7e9919b042c2 /src/relooper/Relooper.cpp
parent0b2a80ba3907b7e61b0877e2a1ec2a7454770d47 (diff)
always use labels in multiple blocks; emit no more one-time loops but rather labeled ifs1.2.4
Diffstat (limited to 'src/relooper/Relooper.cpp')
-rw-r--r--src/relooper/Relooper.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index ae8577b1..6ea9e7f4 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -253,20 +253,11 @@ int Shape::IdCounter = 0;
void MultipleShape::RenderLoopPrefix() {
if (NeedLoop) {
- if (Labeled) {
- PrintIndented("L%d: do {\n", Id);
- } else {
- PrintIndented("do {\n");
- }
- Indenter::Indent();
+ PrintIndented("L%d: \n", Id);
}
}
void MultipleShape::RenderLoopPostfix() {
- if (NeedLoop) {
- Indenter::Unindent();
- PrintIndented("} while(0);\n");
- }
}
void MultipleShape::Render(bool InLoop) {
@@ -921,7 +912,10 @@ void Relooper::Calculate(Block *Entry) {
Branch *Details = iter->second;
if (Details->Type != Branch::Direct) {
assert(LoopStack.size() > 0);
- if (Details->Ancestor != LoopStack.top()) {
+ // If the ancestor is not at the top of the stack, we need a labelled break. We also
+ // always need a labeled break for multiple blocks, which are always labeled.
+ MultipleShape *Multiple;
+ if (Details->Ancestor != LoopStack.top() || Shape::IsMultiple(Details->Ancestor)) {
LabeledShape *Labeled = Shape::IsLabeled(Details->Ancestor);
Labeled->Labeled = true;
Details->Labeled = true;