[PATCH] D19419: [ELF] - Implemented comparsion operators for linkerscript

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 15:02:05 PDT 2016


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with a nit.


================
Comment at: ELF/LinkerScript.cpp:121-147
@@ -114,17 +120,29 @@
 static uint64_t apply(StringRef Op, uint64_t L, uint64_t R) {
   if (Op == "+")
     return L + R;
   if (Op == "-")
     return L - R;
   if (Op == "*")
     return L * R;
   if (Op == "/") {
     if (R == 0) {
       error("division by zero");
       return 0;
     }
     return L / R;
   }
   if (Op == "&")
     return L & R;
+  if (Op == "<")
+    return L < R;
+  if (Op == ">")
+    return L > R;
+  if (Op == ">=")
+    return L >= R;
+  if (Op == "<=")
+    return L <= R;
+  if (Op == "==")
+    return L == R;
+  if (Op == "!=")
+    return L != R;
   llvm_unreachable("invalid operator");
----------------
Let's sort them in the same order as the operator precedence.


http://reviews.llvm.org/D19419





More information about the llvm-commits mailing list