Document that MCExpr::Mod is actually remainder.
authorDan Gohman <gohman@apple.com>
Mon, 8 Feb 2010 23:58:47 +0000 (23:58 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 8 Feb 2010 23:58:47 +0000 (23:58 +0000)
Document that MCExpr::Div, Mod, and the comparison operators are all
signed operators.

Document that the comparison operators' results are target-dependent.

Document that the behavior of shr is target-dependent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95619 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCExpr.h
lib/MC/MCExpr.cpp

index 04eeb6666a76142740d83c3ef26dd9268b0f4770..afc90d910b211d4dbb8d3e51f9ddd06ed49bf30c 100644 (file)
@@ -202,20 +202,24 @@ public:
   enum Opcode {
     Add,  ///< Addition.
     And,  ///< Bitwise and.
-    Div,  ///< Division.
+    Div,  ///< Signed division.
     EQ,   ///< Equality comparison.
-    GT,   ///< Greater than comparison.
-    GTE,  ///< Greater than or equal comparison.
+    GT,   ///< Signed greater than comparison (result is either 0 or some
+          ///< target-specific non-zero value)
+    GTE,  ///< Signed greater than or equal comparison (result is either 0 or
+          ///< some target-specific non-zero value).
     LAnd, ///< Logical and.
     LOr,  ///< Logical or.
-    LT,   ///< Less than comparison.
-    LTE,  ///< Less than or equal comparison.
-    Mod,  ///< Modulus.
+    LT,   ///< Signed less than comparison (result is either 0 or
+          ///< some target-specific non-zero value).
+    LTE,  ///< Signed less than or equal comparison (result is either 0 or
+          ///< some target-specific non-zero value).
+    Mod,  ///< Signed remainder.
     Mul,  ///< Multiplication.
     NE,   ///< Inequality comparison.
     Or,   ///< Bitwise or.
-    Shl,  ///< Bitwise shift left.
-    Shr,  ///< Bitwise shift right.
+    Shl,  ///< Shift left.
+    Shr,  ///< Shift right (arithmetic or logical, depending on target)
     Sub,  ///< Subtraction.
     Xor   ///< Bitwise exclusive or.
   };
index afdaa00926caf750e02ea2b66e67970dfd606d39..e419043a771749acc36796fa71f937f01a41139d 100644 (file)
@@ -252,8 +252,8 @@ bool MCExpr::EvaluateAsRelocatable(MCValue &Res) const {
     }
 
     // FIXME: We need target hooks for the evaluation. It may be limited in
-    // width, and gas defines the result of comparisons differently from Apple
-    // as (the result is sign extended).
+    // width, and gas defines the result of comparisons and right shifts
+    // differently from Apple as.
     int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant();
     int64_t Result = 0;
     switch (ABE->getOpcode()) {