This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Implement SystemZOperand::print()
ClosedPublic

Authored by jonpa on Oct 16 2018, 9:50 AM.

Details

Reviewers
uweigand
jonpa
Summary

I tried compiling a file with "-mllvm -debug", and found that this caused a crash, since there was an unimplemented function in SystemZAsmParser.

I have tried to implement this to make a readable output which basically means trying to print the values of the operands by casting them to the right MCExpr subclass.

I tried to print register names but did not find a trivial way to get the MachineRegisterInfo. Now register integer values are printed instead.

Diff Detail

Event Timeline

jonpa created this revision.Oct 16 2018, 9:50 AM

I tried to print register names but did not find a trivial way to get the MachineRegisterInfo. Now register integer values are printed instead.

You should be using SystemZInstPrinter::getRegisterName, see e.g. how X86Operand::print is implemented.

Also, I think it should be straightforward to also print memory operands correctly.

jonpa updated this revision to Diff 170140.Oct 18 2018, 6:32 PM

OK - now also print registers by name and memory operands.

  • Copied the output style from X86, with 'Imm:', 'Reg:', etc.
  • Could not think of an instruction with a ImmTLS with a non-null Sym for the test.
  • Removed the printing of '?' I tried before and instead print nothing. I found it confusing...
jonpa updated this revision to Diff 170141.Oct 18 2018, 6:36 PM

Fix whitespace errors in test case.

See inline comment. Otherwise LGTM.

lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
680

Index should also be printed *before* the base.

test/MC/SystemZ/asm-match.s
31

Should be r2, r3 ... see above

jonpa accepted this revision.Oct 25 2018, 5:43 PM
jonpa marked 2 inline comments as done.

Thanks for review.
Committed as r345349.

test/MC/SystemZ/asm-match.s
31

Oops...

This revision is now accepted and ready to land.Oct 25 2018, 5:43 PM
jonpa closed this revision.Oct 25 2018, 5:44 PM
jonpa marked an inline comment as done.