@@ -734,8 +734,7 @@ class SILInstruction : public llvm::ilist_node<SILInstruction> {
734734 // / Returns true if the instruction is only relevant for debug
735735 // / informations and has no other impact on program semantics.
736736 bool isDebugInstruction () const {
737- return getKind () == SILInstructionKind::DebugValueInst ||
738- getKind () == SILInstructionKind::DebugValueAddrInst;
737+ return getKind () == SILInstructionKind::DebugValueInst;
739738 }
740739
741740 // / Returns true if the instruction is a meta instruction which is
@@ -1720,8 +1719,8 @@ class UnaryInstructionWithTypeDependentOperandsBase
17201719};
17211720
17221721// / Holds common debug information about local variables and function
1723- // / arguments that are needed by DebugValueInst, DebugValueAddrInst ,
1724- // / AllocStackInst, and AllocBoxInst.
1722+ // / arguments that are needed by DebugValueInst, AllocStackInst ,
1723+ // / and AllocBoxInst.
17251724struct SILDebugVariable {
17261725 StringRef Name;
17271726 unsigned ArgNo : 16 ;
@@ -4672,6 +4671,8 @@ class DebugValueInst final
46724671 static DebugValueInst *create (SILDebugLocation DebugLoc, SILValue Operand,
46734672 SILModule &M, SILDebugVariable Var,
46744673 bool poisonRefs);
4674+ static DebugValueInst *createAddr (SILDebugLocation DebugLoc, SILValue Operand,
4675+ SILModule &M, SILDebugVariable Var);
46754676
46764677 SIL_DEBUG_VAR_SUPPLEMENT_TRAILING_OBJS_IMPL ()
46774678
@@ -4706,6 +4707,23 @@ class DebugValueInst final
47064707 *getTrailingObjects<const SILDebugScope *>() = NewDS;
47074708 }
47084709
4710+ // / Whether the SSA value associated with the current debug_value
4711+ // / instruction has an address type.
4712+ bool hasAddrVal () const {
4713+ return getOperand ()->getType ().isAddress ();
4714+ }
4715+
4716+ // / An utility to check if \p I is DebugValueInst and
4717+ // / whether it's associated with address type SSA value.
4718+ static DebugValueInst *hasAddrVal (SILInstruction *I) {
4719+ auto *DVI = dyn_cast_or_null<DebugValueInst>(I);
4720+ return DVI && DVI->hasAddrVal ()? DVI : nullptr ;
4721+ }
4722+
4723+ // / Whether the attached di-expression (if there is any) starts
4724+ // / with `op_deref`.
4725+ bool exprStartsWithDeref () const ;
4726+
47094727 // / True if all references within this debug value will be overwritten with a
47104728 // / poison sentinel at this point in the program. This is used in debug builds
47114729 // / when shortening non-trivial value lifetimes to ensure the debugger cannot
@@ -4722,58 +4740,6 @@ class DebugValueInst final
47224740 }
47234741};
47244742
4725- // / Define the start or update to a symbolic variable value (for address-only
4726- // / types) .
4727- class DebugValueAddrInst final
4728- : public UnaryInstructionBase<SILInstructionKind::DebugValueAddrInst,
4729- NonValueInstruction>,
4730- private SILDebugVariableSupplement,
4731- private llvm::TrailingObjects<DebugValueAddrInst, SILType, SILLocation,
4732- const SILDebugScope *, SILDIExprElement,
4733- char > {
4734- friend TrailingObjects;
4735- friend SILBuilder;
4736-
4737- TailAllocatedDebugVariable VarInfo;
4738-
4739- DebugValueAddrInst (SILDebugLocation DebugLoc, SILValue Operand,
4740- SILDebugVariable Var);
4741- static DebugValueAddrInst *create (SILDebugLocation DebugLoc,
4742- SILValue Operand, SILModule &M,
4743- SILDebugVariable Var);
4744-
4745- SIL_DEBUG_VAR_SUPPLEMENT_TRAILING_OBJS_IMPL ()
4746-
4747- public:
4748- // / Return the underlying variable declaration that this denotes,
4749- // / or null if we don't have one.
4750- VarDecl *getDecl () const ;
4751- // / Return the debug variable information attached to this instruction.
4752- Optional<SILDebugVariable> getVarInfo () const {
4753- Optional<SILType> AuxVarType;
4754- Optional<SILLocation> VarDeclLoc;
4755- const SILDebugScope *VarDeclScope = nullptr ;
4756- if (HasAuxDebugVariableType)
4757- AuxVarType = *getTrailingObjects<SILType>();
4758-
4759- if (hasAuxDebugLocation ())
4760- VarDeclLoc = *getTrailingObjects<SILLocation>();
4761- if (hasAuxDebugScope ())
4762- VarDeclScope = *getTrailingObjects<const SILDebugScope *>();
4763-
4764- llvm::ArrayRef<SILDIExprElement> DIExprElements (
4765- getTrailingObjects<SILDIExprElement>(), NumDIExprOperands);
4766-
4767- return VarInfo.get (getDecl (), getTrailingObjects<char >(), AuxVarType,
4768- VarDeclLoc, VarDeclScope, DIExprElements);
4769- }
4770-
4771- void setDebugVarScope (const SILDebugScope *NewDS) {
4772- if (hasAuxDebugScope ())
4773- *getTrailingObjects<const SILDebugScope *>() = NewDS;
4774- }
4775- };
4776-
47774743// / An abstract class representing a load from some kind of reference storage.
47784744template <SILInstructionKind K>
47794745class LoadReferenceInstBase
0 commit comments