@@ -23,28 +23,36 @@ class SILInstruction;
2323class SILModule ;
2424
2525class SILUndef : public ValueBase {
26- SILUndef (SILType type);
26+ // / A back pointer to the function that this SILUndef is uniqued by.
27+ SILFunction *parent;
28+
29+ SILUndef (SILFunction *parent, SILType type);
2730
2831public:
2932 void operator =(const SILArgument &) = delete ;
3033 void operator delete (void *, size_t ) = delete ;
3134
32- static SILUndef *get (SILType ty, SILModule &m);
33-
3435 // / Return a SILUndef with the same type as the passed in value.
3536 static SILUndef *get (SILValue value) {
36- return SILUndef::get (value->getType (), * value->getModule ());
37+ return SILUndef::get (value->getFunction (), value->getType ());
3738 }
3839
39- static SILUndef *get (SILType ty, const SILFunction &f);
40+ static SILUndef *get (SILFunction *f, SILType ty);
41+ static SILUndef *get (SILFunction &f, SILType ty) {
42+ return SILUndef::get (&f, ty);
43+ }
4044
45+ // / This is an API only used by SILSSAUpdater... please do not use it anywhere
46+ // / else.
4147 template <class OwnerTy >
42- static SILUndef *getSentinelValue (SILType type, OwnerTy owner) {
48+ static SILUndef *getSentinelValue (SILFunction *fn, OwnerTy owner,
49+ SILType type) {
4350 // Ownership kind isn't used here, the value just needs to have a unique
4451 // address.
45- return new (*owner) SILUndef (type);
52+ return new (*owner) SILUndef (fn, type);
4653 }
4754
55+ SILFunction *getParent () const { return parent; }
4856 ValueOwnershipKind getOwnershipKind () const { return OwnershipKind::None; }
4957
5058 static bool classof (const SILArgument *) = delete;
0 commit comments