diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2021-03-28 13:05:17 -0400 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2021-03-28 13:35:21 -0400 |
commit | fc9df309917e57de704f3ce4372138a8d4a23d7a (patch) | |
tree | 677d1c55b50916aefffcfb8d5eb345a4e3e3d7ec /llvm/lib/IR/Function.cpp | |
parent | 01ae6e5ead64c033134a1ee68fb0bf6ec93b4c40 (diff) | |
download | llvm-fc9df309917e57de704f3ce4372138a8d4a23d7a.zip llvm-fc9df309917e57de704f3ce4372138a8d4a23d7a.tar.gz llvm-fc9df309917e57de704f3ce4372138a8d4a23d7a.tar.bz2 |
Reapply "OpaquePtr: Turn inalloca into a type attribute"
This reverts commit 20d5c42e0ef5d252b434bcb610b04f1cb79fe771.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 7389ec6..1001607 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -162,6 +162,8 @@ static Type *getMemoryParamAllocType(AttributeSet ParamAttrs, Type *ArgTy) { return ByRefTy; if (Type *PreAllocTy = ParamAttrs.getPreallocatedType()) return PreAllocTy; + if (Type *InAllocaTy = ParamAttrs.getInAllocaType()) + return InAllocaTy; // FIXME: sret and inalloca always depends on pointee element type. It's also // possible for byval to miss it. @@ -213,6 +215,11 @@ Type *Argument::getParamByRefType() const { return getParent()->getParamByRefType(getArgNo()); } +Type *Argument::getParamInAllocaType() const { + assert(getType()->isPointerTy() && "Only pointers have inalloca types"); + return getParent()->getParamInAllocaType(getArgNo()); +} + uint64_t Argument::getDereferenceableBytes() const { assert(getType()->isPointerTy() && "Only pointers have dereferenceable bytes"); |