[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Mon Feb 5 13:24:08 PST 2007
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.144 -> 1.145
---
Log message:
Fix PR1178: http://llvm.org/PR1178
---
Diffs of the changes: (+11 -1)
AsmPrinter.cpp | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.144 llvm/lib/CodeGen/AsmPrinter.cpp:1.145
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.144 Sun Feb 4 17:27:42 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Feb 5 15:23:52 2007
@@ -839,9 +839,19 @@
} else if (!strcmp(Code, "uid")) {
// Assign a unique ID to this machine instruction.
static const MachineInstr *LastMI = 0;
+ static const Function *F = 0;
static unsigned Counter = 0U-1;
+
+ // Comparing the address of MI isn't sufficient, because machineinstrs may
+ // be allocated to the same address across functions.
+ const Function *ThisF = MI->getParent()->getParent()->getFunction();
+
// If this is a new machine instruction, bump the counter.
- if (LastMI != MI) { ++Counter; LastMI = MI; }
+ if (LastMI != MI || F != ThisF) {
+ ++Counter;
+ LastMI = MI;
+ ThisF = F;
+ }
O << Counter;
} else {
cerr << "Unknown special formatter '" << Code
More information about the llvm-commits
mailing list