pyqir
pyqir copied to clipboard
LLVM objects should implement `__repr__`
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:

It would be good if parser objects supported __repr__
to provide more useful diagnostic output in such contexts.
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
.