[llvm-commits] [llvm] r121337 - /llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp

Bill Wendling isanbard at gmail.com
Wed Dec 8 16:44:33 PST 2010


Author: void
Date: Wed Dec  8 18:44:33 2010
New Revision: 121337

URL: http://llvm.org/viewvc/llvm-project?rev=121337&view=rev
Log:
Attempt to make the bit-twiddling readable resulted in the binary value being
overwritten.

Modified:
    llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp?rev=121337&r1=121336&r2=121337&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp Wed Dec  8 18:44:33 2010
@@ -152,10 +152,11 @@
     // Note that the halfwords are stored high first, low second; so we need
     // to transpose the fixup value here to map properly.
     unsigned isNeg = (int64_t(Value) < 0) ? 1 : 0;
-    uint32_t Binary = 0x3fffff & ((Value - 4) >> 1);
-    Binary  = (Binary & 0x7ff) << 16;    // Low imm11 value.
-    Binary |= (Binary & 0x1ffc00) >> 11; // High imm10 value.
-    Binary |= isNeg << 10;               // Sign bit.
+    uint32_t Binary = 0;
+    Value = 0x3fffff & ((Value - 4) >> 1);
+    Binary  = (Value & 0x7ff) << 16;    // Low imm11 value.
+    Binary |= (Value & 0x1ffc00) >> 11; // High imm10 value.
+    Binary |= isNeg << 10;              // Sign bit.
     return Binary;
   }
   case ARM::fixup_arm_thumb_blx: {
@@ -169,10 +170,11 @@
     // Note that the halfwords are stored high first, low second; so we need
     // to transpose the fixup value here to map properly.
     unsigned isNeg = (int64_t(Value) < 0) ? 1 : 0;
-    uint32_t Binary = 0xfffff & ((Value - 2) >> 2);
-    Binary  = (Binary & 0x3ff) << 17;    // Low imm10L value.
-    Binary |= (Binary & 0xffc00) >> 10;  // High imm10H value.
-    Binary |= isNeg << 10;               // Sign bit.
+    uint32_t Binary = 0;
+    Value = 0xfffff & ((Value - 2) >> 2);
+    Binary  = (Value & 0x3ff) << 17;    // Low imm10L value.
+    Binary |= (Value & 0xffc00) >> 10;  // High imm10H value.
+    Binary |= isNeg << 10;              // Sign bit.
     return Binary;
   }
   case ARM::fixup_arm_thumb_cp:





More information about the llvm-commits mailing list