Add some helpers for manipulating function

parameter attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53228 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2008-07-08 09:41:30 +00:00
parent 1512642973
commit cfa3c236b2
2 changed files with 40 additions and 26 deletions

View File

@@ -113,16 +113,13 @@ bool Argument::hasStructRetAttr() const {
/// addAttr - Add a ParamAttr to an argument
void Argument::addAttr(ParameterAttributes attr) {
getParent()->setParamAttrs(
getParent()->getParamAttrs().addAttr(getArgNo() + 1, attr));
}
/// removeAttr - Remove a ParamAttr from an argument
void Argument::removeAttr(ParameterAttributes attr) {
getParent()->setParamAttrs(
getParent()->getParamAttrs().removeAttr(getArgNo() + 1, attr));
getParent()->addParamAttr(getArgNo() + 1, attr);
}
/// removeAttr - Remove a ParamAttr from an argument
void Argument::removeAttr(ParameterAttributes attr) {
getParent()->removeParamAttr(getArgNo() + 1, attr);
}
//===----------------------------------------------------------------------===//
@@ -231,21 +228,18 @@ void Function::dropAllReferences() {
BasicBlocks.clear(); // Delete all basic blocks...
}
void Function::setDoesNotThrow(bool doesNotThrow) {
PAListPtr PAL = getParamAttrs();
if (doesNotThrow)
PAL = PAL.addAttr(0, ParamAttr::NoUnwind);
else
PAL = PAL.removeAttr(0, ParamAttr::NoUnwind);
setParamAttrs(PAL);
}
void Function::addParamAttr(unsigned i, ParameterAttributes attr) {
PAListPtr PAL = getParamAttrs();
PAL = PAL.addAttr(i, attr);
setParamAttrs(PAL);
}
void Function::removeParamAttr(unsigned i, ParameterAttributes attr) {
PAListPtr PAL = getParamAttrs();
PAL = PAL.removeAttr(i, attr);
setParamAttrs(PAL);
}
// Maintain the collector name for each function in an on-the-side table. This
// saves allocating an additional word in Function for programs which do not use
// GC (i.e., most programs) at the cost of increased overhead for clients which