aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2012-08-22 06:07:19 +0000
committerCraig Topper <craig.topper@gmail.com>2012-08-22 06:07:19 +0000
commita538d831e610ad1530e9e7c92fa937d4df9d490e (patch)
tree8bbddd7db8101309516f172a3552b1a71563fc02 /llvm/lib/CodeGen/MachineFunction.cpp
parent1afcb7442fb26b6369dd95b76acea25cbbdac651 (diff)
downloadllvm-a538d831e610ad1530e9e7c92fa937d4df9d490e.zip
llvm-a538d831e610ad1530e9e7c92fa937d4df9d490e.tar.gz
llvm-a538d831e610ad1530e9e7c92fa937d4df9d490e.tar.bz2
Add a getName function to MachineFunction. Use it in places that previously did getFunction()->getName(). Remove includes of Function.h that are no longer needed.
llvm-svn: 162347
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index d4aede8..68a8e87 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -288,6 +288,11 @@ void MachineFunction::dump() const {
print(dbgs());
}
+StringRef MachineFunction::getName() const {
+ assert(getFunction() && "No function!");
+ return getFunction()->getName();
+}
+
void MachineFunction::print(raw_ostream &OS, SlotIndexes *Indexes) const {
OS << "# Machine code for function " << Fn->getName() << ": ";
if (RegInfo) {
@@ -344,7 +349,7 @@ namespace llvm {
DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
static std::string getGraphName(const MachineFunction *F) {
- return "CFG for '" + F->getFunction()->getName().str() + "' function";
+ return "CFG for '" + F->getName().str() + "' function";
}
std::string getNodeLabel(const MachineBasicBlock *Node,