[llvm-commits] [llvm] r95619 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp

Dan Gohman gohman at apple.com
Mon Feb 8 15:58:47 PST 2010


Author: djg
Date: Mon Feb  8 17:58:47 2010
New Revision: 95619

URL: http://llvm.org/viewvc/llvm-project?rev=95619&view=rev
Log:
Document that MCExpr::Mod is actually remainder.

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.

Modified:
    llvm/trunk/include/llvm/MC/MCExpr.h
    llvm/trunk/lib/MC/MCExpr.cpp

Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=95619&r1=95618&r2=95619&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Feb  8 17:58:47 2010
@@ -202,20 +202,24 @@
   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.
   };

Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=95619&r1=95618&r2=95619&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Mon Feb  8 17:58:47 2010
@@ -252,8 +252,8 @@
     }
 
     // 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()) {





More information about the llvm-commits mailing list