aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 32c7b87..0887b5c 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -335,8 +335,21 @@ Function *Function::createWithDefaultAttr(FunctionType *Ty,
unsigned AddrSpace, const Twine &N,
Module *M) {
auto *F = new Function(Ty, Linkage, AddrSpace, N, M);
+ AttrBuilder B;
if (M->getUwtable())
- F->addAttribute(AttributeList::FunctionIndex, Attribute::UWTable);
+ B.addAttribute(Attribute::UWTable);
+ switch (M->getFramePointer()) {
+ case FramePointerKind::None:
+ // 0 ("none") is the default.
+ break;
+ case FramePointerKind::NonLeaf:
+ B.addAttribute("frame-pointer", "non-leaf");
+ break;
+ case FramePointerKind::All:
+ B.addAttribute("frame-pointer", "all");
+ break;
+ }
+ F->addAttributes(AttributeList::FunctionIndex, B);
return F;
}