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. |