[PATCH] [ARM64] Re-work parsing of ADD/SUB shifted immediate operands

Tim Northover t.p.northover at gmail.com
Thu May 8 05:03:52 PDT 2014

Hi Bradley,

I've got a few more comments on this one...

Comment at: lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp:581-583
@@ +580,5 @@
+      unsigned Shift = ShiftedImm.ShiftAmount;
+      if (ARM64_AM::getShiftType(Shift) != ARM64_AM::LSL ||
+         (ARM64_AM::getShiftValue(Shift) != 0 &&
+          ARM64_AM::getShiftValue(Shift) != 12))
+        return false;
I don't think these are correct here. They're for unpacking a binary encoded shift, but tryParseAddSubImm gives no indication that's what it's creating (& the name ShiftAmount would be misleading if it did).

Comment at: lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp:2306-2307
@@ +2305,4 @@
+/// tryParseAddSubImm - Parse ADD/SUB shifted immediate operand
+ARM64AsmParser::tryParseAddSubImm(OperandVector &Operands) {
+  SMLoc S = getLoc();
Given its name and current purpose, this function seems more generic than necessary. (E.g. accepting arbitrary shift amounts when only 12 is ever valid).

Do you intend to use it for other cases, or should it be simplified?


More information about the llvm-commits mailing list