Page MenuHomePhabricator

[MCA] Add support for printing immedate values as hex. Also enable lexing of masm binary and hex literals.

Authored by andreadb on Aug 1 2019, 9:58 AM.



This patch adds a new llvm-mca flag named -print-imm-hex.

By default, the instruction printer prints immediate operands as decimals. Flag -print-imm-hex enables the instruction printer to print those operands in hex.

This patch also adds support for MASM binary and hex literal numbers (example 0FFh, 101b).
Added tests to verify the behavior of the new flag. Tests also verify that masm numeric literal operands are now recognized.

Please let me know if okay to commit.

Diff Detail


Event Timeline

andreadb created this revision.Aug 1 2019, 9:58 AM
lebedev.ri added inline comments.Aug 1 2019, 10:04 AM
93 ↗(On Diff #212836)

for *outputting* immediate values
This has no effect on input, right?

andreadb marked an inline comment as done.Aug 1 2019, 10:16 AM
andreadb added inline comments.
93 ↗(On Diff #212836)


I can change it to "Prefer hex format for outputting immediate values".
Alternatively, I could write "Prefer hex format when printing immediate values".
Not sure which one is better.

lebedev.ri added inline comments.Aug 1 2019, 10:28 AM
93 ↗(On Diff #212836)

"Prefer hex format when printing immediate values" IMHO

andreadb updated this revision to Diff 212852.Aug 1 2019, 10:38 AM

Addressed review comment.

lebedev.ri accepted this revision.Aug 1 2019, 10:47 AM

Looks ok i guess.

This revision is now accepted and ready to land.Aug 1 2019, 10:47 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2019, 3:41 AM