[PATCH] Print the address space of a MachineMemOperand

Matt Arsenault Matthew.Arsenault at amd.com
Fri Dec 13 13:58:06 PST 2013


This helps debugging places where the wrong one is used.

http://llvm-reviews.chandlerc.com/D2406

Files:
  include/llvm/CodeGen/MachineMemOperand.h
  lib/CodeGen/MachineInstr.cpp

Index: include/llvm/CodeGen/MachineMemOperand.h
===================================================================
--- include/llvm/CodeGen/MachineMemOperand.h
+++ include/llvm/CodeGen/MachineMemOperand.h
@@ -134,6 +134,8 @@
   /// number.
   int64_t getOffset() const { return PtrInfo.Offset; }
 
+  int64_t getAddrSpace() const { return PtrInfo.getAddrSpace(); }
+
   /// getSize - Return the size in bytes of the memory reference.
   uint64_t getSize() const { return Size; }
 
Index: lib/CodeGen/MachineInstr.cpp
===================================================================
--- lib/CodeGen/MachineInstr.cpp
+++ lib/CodeGen/MachineInstr.cpp
@@ -481,6 +481,10 @@
   else
     WriteAsOperand(OS, MMO.getValue(), /*PrintType=*/false);
 
+  unsigned AS = MMO.getAddrSpace();
+  if (AS != 0)
+    OS << "(addrspace=" << AS << ')';
+
   // If the alignment of the memory reference itself differs from the alignment
   // of the base pointer, print the base alignment explicitly, next to the base
   // pointer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2406.1.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131213/38267288/attachment.bin>


More information about the llvm-commits mailing list