From 436c42ec3dc9f93ecce02ee9d47da6cf7be9aa7d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Fri, 17 Jan 2014 23:58:17 +0000 Subject: Add an inalloca flag to allocas Summary: The only current use of this flag is to mark the alloca as dynamic, even if its in the entry block. The stack adjustment for the alloca can never be folded into the prologue because the call may clear it and it has to be allocated at the top of the stack. Reviewers: majnemer CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2571 llvm-svn: 199525 --- llvm/lib/IR/Function.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/IR/Function.cpp') diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index bb6bef7..c1fa372 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -92,6 +92,13 @@ bool Argument::hasInAllocaAttr() const { hasAttribute(getArgNo()+1, Attribute::InAlloca); } +bool Argument::hasByValOrInAllocaAttr() const { + if (!getType()->isPointerTy()) return false; + AttributeSet Attrs = getParent()->getAttributes(); + return Attrs.hasAttribute(getArgNo() + 1, Attribute::ByVal) || + Attrs.hasAttribute(getArgNo() + 1, Attribute::InAlloca); +} + unsigned Argument::getParamAlignment() const { assert(getType()->isPointerTy() && "Only pointers have alignments"); return getParent()->getParamAlignment(getArgNo()+1); -- cgit v1.1