[llvm] [RemoveDIs][DebugInfo][NFC] Add Instruction and convenience functions to DPValue (PR #77896)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 12 09:14:18 PST 2024
================
@@ -41,6 +41,36 @@ DPValue::DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
void DPValue::deleteInstr() { delete this; }
+DPValue *DPValue::createDPValue(Value *Location, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ Instruction *InsertBefore) {
+ auto *NewDPValue = new DPValue(ValueAsMetadata::get(Location), DV, Expr, DI,
+ LocationType::Value);
+ if (InsertBefore)
+ InsertBefore->getParent()->insertDPValueBefore(NewDPValue,
+ InsertBefore->getIterator());
----------------
jmorse wrote:
You miiiggghht be able to predeclare it as `SymbolTableList<Instruction, ilist_iterator_bits<true>>::iterator;` without needing a body definition for Instruction.
Removing and adding when necessary seems alright -- hopefully we can avoid it being necessary.
https://github.com/llvm/llvm-project/pull/77896
More information about the llvm-commits
mailing list