This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix printing of global operands
ClosedPublic

Authored by dschuff on Nov 11 2015, 2:06 PM.

Details

Summary

They still need to be printed as "i32.const" rather than "global".
(Fixed from r252656 which wasn't quite NFC)

Diff Detail

Event Timeline

dschuff updated this revision to Diff 39973.Nov 11 2015, 2:06 PM
dschuff retitled this revision from to [WebAssembly] Fix printing of global operands.
dschuff updated this object.
dschuff added a reviewer: sunfish.
dschuff added subscribers: llvm-commits, jfb.
sunfish requested changes to this revision.Nov 11 2015, 5:46 PM
sunfish edited edge metadata.

Actually, I believe there's a better way to fix this. X86 uses this, for example:

def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;

We should be able to replace our GLOBAL instruction with essentially the same thing (our version of MOV32ri is just Const_I32). This will use i32.const instructions right from the start, so they should then go down the normal path in the assembly printer.

This revision now requires changes to proceed.Nov 11 2015, 5:46 PM
dschuff updated this revision to Diff 40336.Nov 16 2015, 1:44 PM
dschuff edited edge metadata.
  • Use a pattern instead of a custom instruction
jfb accepted this revision.Nov 16 2015, 4:18 PM
jfb added a reviewer: jfb.

lgtm

This revision was automatically updated to reflect the committed changes.