[llvm] [RemoveDIs][NFC] Rename DPMarker->DbgMarker (PR #85931)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 20 06:56:11 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Stephen Tozer (SLTozer)
<details>
<summary>Changes</summary>
Another trivial rename patch, the last big one for now, which renamed DPMarkers to DbgMarkers. This required the field `DbgMarker` in `Instruction` to be renamed to `DebugMarker` to avoid a clash, but otherwise was a simple string substitution of `s/DPMarker/DbgMarker` and a manual renaming of `DPM` to `DM` in the few places where that acronym was used for debug markers.
---
Patch is 70.42 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/85931.diff
17 Files Affected:
- (modified) llvm/docs/RemoveDIsDebugInfo.md (+7-7)
- (modified) llvm/include/llvm/IR/BasicBlock.h (+14-14)
- (modified) llvm/include/llvm/IR/DebugProgramInstruction.h (+36-35)
- (modified) llvm/include/llvm/IR/Instruction.h (+6-5)
- (modified) llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (+1-1)
- (modified) llvm/lib/IR/AsmWriter.cpp (+13-10)
- (modified) llvm/lib/IR/BasicBlock.cpp (+57-56)
- (modified) llvm/lib/IR/DebugProgramInstruction.cpp (+36-34)
- (modified) llvm/lib/IR/Instruction.cpp (+22-21)
- (modified) llvm/lib/IR/LLVMContextImpl.h (+4-4)
- (modified) llvm/lib/IR/Value.cpp (+1-1)
- (modified) llvm/lib/IR/Verifier.cpp (+5-5)
- (modified) llvm/lib/Transforms/Scalar/JumpThreading.cpp (+2-2)
- (modified) llvm/lib/Transforms/Utils/LoopRotationUtils.cpp (+2-2)
- (modified) llvm/unittests/IR/BasicBlockDbgInfoTest.cpp (+40-37)
- (modified) llvm/unittests/IR/DebugInfoTest.cpp (+43-41)
- (modified) llvm/unittests/Transforms/Utils/LocalTest.cpp (+4-4)
``````````diff
diff --git a/llvm/docs/RemoveDIsDebugInfo.md b/llvm/docs/RemoveDIsDebugInfo.md
index f8405767a57908..a2f1e173d9d935 100644
--- a/llvm/docs/RemoveDIsDebugInfo.md
+++ b/llvm/docs/RemoveDIsDebugInfo.md
@@ -82,18 +82,18 @@ Like so:
|
|
v
- +------------+
- <-------+ DPMarker |<-------
- / +------------+ \
- / \
- / \
- v ^
+ +-------------+
+ <-------+ DbgMarker |<-------
+ / +-------------+ \
+ / \
+ / \
+ v ^
+-------------+ +-------------+ +-------------+
| DbgRecord +--->| DbgRecord +-->| DbgRecord |
+-------------+ +-------------+ +-------------+
```
-Each instruction has a pointer to a `DPMarker` (which will become optional), that contains a list of `DbgRecord` objects. No debugging records appear in the instruction list at all. `DbgRecord`s have a parent pointer to their owning `DPMarker`, and each `DPMarker` has a pointer back to it's owning instruction.
+Each instruction has a pointer to a `DbgMarker` (which will become optional), that contains a list of `DbgRecord` objects. No debugging records appear in the instruction list at all. `DbgRecord`s have a parent pointer to their owning `DbgMarker`, and each `DbgMarker` has a pointer back to it's owning instruction.
Not shown are the links from DbgRecord to other parts of the `Value`/`Metadata` hierachy: `DbgRecord` subclasses have tracking pointers to the DIMetadata that they use, and `DbgVariableRecord` has references to `Value`s that are stored in a `DebugValueUser` base class. This refers to a `ValueAsMetadata` object referring to `Value`s, via the `TrackingMetadata` facility.
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 51444c7f8c9ccd..0eea4cdccca5bb 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -39,7 +39,7 @@ class Module;
class PHINode;
class ValueSymbolTable;
class DbgVariableRecord;
-class DPMarker;
+class DbgMarker;
/// LLVM Basic Block Representation
///
@@ -72,18 +72,18 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
Function *Parent;
public:
- /// Attach a DPMarker to the given instruction. Enables the storage of any
+ /// Attach a DbgMarker to the given instruction. Enables the storage of any
/// debug-info at this position in the program.
- DPMarker *createMarker(Instruction *I);
- DPMarker *createMarker(InstListType::iterator It);
+ DbgMarker *createMarker(Instruction *I);
+ DbgMarker *createMarker(InstListType::iterator It);
/// Convert variable location debugging information stored in dbg.value
- /// intrinsics into DPMarkers / DbgRecords. Deletes all dbg.values in
+ /// intrinsics into DbgMarkers / DbgRecords. Deletes all dbg.values in
/// the process and sets IsNewDbgInfoFormat = true. Only takes effect if
/// the UseNewDbgInfoFormat LLVM command line option is given.
void convertToNewDbgValues();
- /// Convert variable location debugging information stored in DPMarkers and
+ /// Convert variable location debugging information stored in DbgMarkers and
/// DbgRecords into the dbg.value intrinsic representation. Sets
/// IsNewDbgInfoFormat = false.
void convertFromNewDbgValues();
@@ -97,12 +97,12 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// instruction of this block. These are equivalent to dbg.value intrinsics
/// that exist at the end of a basic block with no terminator (a transient
/// state that occurs regularly).
- void setTrailingDbgRecords(DPMarker *M);
+ void setTrailingDbgRecords(DbgMarker *M);
/// Fetch the collection of DbgRecords that "trail" after the last instruction
/// of this block, see \ref setTrailingDbgRecords. If there are none, returns
/// nullptr.
- DPMarker *getTrailingDbgRecords();
+ DbgMarker *getTrailingDbgRecords();
/// Delete any trailing DbgRecords at the end of this block, see
/// \ref setTrailingDbgRecords.
@@ -110,15 +110,15 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
void dumpDbgValues() const;
- /// Return the DPMarker for the position given by \p It, so that DbgRecords
+ /// Return the DbgMarker for the position given by \p It, so that DbgRecords
/// can be inserted there. This will either be nullptr if not present, a
- /// DPMarker, or TrailingDbgRecords if It is end().
- DPMarker *getMarker(InstListType::iterator It);
+ /// DbgMarker, or TrailingDbgRecords if It is end().
+ DbgMarker *getMarker(InstListType::iterator It);
- /// Return the DPMarker for the position that comes after \p I. \see
- /// BasicBlock::getMarker, this can be nullptr, a DPMarker, or
+ /// Return the DbgMarker for the position that comes after \p I. \see
+ /// BasicBlock::getMarker, this can be nullptr, a DbgMarker, or
/// TrailingDbgRecords if there is no next instruction.
- DPMarker *getNextMarker(Instruction *I);
+ DbgMarker *getNextMarker(Instruction *I);
/// Insert a DbgRecord into a block at the position given by \p I.
void insertDbgRecordAfter(DbgRecord *DR, Instruction *I);
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 8bd6331a9a3ef2..7214d7ad65da67 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -16,22 +16,22 @@
//
// and all information is stored in the Value / Metadata hierachy defined
// elsewhere in LLVM. In the "DbgRecord" design, each instruction /may/ have a
-// connection with a DPMarker, which identifies a position immediately before
-// the instruction, and each DPMarker /may/ then have connections to DbgRecords
+// connection with a DbgMarker, which identifies a position immediately before
+// the instruction, and each DbgMarker /may/ then have connections to DbgRecords
// which record the variable assignment information. To illustrate:
//
// %foo = add i32 1, %0
-// ; foo->DbgMarker == nullptr
+// ; foo->DebugMarker == nullptr
// ;; There are no variable assignments / debug records "in front" of
-// ;; the instruction for %foo, therefore it has no DbgMarker.
+// ;; the instruction for %foo, therefore it has no DebugMarker.
// %bar = void call @ext(%foo)
-// ; bar->DbgMarker = {
+// ; bar->DebugMarker = {
// ; StoredDbgRecords = {
// ; DbgVariableRecord(metadata i32 %foo, ...)
// ; }
// ; }
// ;; There is a debug-info record in front of the %bar instruction,
-// ;; thus it points at a DPMarker object. That DPMarker contains a
+// ;; thus it points at a DbgMarker object. That DbgMarker contains a
// ;; DbgVariableRecord in it's ilist, storing the equivalent information
// to the
// ;; dbg.value above: the Value, DILocalVariable, etc.
@@ -66,7 +66,7 @@ class DbgVariableIntrinsic;
class DbgInfoIntrinsic;
class DbgLabelInst;
class DIAssignID;
-class DPMarker;
+class DbgMarker;
class DbgVariableRecord;
class raw_ostream;
@@ -120,7 +120,7 @@ template <typename T> class DbgRecordParamRef {
/// Base class for non-instruction debug metadata records that have positions
/// within IR. Features various methods copied across from the Instruction
/// class to aid ease-of-use. DbgRecords should always be linked into a
-/// DPMarker's StoredDbgRecords list. The marker connects a DbgRecord back to
+/// DbgMarker's StoredDbgRecords list. The marker connects a DbgRecord back to
/// it's position in the BasicBlock.
///
/// We need a discriminator for dyn/isa casts. In order to avoid paying for a
@@ -134,7 +134,7 @@ template <typename T> class DbgRecordParamRef {
class DbgRecord : public ilist_node<DbgRecord> {
public:
/// Marker that this DbgRecord is linked into.
- DPMarker *Marker = nullptr;
+ DbgMarker *Marker = nullptr;
/// Subclass discriminator.
enum Kind : uint8_t { ValueKind, LabelKind };
@@ -166,10 +166,10 @@ class DbgRecord : public ilist_node<DbgRecord> {
Kind getRecordKind() const { return RecordKind; }
- void setMarker(DPMarker *M) { Marker = M; }
+ void setMarker(DbgMarker *M) { Marker = M; }
- DPMarker *getMarker() { return Marker; }
- const DPMarker *getMarker() const { return Marker; }
+ DbgMarker *getMarker() { return Marker; }
+ const DbgMarker *getMarker() const { return Marker; }
BasicBlock *getBlock();
const BasicBlock *getBlock() const;
@@ -539,7 +539,7 @@ filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
}
/// Per-instruction record of debug-info. If an Instruction is the position of
-/// some debugging information, it points at a DPMarker storing that info. Each
+/// some debugging information, it points at a DbgMarker storing that info. Each
/// marker points back at the instruction that owns it. Various utilities are
/// provided for manipulating the DbgRecords contained within this marker.
///
@@ -559,9 +559,9 @@ filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
/// which we can improve in the future. Additionally, many improvements in the
/// way that debug-info is stored can be achieved in this class, at a future
/// date.
-class DPMarker {
+class DbgMarker {
public:
- DPMarker() {}
+ DbgMarker() {}
/// Link back to the Instruction that owns this marker. Can be null during
/// operations that move a marker from one instruction to another.
Instruction *MarkedInstr = nullptr;
@@ -585,7 +585,7 @@ class DPMarker {
void removeFromParent();
void eraseFromParent();
- /// Implement operator<< on DPMarker.
+ /// Implement operator<< on DbgMarker.
void print(raw_ostream &O, bool IsForDebug = false) const;
void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
@@ -593,22 +593,23 @@ class DPMarker {
iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange();
iterator_range<simple_ilist<DbgRecord>::const_iterator>
getDbgRecordRange() const;
- /// Transfer any DbgRecords from \p Src into this DPMarker. If \p InsertAtHead
- /// is true, place them before existing DbgRecords, otherwise afterwards.
- void absorbDebugValues(DPMarker &Src, bool InsertAtHead);
- /// Transfer the DbgRecords in \p Range from \p Src into this DPMarker. If
+ /// Transfer any DbgRecords from \p Src into this DbgMarker. If \p
+ /// InsertAtHead is true, place them before existing DbgRecords, otherwise
+ /// afterwards.
+ void absorbDebugValues(DbgMarker &Src, bool InsertAtHead);
+ /// Transfer the DbgRecords in \p Range from \p Src into this DbgMarker. If
/// \p InsertAtHead is true, place them before existing DbgRecords, otherwise
// afterwards.
void absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
- DPMarker &Src, bool InsertAtHead);
- /// Insert a DbgRecord into this DPMarker, at the end of the list. If
+ DbgMarker &Src, bool InsertAtHead);
+ /// Insert a DbgRecord into this DbgMarker, at the end of the list. If
/// \p InsertAtHead is true, at the start.
void insertDbgRecord(DbgRecord *New, bool InsertAtHead);
/// Insert a DbgRecord prior to a DbgRecord contained within this marker.
void insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore);
/// Insert a DbgRecord after a DbgRecord contained within this marker.
void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter);
- /// Clone all DPMarkers from \p From into this marker. There are numerous
+ /// Clone all DbgMarkers from \p From into this marker. There are numerous
/// options to customise the source/destination, due to gnarliness, see class
/// comment.
/// \p FromHere If non-null, copy from FromHere to the end of From's
@@ -617,10 +618,10 @@ class DPMarker {
/// StoredDbgRecords
/// \returns Range over all the newly cloned DbgRecords
iterator_range<simple_ilist<DbgRecord>::iterator>
- cloneDebugInfoFrom(DPMarker *From,
+ cloneDebugInfoFrom(DbgMarker *From,
std::optional<simple_ilist<DbgRecord>::iterator> FromHere,
bool InsertAtHead = false);
- /// Erase all DbgRecords in this DPMarker.
+ /// Erase all DbgRecords in this DbgMarker.
void dropDbgRecords();
/// Erase a single DbgRecord from this marker. In an ideal future, we would
/// never erase an assignment in this way, but it's the equivalent to
@@ -628,34 +629,34 @@ class DPMarker {
void dropOneDbgRecord(DbgRecord *DR);
/// We generally act like all llvm Instructions have a range of DbgRecords
- /// attached to them, but in reality sometimes we don't allocate the DPMarker
+ /// attached to them, but in reality sometimes we don't allocate the DbgMarker
/// to save time and memory, but still have to return ranges of DbgRecords.
/// When we need to describe such an unallocated DbgRecord range, use this
/// static markers range instead. This will bite us if someone tries to insert
/// a DbgRecord in that range, but they should be using the Official (TM) API
/// for that.
- static DPMarker EmptyDPMarker;
+ static DbgMarker EmptyDbgMarker;
static iterator_range<simple_ilist<DbgRecord>::iterator>
getEmptyDbgRecordRange() {
- return make_range(EmptyDPMarker.StoredDbgRecords.end(),
- EmptyDPMarker.StoredDbgRecords.end());
+ return make_range(EmptyDbgMarker.StoredDbgRecords.end(),
+ EmptyDbgMarker.StoredDbgRecords.end());
}
};
-inline raw_ostream &operator<<(raw_ostream &OS, const DPMarker &Marker) {
+inline raw_ostream &operator<<(raw_ostream &OS, const DbgMarker &Marker) {
Marker.print(OS);
return OS;
}
/// Inline helper to return a range of DbgRecords attached to a marker. It needs
/// to be inlined as it's frequently called, but also come after the declaration
-/// of DPMarker. Thus: it's pre-declared by users like Instruction, then an
+/// of DbgMarker. Thus: it's pre-declared by users like Instruction, then an
/// inlineable body defined here.
inline iterator_range<simple_ilist<DbgRecord>::iterator>
-getDbgRecordRange(DPMarker *DbgMarker) {
- if (!DbgMarker)
- return DPMarker::getEmptyDbgRecordRange();
- return DbgMarker->getDbgRecordRange();
+getDbgRecordRange(DbgMarker *DebugMarker) {
+ if (!DebugMarker)
+ return DbgMarker::getEmptyDbgRecordRange();
+ return DebugMarker->getDbgRecordRange();
}
DEFINE_ISA_CONVERSION_FUNCTIONS(DbgRecord, LLVMDbgRecordRef)
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index d6cf1557752386..6e0874c5b04f29 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -29,19 +29,20 @@
namespace llvm {
class BasicBlock;
-class DPMarker;
+class DbgMarker;
class FastMathFlags;
class MDNode;
class Module;
struct AAMDNodes;
-class DPMarker;
+class DbgMarker;
class DbgRecord;
template <> struct ilist_alloc_traits<Instruction> {
static inline void deleteNode(Instruction *V);
};
-iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange(DPMarker *);
+iterator_range<simple_ilist<DbgRecord>::iterator>
+getDbgRecordRange(DbgMarker *);
class Instruction : public User,
public ilist_node_with_parent<Instruction, BasicBlock,
@@ -60,7 +61,7 @@ class Instruction : public User,
/// Optional marker recording the position for debugging information that
/// takes effect immediately before this instruction. Null unless there is
/// debugging information present.
- DPMarker *DbgMarker = nullptr;
+ DbgMarker *DebugMarker = nullptr;
/// Clone any debug-info attached to \p From onto this instruction. Used to
/// copy debugging information from one block to another, when copying entire
@@ -81,7 +82,7 @@ class Instruction : public User,
/// Return a range over the DbgRecords attached to this instruction.
iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange() const {
- return llvm::getDbgRecordRange(DbgMarker);
+ return llvm::getDbgRecordRange(DebugMarker);
}
/// Return an iterator to the position of the "Next" DbgRecord after this
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 5addf0ac33c4ed..a8b69f89e7deff 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -3569,7 +3569,7 @@ void ModuleBitcodeWriter::writeFunction(
// Write out non-instruction debug information attached to this
// instruction. Write it after the instruction so that it's easy to
// re-attach to the instruction reading the records in.
- for (DbgRecord &DR : I.DbgMarker->getDbgRecordRange()) {
+ for (DbgRecord &DR : I.DebugMarker->getDbgRecordRange()) {
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
Vals.push_back(VE.getMetadataID(&*DLR->getDebugLoc()));
Vals.push_back(VE.getMetadataID(DLR->getLabel()));
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 8ce6fabb30f232..38c191a2dec60e 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -286,7 +286,7 @@ static const Module *getModuleFromVal(const Value *V) {
return nullptr;
}
-static const Module *getModuleFromDPI(const DPMarker *Marker) {
+static const Module *getModuleFromDPI(const DbgMarker *Marker) {
const Function *M =
Marker->getParent() ? Marker->getParent()->getParent() : nullptr;
return M ? M->getParent() : nullptr;
@@ -2717,7 +2717,7 @@ class AssemblyWriter {
void printBasicBlock(const BasicBlock *BB);
void printInstructionLine(const Instruction &I);
void printInstruction(const Instruction &I);
- void printDPMarker(const DPMarker &DPI);
+ void printDbgMarker(const DbgMarker &DPI);
void printDbgVariableRecord(const DbgVariableRecord &DVR);
void printDbgLabelRecord(const DbgLabelRecord &DLR);
void printDbgRecord(const DbgRecord &DR);
@@ -4604,15 +4604,15 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
printInfoComment(I);
}
-void AssemblyWriter::printDPMarker(const DPMarker &Marker) {
- // There's no formal representation of a DPMarker -- print purely as a
+void AssemblyWriter::printDbgMarker(const DbgMarker &Marker) {
+ // There's no formal representation of a DbgMarker -- print purely as a
// debugging aid.
for (const DbgRecord &DPR : Marker.StoredDbgRecords) {
printDbgRecord(DPR);
Out << "\n";
}
- Out << " DPMarker -> { ";
+ Out << " DbgMarker -> { ";
printInstruction(*Marker.MarkedInstr);
Out << " }";
return;
@@ -4907,7 +4907,7 @@ static bool isReferencingMDNode(const Instruction &I) {
return false;
}
-void DPMarker::print(raw_ostream &ROS, bool IsForDebug) const {
+void DbgMarker::print(raw_ostream &ROS, bool IsForDebug) const {
ModuleSlotTracker MST(getModuleFromDPI(this), true);
print(ROS, MST, IsForDebug);
@@ -4919,8 +4919,8 @@ void DbgVariableRecord::print(raw_ostream &ROS, bool IsForDebug) const {
print(ROS, MST, IsForDebug);
}
-void DPMarker::print(raw_ostream &ROS, ModuleSlotTracker &MST,
- bool IsForDebug) const {
+void DbgMarker::print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ bool IsForDebug) const {
formatted_raw_ostream OS(ROS);
SlotTracker EmptySlotTable(static_cast<const Module *>(nullptr));
SlotTracker &SlotTable =
@@ -4931,7 +4931,7 @@ void DPMarker::print(raw_ostream &ROS, ModuleSlotTracker &MST,
};
incorporateFunction(getParent() ? getParent()->getParent() : nullptr);
AssemblyWriter W(OS, SlotTable, getModuleFromDPI(this), nullptr, IsForDebug);
- W.printDPMarker(*this);
+ W.printDbgMarker(*this);
}
void DbgLabelRecord::print(raw_ostream &ROS, bool IsForDebug) const {
@@ -5220,7 +5220,10 @@ void Value::dump() const { print(dbgs(), /*IsForDebug=*/true); dbgs() << '\n'; }
// Value::dump - allow easy printing of Values from the debugger.
LLVM_DUMP_METHOD
-void DPMarker::dump() const { print(dbg...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/85931
More information about the llvm-commits
mailing list