From 6e07f16fae605c42014aa4f1f2babf3e7767c95c Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Wed, 29 May 2019 19:12:48 +0000 Subject: IR: add optional type to 'byval' function parameters When we switch to opaque pointer types we will need some way to describe how many bytes a 'byval' parameter should occupy on the stack. This adds a (for now) optional extra type parameter. If present, the type must match the pointee type of the argument. Note to front-end maintainers: if this causes test failures, it's probably because the "byval" attribute is printed after attributes without any parameter after this change. llvm-svn: 362012 --- llvm/lib/IR/Function.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/IR/Function.cpp') diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index b00deb677b3..a4a78ca4deb 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -113,6 +113,11 @@ unsigned Argument::getParamAlignment() const { return getParent()->getParamAlignment(getArgNo()); } +Type *Argument::getParamByValType() const { + assert(getType()->isPointerTy() && "Only pointers have byval types"); + return getParent()->getParamByValType(getArgNo()); +} + uint64_t Argument::getDereferenceableBytes() const { assert(getType()->isPointerTy() && "Only pointers have dereferenceable bytes"); -- cgit v1.2.3