[PATCH] Print the address space of a MachineMemOperand

Hal Finkel hfinkel at anl.gov
Fri Dec 13 14:11:28 PST 2013


----- Original Message -----
> From: "Matt Arsenault" <Matthew.Arsenault at amd.com>
> To: "Matthew Arsenault" <Matthew.Arsenault at amd.com>
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Friday, December 13, 2013 3:58:06 PM
> Subject: [PATCH] Print the address space of a MachineMemOperand
> 
> 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(); }
> +

This should be unsigned (not int64_t), right?

Otherwise, LGTM.

 -Hal

>    /// 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.
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list