Provide convenient access to the zext/sext attributes of function arguments. NFC.
authorJuergen Ributzka <juergen@apple.com>
Tue, 5 Aug 2014 05:43:41 +0000 (05:43 +0000)
committerJuergen Ributzka <juergen@apple.com>
Tue, 5 Aug 2014 05:43:41 +0000 (05:43 +0000)
llvm-svn: 214843

llvm/include/llvm/IR/Argument.h
llvm/lib/IR/Function.cpp

index 7c398a5..dd76a90 100644 (file)
@@ -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);
 
index de59b26..f1fe660 100644 (file)
@@ -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 {