Create a new class, MemOperand, for describing memory references
[oota-llvm.git] / include / llvm / Instructions.h
index 3c8673e627aead6c4705e4de86a288107a4cf2fb..49ec4f54fd5cc20227d648b7944b17901e2dca37 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -20,7 +20,6 @@
 
 #include "llvm/InstrTypes.h"
 #include "llvm/DerivedTypes.h"
-#include "llvm/ParameterAttributes.h"
 
 namespace llvm {
 
@@ -643,6 +642,18 @@ public:
   /// @brief Return the signed version of the predicate.
   static Predicate getSignedPredicate(Predicate pred);
 
+  /// For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
+  /// @returns the predicate that would be the result if the operand were
+  /// regarded as unsigned.
+  /// @brief Return the unsigned version of the predicate
+  Predicate getUnsignedPredicate() const {
+    return getUnsignedPredicate(getPredicate());
+  }
+
+  /// This is a static version that you can use without an instruction.
+  /// @brief Return the unsigned version of the predicate.
+  static Predicate getUnsignedPredicate(Predicate pred);
+
   /// isEquality - Return true if this predicate is either EQ or NE.  This also
   /// tests for commutativity.
   static bool isEquality(Predicate P) {
@@ -927,33 +938,26 @@ public:
   void setParamAttrs(const ParamAttrsList *attrs);
 
   /// @brief Determine whether the call or the callee has the given attribute.
-  bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
+  bool paramHasAttr(uint16_t i, unsigned attr) const;
 
   /// @brief Determine if the call does not access memory.
-  bool doesNotAccessMemory() const {
-    return paramHasAttr(0, ParamAttr::ReadNone);
-  }
-
+  bool doesNotAccessMemory() const;
+  
   /// @brief Determine if the call does not access or only reads memory.
-  bool onlyReadsMemory() const {
-    return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
-  }
-
+  bool onlyReadsMemory() const;
+  
   /// @brief Determine if the call cannot return.
-  bool isNoReturn() const {
-    return paramHasAttr(0, ParamAttr::NoReturn);
-  }
+  bool doesNotReturn() const;
 
   /// @brief Determine if the call cannot unwind.
-  bool isNoUnwind() const {
-    return paramHasAttr(0, ParamAttr::NoUnwind);
-  }
+  bool doesNotThrow() const;
+  void setDoesNotThrow(bool doesNotThrow = true);
 
   /// @brief Determine if the call returns a structure.
-  bool isStructReturn() const {
-    // Be friendly and also check the callee.
-    return paramHasAttr(1, ParamAttr::StructRet);
-  }
+  bool isStructReturn() const;
+
+  /// @brief Determine if any call argument is an aggregate passed by value.
+  bool hasByValArgument() const;
 
   /// getCalledFunction - Return the function being called by this instruction
   /// if it is a direct call.  If it is a call through a function pointer,
@@ -1731,33 +1735,23 @@ public:
   void setParamAttrs(const ParamAttrsList *attrs);
 
   /// @brief Determine whether the call or the callee has the given attribute.
-  bool paramHasAttr(uint16_t i, ParameterAttributes attr) const;
+  bool paramHasAttr(uint16_t i, unsigned attr) const;
 
   /// @brief Determine if the call does not access memory.
-  bool doesNotAccessMemory() const {
-    return paramHasAttr(0, ParamAttr::ReadNone);
-  }
+  bool doesNotAccessMemory() const;
 
   /// @brief Determine if the call does not access or only reads memory.
-  bool onlyReadsMemory() const {
-    return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly);
-  }
+  bool onlyReadsMemory() const;
 
   /// @brief Determine if the call cannot return.
-  bool isNoReturn() const {
-    return paramHasAttr(0, ParamAttr::NoReturn);
-  }
+  bool doesNotReturn() const;
 
   /// @brief Determine if the call cannot unwind.
-  bool isNoUnwind() const {
-    return paramHasAttr(0, ParamAttr::NoUnwind);
-  }
+  bool doesNotThrow() const;
+  void setDoesNotThrow(bool doesNotThrow = true);
 
   /// @brief Determine if the call returns a structure.
-  bool isStructReturn() const {
-    // Be friendly and also check the callee.
-    return paramHasAttr(1, ParamAttr::StructRet);
-  }
+  bool isStructReturn() const;
 
   /// getCalledFunction - Return the function called, or null if this is an
   /// indirect function invocation.