[llvm] r214843 - Provide convenient access to the zext/sext attributes of function arguments. NFC.
Juergen Ributzka
juergen at apple.com
Mon Aug 4 22:43:41 PDT 2014
Author: ributzka
Date: Tue Aug 5 00:43:41 2014
New Revision: 214843
URL: http://llvm.org/viewvc/llvm-project?rev=214843&view=rev
Log:
Provide convenient access to the zext/sext attributes of function arguments. NFC.
Modified:
llvm/trunk/include/llvm/IR/Argument.h
llvm/trunk/lib/IR/Function.cpp
Modified: llvm/trunk/include/llvm/IR/Argument.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Argument.h?rev=214843&r1=214842&r2=214843&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Argument.h (original)
+++ llvm/trunk/include/llvm/IR/Argument.h Tue Aug 5 00:43:41 2014
@@ -105,6 +105,14 @@ public:
/// its containing function.
bool hasInAllocaAttr() const;
+ /// \brief Return true if this argument has the zext attribute on it in its
+ /// containing function.
+ bool hasZExtAttr() const;
+
+ /// \brief Return true if this argument has the sext attribute on it in its
+ /// containing function.
+ bool hasSExtAttr() const;
+
/// \brief Add a Attribute to an argument.
void addAttr(AttributeSet AS);
Modified: llvm/trunk/lib/IR/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Function.cpp?rev=214843&r1=214842&r2=214843&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Function.cpp (original)
+++ llvm/trunk/lib/IR/Function.cpp Tue Aug 5 00:43:41 2014
@@ -166,6 +166,20 @@ bool Argument::hasReturnedAttr() const {
hasAttribute(getArgNo()+1, Attribute::Returned);
}
+/// hasZExtAttr - Return true if this argument has the zext attribute on it in
+/// its containing function.
+bool Argument::hasZExtAttr() const {
+ return getParent()->getAttributes().
+ hasAttribute(getArgNo()+1, Attribute::ZExt);
+}
+
+/// hasSExtAttr Return true if this argument has the sext attribute on it in its
+/// containing function.
+bool Argument::hasSExtAttr() const {
+ return getParent()->getAttributes().
+ hasAttribute(getArgNo()+1, Attribute::SExt);
+}
+
/// Return true if this argument has the readonly or readnone attribute on it
/// in its containing function.
bool Argument::onlyReadsMemory() const {
More information about the llvm-commits
mailing list