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

Unified Diff: src/IcePhiLoweringImpl.h

Issue 1223133007: Factor out prelowerPhi for 32-bit targets. Disable adv phi lowering for ARM. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fill in wqthe random test case for more undef stuff 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/IceClFlags.cpp ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IcePhiLoweringImpl.h
diff --git a/src/IcePhiLoweringImpl.h b/src/IcePhiLoweringImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf932d61e214a043016c58f2e050dd7ca17a9234
--- /dev/null
+++ b/src/IcePhiLoweringImpl.h
@@ -0,0 +1,61 @@
+//===------ subzero/src/IcePhiLoweringImpl.h - Phi lowering -----*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This contains utilities for targets to lower Phis.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_ICEPHILOWERINGIMPL_H
+#define SUBZERO_SRC_ICEPHILOWERINGIMPL_H
+
+#include "IceCfg.h"
+#include "IceCfgNode.h"
+#include "IceDefs.h"
+#include "IceInst.h"
+#include "IceOperand.h"
+
+namespace Ice {
+namespace PhiLowering {
+
+// Turn an i64 Phi instruction into a pair of i32 Phi instructions, to
+// preserve integrity of liveness analysis. This is needed for 32-bit
+// targets. This assumes the 32-bit target has loOperand, hiOperand,
+// and legalizeUndef methods. Undef values are also legalized, since
+// loOperand() and hiOperand() don't expect Undef input.
+template <class TargetT>
+void prelowerPhis32Bit(TargetT *Target, CfgNode *Node, Cfg *Func) {
+ for (Inst &I : Node->getPhis()) {
+ auto Phi = llvm::dyn_cast<InstPhi>(&I);
+ if (Phi->isDeleted())
+ continue;
+ Variable *Dest = Phi->getDest();
+ if (Dest->getType() == IceType_i64) {
+ Variable *DestLo = llvm::cast<Variable>(Target->loOperand(Dest));
+ Variable *DestHi = llvm::cast<Variable>(Target->hiOperand(Dest));
+ InstPhi *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo);
+ InstPhi *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi);
+ for (SizeT I = 0; I < Phi->getSrcSize(); ++I) {
+ Operand *Src = Phi->getSrc(I);
+ CfgNode *Label = Phi->getLabel(I);
+ Src = Target->legalizeUndef(Src);
+ PhiLo->addArgument(Target->loOperand(Src), Label);
+ PhiHi->addArgument(Target->hiOperand(Src), Label);
+ }
+ Node->getPhis().push_back(PhiLo);
+ Node->getPhis().push_back(PhiHi);
+ Phi->setDeleted();
+ }
+ }
+}
+
+} // end of namespace PhiLowering
+} // end of namespace Ice
+
+#endif // SUBZERO_SRC_ICEPHILOWERINGIMPL_H
« no previous file with comments | « src/IceClFlags.cpp ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698