Skip to content

Commit e3428ae

Browse files
committed
[AddressLowering] NFC: Add more dump functions.
1 parent ba6b019 commit e3428ae

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

lib/SILOptimizer/Mandatory/AddressLowering.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,29 @@ void ValueStorageMap::replaceValue(SILValue oldValue, SILValue newValue) {
433433
}
434434

435435
#ifndef NDEBUG
436+
void ValueStorage::dump() const {
437+
llvm::dbgs() << "projectedStorageID: " << projectedStorageID << "\n";
438+
llvm::dbgs() << "projectedOperandNum: " << projectedOperandNum << "\n";
439+
llvm::dbgs() << "isDefProjection: " << isDefProjection << "\n";
440+
llvm::dbgs() << "isUseProjection: " << isUseProjection << "\n";
441+
llvm::dbgs() << "isRewritten: " << isRewritten << "\n";
442+
llvm::dbgs() << "initializesEnum: " << initializesEnum << "\n";
443+
}
444+
void ValueStorageMap::ValueStoragePair::dump() const {
445+
llvm::dbgs() << "value: ";
446+
value->dump();
447+
llvm::dbgs() << "address: ";
448+
if (storage.storageAddress)
449+
storage.storageAddress->dump();
450+
else
451+
llvm::dbgs() << "UNKNOWN!\n";
452+
storage.dump();
453+
}
454+
void ValueStorageMap::dumpProjections(SILValue value) {
455+
for (auto *pair : getProjections(value)) {
456+
pair->dump();
457+
}
458+
}
436459
void ValueStorageMap::dump() {
437460
llvm::dbgs() << "ValueStorageMap:\n";
438461
for (unsigned ordinal : indices(valueVector)) {

lib/SILOptimizer/Mandatory/AddressLowering.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ struct ValueStorage {
185185
assert(isRewritten && "storage has not been materialized");
186186
return storageAddress;
187187
}
188+
189+
#ifndef NDEBUG
190+
void dump() const;
191+
#endif
188192
};
189193

190194
/// Map each opaque/resilient SILValue to its abstract storage.
@@ -197,6 +201,9 @@ class ValueStorageMap {
197201
SILValue value;
198202
ValueStorage storage;
199203
ValueStoragePair(SILValue v, ValueStorage s) : value(v), storage(s) {}
204+
#ifndef NDEBUG
205+
void dump() const;
206+
#endif
200207
};
201208
typedef std::vector<ValueStoragePair> ValueVector;
202209
// Hash of values to ValueVector indices.
@@ -335,6 +342,7 @@ class ValueStorageMap {
335342
bool isComposingUseProjection(Operand *oper) const;
336343

337344
#ifndef NDEBUG
345+
void dumpProjections(SILValue value);
338346
void dump();
339347
#endif
340348
};

0 commit comments

Comments
 (0)