pyqir icon indicating copy to clipboard operation
pyqir copied to clipboard

LLVM objects should implement `__repr__`

Open cgranade opened this issue 3 years ago • 1 comments

When printing out pyqir_parser objects at the console or in a notebook, the default object.__repr__ implementation is used, making it hard to understand output without further processing:

image

It would be good if parser objects supported __repr__ to provide more useful diagnostic output in such contexts.

cgranade avatar Feb 08 '22 21:02 cgranade

Value (and its subtypes, including Function, BasicBlock, Instruction, etc.) now has __str__ which prints the LLVM IR text. It's not as obvious to me what to do for __repr__, since there is no string that can reproduce the object when run through Python eval.

bamarsha avatar Nov 22 '22 20:11 bamarsha