move a bunch of trivial methods to be inline.
authorChris Lattner <sabre@nondot.org>
Thu, 13 Mar 2008 05:00:21 +0000 (05:00 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Mar 2008 05:00:21 +0000 (05:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48326 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Function.h
include/llvm/Instructions.h
lib/VMCore/Function.cpp
lib/VMCore/Instructions.cpp

index be7ea910495e11567b2bdac0a3c06642ff5ffb5d..36b0dd3df8cb424ac503c6a7185bc2aee7ba7501 100644 (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.
index 741153f2883cb46e3f4f9401e3e7496cf48cab0d..c80154c76d0a3804820078ed04dcf15b426fd7e8 100644 (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.
index 5a69c099f6935dd0a23b2e9e4b6855e3fdd1f336..6fd3af4f9d87b80211da0d6f6c3bc4cc194db329 100644 (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
 //===----------------------------------------------------------------------===//
index ee9a02e91acc8de86a8b1043e8646343897a4f53..df5a2fc0cfcb49050dd4e488ef3739e95490f8d2 100644 (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