aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2021-03-06 13:23:57 -0500
committerMatt Arsenault <Matthew.Arsenault@amd.com>2021-03-28 11:12:23 -0400
commit4fefed65637ec46c8c2edad6b07b5569ac61e9e5 (patch)
tree171d28547e3a06a99265af6ead0f579bcf30a1d8 /llvm/lib/IR/Function.cpp
parentc5243c63cda3c740d6e9c7e501f6518c21688da3 (diff)
downloadllvm-4fefed65637ec46c8c2edad6b07b5569ac61e9e5.zip
llvm-4fefed65637ec46c8c2edad6b07b5569ac61e9e5.tar.gz
llvm-4fefed65637ec46c8c2edad6b07b5569ac61e9e5.tar.bz2
OpaquePtr: Turn inalloca into a type attribute
I think byval/sret and the others are close to being able to rip out the code to support the missing type case. A lot of this code is shared with inalloca, so catch this up to the others so that can happen.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp7
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");