[PATCH] Add a function to get the largest address space pointer size
Matt Arsenault
Matthew.Arsenault at amd.com
Thu Sep 12 16:08:49 PDT 2013
Some users of DataLayout::getPointerSize don't use it in an exact way, and aren't really using it for the pointer size. For example MemCpyOptimizer uses it as a guess for the maximum GPR width.
http://llvm-reviews.chandlerc.com/D1665
Files:
include/llvm/IR/DataLayout.h
Index: include/llvm/IR/DataLayout.h
===================================================================
--- include/llvm/IR/DataLayout.h
+++ include/llvm/IR/DataLayout.h
@@ -265,6 +265,18 @@
}
return val->second.TypeBitWidth;
}
+
+ /// Return the largest pointer size for known address spaces.
+ unsigned getMaxPointerSize() const {
+ unsigned MaxPtrSize = 0;
+ for (DenseMap<unsigned, PointerAlignElem>::const_iterator I
+ = Pointers.begin(), E = Pointers.end(); I != E; ++I) {
+ MaxPtrSize = std::max(MaxPtrSize, I->second.TypeBitWidth);
+ }
+
+ return (MaxPtrSize == 0) ? 64 : MaxPtrSize;
+ }
+
/// Layout pointer size, in bits
/// FIXME: The defaults need to be removed once all of
/// the backends/clients are updated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1665.1.patch
Type: text/x-patch
Size: 776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/93dbdd9f/attachment.bin>
More information about the llvm-commits
mailing list