aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp48
1 files changed, 31 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 7381c7e6..7fd51c8 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -476,6 +476,28 @@ void MachineBasicBlock::printName(raw_ostream &os, unsigned printNameFlags,
os << "bb." << getNumber();
bool hasAttributes = false;
+ auto PrintBBRef = [&](const BasicBlock *bb) {
+ os << "%ir-block.";
+ if (bb->hasName()) {
+ os << bb->getName();
+ } else {
+ int slot = -1;
+
+ if (moduleSlotTracker) {
+ slot = moduleSlotTracker->getLocalSlot(bb);
+ } else if (bb->getParent()) {
+ ModuleSlotTracker tmpTracker(bb->getModule(), false);
+ tmpTracker.incorporateFunction(*bb->getParent());
+ slot = tmpTracker.getLocalSlot(bb);
+ }
+
+ if (slot == -1)
+ os << "<ir-block badref>";
+ else
+ os << slot;
+ }
+ };
+
if (printNameFlags & PrintNameIr) {
if (const auto *bb = getBasicBlock()) {
if (bb->hasName()) {
@@ -483,29 +505,21 @@ void MachineBasicBlock::printName(raw_ostream &os, unsigned printNameFlags,
} else {
hasAttributes = true;
os << " (";
-
- int slot = -1;
-
- if (moduleSlotTracker) {
- slot = moduleSlotTracker->getLocalSlot(bb);
- } else if (bb->getParent()) {
- ModuleSlotTracker tmpTracker(bb->getModule(), false);
- tmpTracker.incorporateFunction(*bb->getParent());
- slot = tmpTracker.getLocalSlot(bb);
- }
-
- if (slot == -1)
- os << "<ir-block badref>";
- else
- os << (Twine("%ir-block.") + Twine(slot)).str();
+ PrintBBRef(bb);
}
}
}
if (printNameFlags & PrintNameAttributes) {
- if (hasAddressTaken()) {
+ if (isMachineBlockAddressTaken()) {
+ os << (hasAttributes ? ", " : " (");
+ os << "machine-block-address-taken";
+ hasAttributes = true;
+ }
+ if (isIRBlockAddressTaken()) {
os << (hasAttributes ? ", " : " (");
- os << "address-taken";
+ os << "ir-block-address-taken ";
+ PrintBBRef(getAddressTakenIRBlock());
hasAttributes = true;
}
if (isEHPad()) {