move a bunch of trivial methods to be inline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-03-13 05:00:21 +00:00
parent 041221c097
commit d5d94df73f
4 changed files with 64 additions and 132 deletions

View File

@ -160,26 +160,38 @@ public:
void clearCollector();
/// @brief Determine whether the function has the given attribute.
bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
bool paramHasAttr(unsigned i, ParameterAttributes attr) const {
return ParamAttrs.paramHasAttr(i, attr);
}
/// @brief Extract the alignment for a call or parameter (0=unknown).
uint16_t getParamAlignment(uint16_t i) const;
unsigned getParamAlignment(unsigned i) const {
return ParamAttrs.getParamAlignment(i);
}
/// @brief Determine if the function cannot return.
bool doesNotReturn() const;
bool doesNotReturn() const { return paramHasAttr(0, ParamAttr::NoReturn); }
/// @brief Determine if the function cannot unwind.
bool doesNotThrow() const;
bool doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
/// @brief Determine if the function does not access memory.
bool doesNotAccessMemory() const;
bool doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
}
/// @brief Determine if the function does not access or only reads memory.
bool onlyReadsMemory() const;
bool onlyReadsMemory() const {
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
/// @brief Determine if the function returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const;
bool hasStructRetAttr() const {
return paramHasAttr(1, ParamAttr::StructRet);
}
/// deleteBody - This method deletes the body of the function, and converts
/// the linkage to external.

View File

@ -934,30 +934,45 @@ public:
void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(uint16_t i, unsigned attr) const;
bool paramHasAttr(unsigned i, unsigned attr) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
uint16_t getParamAlignment(uint16_t i) const;
unsigned getParamAlignment(unsigned i) const {
return ParamAttrs.getParamAlignment(i);
}
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const;
bool doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const;
bool onlyReadsMemory() const {
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const;
bool doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const;
bool doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
void setDoesNotThrow(bool doesNotThrow = true);
/// @brief Determine if the call returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const;
bool hasStructRetAttr() const {
// Be friendly and also check the callee.
return paramHasAttr(1, ParamAttr::StructRet);
}
/// @brief Determine if any call argument is an aggregate passed by value.
bool hasByValArgument() const;
bool hasByValArgument() const {
return ParamAttrs.hasAttrSomewhere(ParamAttr::ByVal);
}
/// getCalledFunction - Return the function being called by this instruction
/// if it is a direct call. If it is a call through a function pointer,
@ -1749,27 +1764,40 @@ public:
void setParamAttrs(const PAListPtr &Attrs) { ParamAttrs = Attrs; }
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
bool paramHasAttr(unsigned i, ParameterAttributes attr) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
uint16_t getParamAlignment(uint16_t i) const;
unsigned getParamAlignment(unsigned i) const {
return ParamAttrs.getParamAlignment(i);
}
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const;
bool doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const;
bool onlyReadsMemory() const {
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const;
bool doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const;
bool doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
void setDoesNotThrow(bool doesNotThrow = true);
/// @brief Determine if the call returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const;
bool hasStructRetAttr() const {
// Be friendly and also check the callee.
return paramHasAttr(1, ParamAttr::StructRet);
}
/// getCalledFunction - Return the function called, or null if this is an
/// indirect function invocation.

View File

@ -137,42 +137,6 @@ void Function::eraseFromParent() {
getParent()->getFunctionList().erase(this);
}
/// @brief Determine whether the function has the given attribute.
bool Function::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return ParamAttrs.paramHasAttr(i, attr);
}
/// @brief Extract the alignment for a call or parameter (0=unknown).
uint16_t Function::getParamAlignment(uint16_t i) const {
return ParamAttrs.getParamAlignment(i);
}
/// @brief Determine if the function cannot return.
bool Function::doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the function cannot unwind.
bool Function::doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
/// @brief Determine if the function does not access memory.
bool Function::doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
}
/// @brief Determine if the function does not access or only reads memory.
bool Function::onlyReadsMemory() const {
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
/// @brief Determine if the function returns a structure through first
/// pointer argument.
bool Function::hasStructRetAttr() const {
return paramHasAttr(1, ParamAttr::StructRet);
}
//===----------------------------------------------------------------------===//
// Function Implementation
//===----------------------------------------------------------------------===//

View File

@ -362,7 +362,7 @@ CallInst::CallInst(const CallInst &CI)
OL[i].init(InOL[i], this);
}
bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
bool CallInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
if (ParamAttrs.paramHasAttr(i, attr))
return true;
if (const Function *F = getCalledFunction())
@ -370,47 +370,6 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
uint16_t CallInst::getParamAlignment(uint16_t i) const {
return ParamAttrs.getParamAlignment(i);
}
/// @brief Determine if the call does not access memory.
bool CallInst::doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
}
/// @brief Determine if the call does not access or only reads memory.
bool CallInst::onlyReadsMemory() const {
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
/// @brief Determine if the call cannot return.
bool CallInst::doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the call cannot unwind.
bool CallInst::doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
/// @brief Determine if the call returns a structure through first
/// pointer argument.
bool CallInst::hasStructRetAttr() const {
// Be friendly and also check the callee.
return paramHasAttr(1, ParamAttr::StructRet);
}
/// @brief Determine if any call argument is an aggregate passed by value.
bool CallInst::hasByValArgument() const {
if (ParamAttrs.hasAttrSomewhere(ParamAttr::ByVal))
return true;
// Be consistent with other methods and check the callee too.
if (const Function *F = getCalledFunction())
return F->getParamAttrs().hasAttrSomewhere(ParamAttr::ByVal);
return false;
}
void CallInst::setDoesNotThrow(bool doesNotThrow) {
PAListPtr PAL = getParamAttrs();
if (doesNotThrow)
@ -473,7 +432,7 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
return setSuccessor(idx, B);
}
bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
bool InvokeInst::paramHasAttr(unsigned i, ParameterAttributes attr) const {
if (ParamAttrs.paramHasAttr(i, attr))
return true;
if (const Function *F = getCalledFunction())
@ -481,30 +440,6 @@ bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
uint16_t InvokeInst::getParamAlignment(uint16_t i) const {
return ParamAttrs.getParamAlignment(i);
}
/// @brief Determine if the call does not access memory.
bool InvokeInst::doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
}
/// @brief Determine if the call does not access or only reads memory.
bool InvokeInst::onlyReadsMemory() const {
return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
}
/// @brief Determine if the call cannot return.
bool InvokeInst::doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the call cannot unwind.
bool InvokeInst::doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
void InvokeInst::setDoesNotThrow(bool doesNotThrow) {
PAListPtr PAL = getParamAttrs();
if (doesNotThrow)
@ -514,13 +449,6 @@ void InvokeInst::setDoesNotThrow(bool doesNotThrow) {
setParamAttrs(PAL);
}
/// @brief Determine if the invoke returns a structure through first
/// pointer argument.
bool InvokeInst::hasStructRetAttr() const {
// Be friendly and also check the callee.
return paramHasAttr(1, ParamAttr::StructRet);
}
//===----------------------------------------------------------------------===//
// ReturnInst Implementation