[PATCH] D18242: [TableGen] AsmMatcher: support for default values for optional operands

Sam Kolton via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 06:33:18 PDT 2016


SamWot added inline comments.

================
Comment at: include/llvm/Target/Target.td:628-630
@@ +627,5 @@
+  /// signature should be:
+  ///   std::unique_ptr<MCParsedAsmOperand> defaultFooOperands(
+  ///           unsigned Opcode,
+  ///           const OperandVector &Operands) const;
+  string DefaultMethod = ?;
----------------
ab wrote:
> Why pass anything?  You don't use the Opcode, and the Operands are only used for the location:
> - what happens when the first and only operand is optional?
> - loc of the preceding operand is probably more accurate; but I think just using SMLoc() makes the most sense
> - does anything look at locations at this point anyway? If there's an error it would have been caught earlier, no?
I added Opcode and Operands to arguments list because this arguments seems to be useful in defaultMethod. It is not hard to imagine situation when default value for operand differs depending on instruction opcode or other operands presented in instruction. But if you think that they are unnecessary I can remove them.

There is always first operand in OperandVector - instruction mnemonic.




http://reviews.llvm.org/D18242





More information about the llvm-commits mailing list