summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-06-29 21:51:32 +0000
committerDevang Patel <dpatel@apple.com>2010-06-29 21:51:32 +0000
commitda0e89f4c4057114fe7236fd001e9ef6d836ee82 (patch)
treed66fdd8bce6c85fc61be99cfd87454ed7d0dc611 /lib/CodeGen/MachineInstr.cpp
parent7645f14ee8617f0c5a866ba49c07ca3f1c54ff80 (diff)
downloadllvm-da0e89f4c4057114fe7236fd001e9ef6d836ee82.tar.gz
llvm-da0e89f4c4057114fe7236fd001e9ef6d836ee82.tar.bz2
llvm-da0e89f4c4057114fe7236fd001e9ef6d836ee82.tar.xz
Print InlinedAt location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107208 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 9e7d392234..eeea9f2e30 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -1211,6 +1211,28 @@ void MachineInstr::dump() const {
dbgs() << " " << *this;
}
+static void printDebugLoc(DebugLoc DL, const MachineFunction *MF,
+ raw_ostream &CommentOS) {
+ const LLVMContext &Ctx = MF->getFunction()->getContext();
+ if (!DL.isUnknown()) { // Print source line info.
+ DIScope Scope(DL.getScope(Ctx));
+ // Omit the directory, because it's likely to be long and uninteresting.
+ if (Scope.Verify())
+ CommentOS << Scope.getFilename();
+ else
+ CommentOS << "<unknown>";
+ CommentOS << ':' << DL.getLine();
+ if (DL.getCol() != 0)
+ CommentOS << ':' << DL.getCol();
+ DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx));
+ if (!InlinedAtDL.isUnknown()) {
+ CommentOS << " @[ ";
+ printDebugLoc(InlinedAtDL, MF, CommentOS);
+ CommentOS << " ]";
+ }
+ }
+}
+
void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
// We can be a bit tidier if we know the TargetMachine and/or MachineFunction.
const MachineFunction *MF = 0;
@@ -1308,19 +1330,8 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
if (!debugLoc.isUnknown() && MF) {
if (!HaveSemi) OS << ";";
-
- // TODO: print InlinedAtLoc information
-
- DIScope Scope(debugLoc.getScope(MF->getFunction()->getContext()));
OS << " dbg:";
- // Omit the directory, since it's usually long and uninteresting.
- if (Scope.Verify())
- OS << Scope.getFilename();
- else
- OS << "<unknown>";
- OS << ':' << debugLoc.getLine();
- if (debugLoc.getCol() != 0)
- OS << ':' << debugLoc.getCol();
+ printDebugLoc(debugLoc, MF, OS);
}
OS << "\n";