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

Unified Diff: src/IceOperand.h

Issue 339783002: Add support for undef values in ICE IR. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Comment about uninitialized registers Created 6 years, 6 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/IceGlobalContext.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index 54ac48b88a28b83b4c0bc05c473fa1c536445c3b..00febc402327a24773d41be5e7c6cebc4cbb2b6b 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -31,6 +31,7 @@ public:
kConstFloat,
kConstDouble,
kConstRelocatable,
+ kConstUndef,
kConst_Num,
kVariable,
// Target-specific operand classes use kTarget as the starting
@@ -206,6 +207,40 @@ private:
bool SuppressMangling;
};
+// ConstantUndef represents an unspecified bit pattern. Although it is
+// legal to lower ConstantUndef to any value, backends should try to
+// make code generation deterministic by lowering ConstantUndefs to 0.
+class ConstantUndef : public Constant {
+public:
+ static ConstantUndef *create(GlobalContext *Ctx, Type Ty,
+ uint32_t PoolEntryID) {
+ return new (Ctx->allocate<ConstantUndef>()) ConstantUndef(Ty, PoolEntryID);
+ }
+
+ using Constant::emit;
+ virtual void emit(GlobalContext *Ctx) const {
+ Ostream &Str = Ctx->getStrEmit();
+ Str << "undef";
+ }
+
+ using Constant::dump;
+ virtual void dump(GlobalContext *Ctx) const {
+ Ostream &Str = Ctx->getStrEmit();
+ Str << "undef";
+ }
+
+ static bool classof(const Operand *Operand) {
+ return Operand->getKind() == kConstUndef;
+ }
+
+private:
+ ConstantUndef(Type Ty, uint32_t PoolEntryID)
+ : Constant(kConstUndef, Ty, PoolEntryID) {}
+ ConstantUndef(const ConstantUndef &) LLVM_DELETED_FUNCTION;
+ ConstantUndef &operator=(const ConstantUndef &) LLVM_DELETED_FUNCTION;
+ virtual ~ConstantUndef() {}
+};
+
// RegWeight is a wrapper for a uint32_t weight value, with a
// special value that represents infinite weight, and an addWeight()
// method that ensures that W+infinity=infinity.
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698