diff options
author | Andrew Trick <atrick@apple.com> | 2012-03-07 00:18:18 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-03-07 00:18:18 +0000 |
commit | 8ceaa660bfec72249976c1f411db7f40cbc438bb (patch) | |
tree | b3fb4ac73cc9fd6509eccd826db5333674e4564e /lib | |
parent | acddd4963d2f3b5fd94ab872b4fd393b34c80e5f (diff) | |
download | external_llvm-8ceaa660bfec72249976c1f411db7f40cbc438bb.zip external_llvm-8ceaa660bfec72249976c1f411db7f40cbc438bb.tar.gz external_llvm-8ceaa660bfec72249976c1f411db7f40cbc438bb.tar.bz2 |
Added MachineBasicBlock::getFullName() to standardize/factor codegen diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachineBasicBlock.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index 611b045..ca8a8e8 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/lib/CodeGen/MachineBasicBlock.cpp @@ -238,6 +238,18 @@ StringRef MachineBasicBlock::getName() const { return "(null)"; } +/// Return a hopefully unique identifier for this block. +std::string MachineBasicBlock::getFullName() const { + std::string Name; + if (getParent()) + Name = (getParent()->getFunction()->getName() + ":").str(); + if (getBasicBlock()) + Name += getBasicBlock()->getName(); + else + Name += (Twine("BB") + Twine(getNumber())).str(); + return Name; +} + void MachineBasicBlock::print(raw_ostream &OS, SlotIndexes *Indexes) const { const MachineFunction *MF = getParent(); if (!MF) { |