summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index d8bcb31a476..a9cc275b548 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -404,6 +404,17 @@ bool CallInst::isStructReturn() const {
return paramHasAttr(1, ParamAttr::StructRet);
}
+/// @brief Determine if any call argument is an aggregate passed by value.
+bool CallInst::hasByValArgument() const {
+ const Value *Callee = getCalledValue();
+ const PointerType *CalleeTy = cast<PointerType>(Callee->getType());
+ const FunctionType *FTy = cast<FunctionType>(CalleeTy->getElementType());
+ for (unsigned i = 1, e = FTy->getNumParams()+1; i != e; ++i)
+ if (paramHasAttr(i, ParamAttr::ByVal))
+ return true;
+ return false;
+}
+
void CallInst::setDoesNotThrow(bool doesNotThrow) {
const ParamAttrsList *PAL = getParamAttrs();
if (doesNotThrow)
OpenPOWER on IntegriCloud