HomePhabricator

Add support for custom op parser/printer hooks to know about result names.

Authored by lattner on Mar 15 2020, 5:13 PM.

Description

Add support for custom op parser/printer hooks to know about result names.

Summary:
This allows the custom parser/printer hooks to do interesting things with
the SSA names. This patch:

  • Adds a new 'getResultName' method to OpAsmParser that allows a parser implementation to get information about its result names, along with a getNumResults() method that allows op parser impls to know how many results are expected.
  • Adds a OpAsmPrinter::printOperand overload that takes an explicit stream.
  • Adds a test.string_attr_pretty_name operation that uses these hooks to do fancy things with the result name.

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76205

Details