From 9bd42e3fab0e67a475bf3d78bcaa65a531e9c729 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sat, 14 Dec 2013 00:24:02 +0000 Subject: [PATCH] Print the address space of a MachineMemOperand git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197288 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineMemOperand.h | 2 ++ lib/CodeGen/MachineInstr.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index 00a55b57f33..f01b8ebca12 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -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; } diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 295b450a0f2..8d89276e73d 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -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. -- 2.34.1