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

Jason W Kim jason.w.kim.2009 at gmail.com
Wed Dec 1 14:46:50 PST 2010


Author: jasonwkim
Date: Wed Dec  1 16:46:50 2010
New Revision: 120619

URL: http://llvm.org/viewvc/llvm-project?rev=120619&view=rev
Log:
fixing style nit: move class static to global static

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=120619&r1=120618&r2=120619&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp Wed Dec  1 16:46:50 2010
@@ -38,48 +38,6 @@
   unsigned getPointerSize() const {
     return 4;
   }
-
-protected:
-  static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
-    switch (Kind) {
-    default:
-      llvm_unreachable("Unknown fixup kind!");
-    case FK_Data_4:
-    case ARM::fixup_arm_movt_hi16:
-    case ARM::fixup_arm_movw_lo16:
-      return Value;
-    case ARM::fixup_arm_pcrel_12: {
-      bool isAdd = true;
-      // ARM PC-relative values are offset by 8.
-      Value -= 8;
-      if ((int64_t)Value < 0) {
-        Value = -Value;
-        isAdd = false;
-      }
-      assert ((Value < 4096) && "Out of range pc-relative fixup value!");
-      Value |= isAdd << 23;
-      return Value;
-    }
-    case ARM::fixup_arm_branch:
-      // These values don't encode the low two bits since they're always zero.
-      // Offset by 8 just as above.
-      return (Value - 8) >> 2;
-    case ARM::fixup_arm_pcrel_10: {
-      // Offset by 8 just as above.
-      Value = Value - 8;
-      bool isAdd = true;
-      if ((int64_t)Value < 0) {
-        Value = -Value;
-        isAdd = false;
-      }
-      // These values don't encode the low two bits since they're always zero.
-      Value >>= 2;
-      assert ((Value < 256) && "Out of range pc-relative fixup value!");
-      Value |= isAdd << 23;
-      return Value;
-    }
-    }
-  }
 };
 } // end anonymous namespace
 
@@ -101,6 +59,47 @@
   return true;
 }
 
+static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
+  switch (Kind) {
+  default:
+    llvm_unreachable("Unknown fixup kind!");
+  case FK_Data_4:
+  case ARM::fixup_arm_movt_hi16:
+  case ARM::fixup_arm_movw_lo16:
+    return Value;
+  case ARM::fixup_arm_pcrel_12: {
+    bool isAdd = true;
+    // ARM PC-relative values are offset by 8.
+    Value -= 8;
+    if ((int64_t)Value < 0) {
+      Value = -Value;
+      isAdd = false;
+    }
+    assert ((Value < 4096) && "Out of range pc-relative fixup value!");
+    Value |= isAdd << 23;
+    return Value;
+  }
+  case ARM::fixup_arm_branch:
+    // These values don't encode the low two bits since they're always zero.
+    // Offset by 8 just as above.
+    return (Value - 8) >> 2;
+  case ARM::fixup_arm_pcrel_10: {
+    // Offset by 8 just as above.
+    Value = Value - 8;
+    bool isAdd = true;
+    if ((int64_t)Value < 0) {
+      Value = -Value;
+      isAdd = false;
+    }
+    // These values don't encode the low two bits since they're always zero.
+    Value >>= 2;
+    assert ((Value < 256) && "Out of range pc-relative fixup value!");
+    Value |= isAdd << 23;
+    return Value;
+  }
+  }
+}
+
 namespace {
 // FIXME: This should be in a separate file.
 // ELF is an ELF of course...





More information about the llvm-commits mailing list