Print the address space of a MachineMemOperand
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 14 Dec 2013 00:24:02 +0000 (00:24 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 14 Dec 2013 00:24:02 +0000 (00:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197288 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 00a55b57f33473c34daccdbf3518104ecb9eddcd..f01b8ebca12f22b5e0a38881c4a2e6a695a50247 100644 (file)
@@ -134,6 +134,8 @@ public:
   /// number.
   int64_t getOffset() const { return PtrInfo.Offset; }
 
+  unsigned getAddrSpace() const { return PtrInfo.getAddrSpace(); }
+
   /// getSize - Return the size in bytes of the memory reference.
   uint64_t getSize() const { return Size; }
 
index 295b450a0f2f84a61b52eca0e5fa38604433da65..8d89276e73dd15b12e47cc05b4a153c32b90095a 100644 (file)
@@ -481,6 +481,10 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MMO) {
   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.