mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Add hasByValArgument() to test if a call instruction has byval argument(s).
llvm-svn: 45913
This commit is contained in:
parent
d90840eddc
commit
a5183224b0
@ -944,6 +944,9 @@ public:
|
||||
/// @brief Determine if the call returns a structure.
|
||||
bool isStructReturn() const;
|
||||
|
||||
/// @brief Determine if any call argument is an aggregate passed by value.
|
||||
bool hasByValArgument() const;
|
||||
|
||||
/// getCalledFunction - Return the function being called by this instruction
|
||||
/// if it is a direct call. If it is a call through a function pointer,
|
||||
/// return null.
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user