Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: src/IceSwitchLowering.cpp

Issue 1257283004: Iasm and obj lowering for advanced switch lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceSwitchLowering.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceSwitchLowering.cpp
diff --git a/src/IceSwitchLowering.cpp b/src/IceSwitchLowering.cpp
index 37e67c12c005651223b84d13b1738b9e2b149a9f..53f789035cdcb4a3986eb65fa40242ca7fc1824c 100644
--- a/src/IceSwitchLowering.cpp
+++ b/src/IceSwitchLowering.cpp
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "IceSwitchLowering.h"
+#include "IceCfgNode.h"
#include "IceTargetLowering.h"
#include <algorithm>
@@ -79,9 +80,11 @@ CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func,
// Case.High could be UINT64_MAX which makes the loop awkward. Unwrap the
// last iteration to avoid wrap around problems.
for (uint64_t I = Case.Low; I < Case.High; ++I)
- JumpTable->addTarget(I - MinValue, Case.Label);
- JumpTable->addTarget(Case.High - MinValue, Case.Label);
+ JumpTable->addTarget(I - MinValue, Case.Target);
+ JumpTable->addTarget(Case.High - MinValue, Case.Target);
+ Case.Target->setNeedsAlignment();
}
+ Func->addJumpTable(JumpTable);
CaseClusters.clear();
CaseClusters.emplace_back(MinValue, MaxValue, JumpTable);
@@ -91,7 +94,7 @@ CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func,
bool CaseCluster::tryAppend(const CaseCluster &New) {
// Can only append ranges with the same target and are adjacent
- bool CanAppend = this->Label == New.Label && this->High + 1 == New.Low;
+ bool CanAppend = this->Target == New.Target && this->High + 1 == New.Low;
if (CanAppend)
this->High = New.High;
return CanAppend;
« no previous file with comments | « src/IceSwitchLowering.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698