[llvm-commits] New interfaces for getting address space
Eli Friedman
eli.friedman at gmail.com
Tue Oct 9 13:55:30 PDT 2012
On Tue, Oct 9, 2012 at 9:55 AM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
> The attached patch supplies some new interfaces that allows easier access to the address space of the pointer in an instruction.
> These interfaces are required for simplifying the update path of the optimizers for when supporting variable pointer sizes on a per-address space basis.
+ /// getAddressSpace - Method to return the address space of the
+ /// pointer operand.
+ unsigned getAddressSpace() const {
+ return dyn_cast<PointerType>(getPointerOperandType())->getAddressSpace();
+ }
cast<>, not dyn_cast<>. dyn_cast implies you're checking the result
for null. (Applies globally.)
I think I would prefer the name getPointerAddressSpace for cases when
you're getting the address-space of an operand, given that the
instruction itself doesn't really have an address space.
Otherwise, looks fine.
-Eli
More information about the llvm-commits
mailing list