diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 21:38:14 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 21:38:14 +0000 |
commit | 3e2d76c946ba753c2b11af192a52e25b6f9b46ff (patch) | |
tree | 5486e6c9eeb14e5a5ac48625df20fb18182ba5eb /include | |
parent | 9ef99c96da5882f18daa67132f511a32cc26f2d8 (diff) |
Use the attribute enums to query if a parameter has an attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Attributes.h | 4 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 22 | ||||
-rw-r--r-- | include/llvm/Support/CallSite.h | 36 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 6 |
4 files changed, 14 insertions, 54 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h index 2933defe96..1c2770995c 100644 --- a/include/llvm/Attributes.h +++ b/include/llvm/Attributes.h @@ -295,7 +295,7 @@ public: static Attributes constructAlignmentFromInt(unsigned i) { // Default alignment, allow the target to define how to align it. if (i == 0) - return Attribute::None; + return Attributes(); assert(isPowerOf2_32(i) && "Alignment must be a power of two."); assert(i <= 0x40000000 && "Alignment too large."); @@ -307,7 +307,7 @@ public: static Attributes constructStackAlignmentFromInt(unsigned i) { // Default alignment, allow the target to define how to align it. if (i == 0) - return Attribute::None; + return Attributes(); assert(isPowerOf2_32(i) && "Alignment must be a power of two."); assert(i <= 0x100 && "Alignment too large."); diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 597eca5aa4..ea3aaae9c6 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -1277,14 +1277,7 @@ public: bool fnHasReturnsTwiceAttr() const; /// @brief Determine whether the call or the callee has the given attributes. - bool paramHasByValAttr(unsigned i) const; - bool paramHasInRegAttr(unsigned i) const; - bool paramHasNestAttr(unsigned i) const; - bool paramHasNoAliasAttr(unsigned i) const; - bool paramHasNoCaptureAttr(unsigned i) const; - bool paramHasSExtAttr(unsigned i) const; - bool paramHasStructRetAttr(unsigned i) const; - bool paramHasZExtAttr(unsigned i) const; + bool paramHasAttr(unsigned i, Attributes::AttrVal A) const; /// @brief Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { @@ -1343,7 +1336,7 @@ public: /// pointer argument. bool hasStructRetAttr() const { // Be friendly and also check the callee. - return paramHasStructRetAttr(1); + return paramHasAttr(1, Attributes::StructRet); } /// @brief Determine if any call argument is an aggregate passed by value. @@ -3053,14 +3046,7 @@ public: bool fnHasReturnsTwiceAttr() const; /// @brief Determine whether the call or the callee has the given attributes. - bool paramHasSExtAttr(unsigned i) const; - bool paramHasZExtAttr(unsigned i) const; - bool paramHasInRegAttr(unsigned i) const; - bool paramHasStructRetAttr(unsigned i) const; - bool paramHasNestAttr(unsigned i) const; - bool paramHasByValAttr(unsigned i) const; - bool paramHasNoAliasAttr(unsigned i) const; - bool paramHasNoCaptureAttr(unsigned i) const; + bool paramHasAttr(unsigned i, Attributes::AttrVal A) const; /// @brief Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { @@ -3110,7 +3096,7 @@ public: /// pointer argument. bool hasStructRetAttr() const { // Be friendly and also check the callee. - return paramHasStructRetAttr(1); + return paramHasAttr(1, Attributes::StructRet); } /// @brief Determine if any call argument is an aggregate passed by value. diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index bbbec6d46c..c15326ee95 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -210,35 +210,9 @@ public: CALLSITE_DELEGATE_GETTER(hasFnAttr(N)); } - /// paramHas*Attr - whether the call or the callee has the given attribute. - bool paramHasSExtAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasSExtAttr(i)); - } - bool paramHasZExtAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasZExtAttr(i)); - } - bool paramHasInRegAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasInRegAttr(i)); - } - bool paramHasStructRetAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasStructRetAttr(i)); - } - bool paramHasNestAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasNestAttr(i)); - } - bool paramHasByValAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasByValAttr(i)); - } - bool paramHasNoAliasAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasNoAliasAttr(i)); - } - bool paramHasNoCaptureAttr(unsigned i) const { - CALLSITE_DELEGATE_GETTER(paramHasNoCaptureAttr(i)); - } - - /// paramHasAttr - whether the call or the callee has the given attribute. - bool paramHasAttr(uint16_t i, Attributes attr) const { - CALLSITE_DELEGATE_GETTER(paramHasAttr(i, attr)); + /// \brief Return true if the call or the callee has the given attribute. + bool paramHasAttr(unsigned i, Attributes::AttrVal A) const { + CALLSITE_DELEGATE_GETTER(paramHasAttr(i, A)); } /// @brief Extract the alignment for a call or parameter (0=unknown). @@ -291,12 +265,12 @@ public: /// @brief Determine whether this argument is not captured. bool doesNotCapture(unsigned ArgNo) const { - return paramHasNoCaptureAttr(ArgNo + 1); + return paramHasAttr(ArgNo + 1, Attributes::NoCapture); } /// @brief Determine whether this argument is passed by value. bool isByValArgument(unsigned ArgNo) const { - return paramHasByValAttr(ArgNo + 1); + return paramHasAttr(ArgNo + 1, Attributes::ByVal); } /// hasArgument - Returns true if this CallSite passes the given Value* as an diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 6f57e0a831..b3149e960a 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -1323,9 +1323,9 @@ public: FunctionType *FTy, bool isTailCall, SDValue callee, ArgListTy &args, SelectionDAG &dag, DebugLoc dl, ImmutableCallSite &cs) - : Chain(chain), RetTy(retTy), RetSExt(cs.paramHasSExtAttr(0)), - RetZExt(cs.paramHasZExtAttr(0)), IsVarArg(FTy->isVarArg()), - IsInReg(cs.paramHasInRegAttr(0)), + : Chain(chain), RetTy(retTy), RetSExt(cs.paramHasAttr(0, Attributes::SExt)), + RetZExt(cs.paramHasAttr(0, Attributes::ZExt)), IsVarArg(FTy->isVarArg()), + IsInReg(cs.paramHasAttr(0, Attributes::InReg)), DoesNotReturn(cs.doesNotReturn()), IsReturnValueUsed(!cs.getInstruction()->use_empty()), IsTailCall(isTailCall), NumFixedArgs(FTy->getNumParams()), |