SIL: Add builtin_zero instruction.

To represent the zero value of builtin types.

Swift SVN r4907
This commit is contained in:
Joe Groff
2013-04-25 19:50:56 +00:00
parent 618d35a00f
commit d0e0911ecf
7 changed files with 43 additions and 2 deletions

View File

@@ -874,6 +874,23 @@ public:
}
};
/// BuiltinZeroInst - Represents the zero value of a builtin integer,
/// floating-point, or pointer type.
class BuiltinZeroInst : public SILInstruction {
public:
BuiltinZeroInst(SILLocation Loc, SILType Type)
: SILInstruction(ValueKind::BuiltinZeroInst, Loc, Type) {}
ArrayRef<Operand> getAllOperands() const { return {}; }
/// getType() is ok since this is known to only have one type.
SILType getType(unsigned i = 0) const { return ValueBase::getType(i); }
static bool classof(const ValueBase *V) {
return V->getKind() == ValueKind::BuiltinZeroInst;
}
};
/// MetatypeInst - Represents the production of an instance of a given metatype
/// named statically.
class MetatypeInst : public SILInstruction {