This is an archive of the discontinued LLVM Phabricator instance.

WebAssembly: update syntax
ClosedPublic

Authored by jfb on Oct 13 2015, 5:42 PM.

Details

Summary

Follow the same syntax as for the spec repo. Both have evolved slightly independently and need to converge again.

Diff Detail

Repository
rL LLVM

Event Timeline

jfb updated this revision to Diff 37304.Oct 13 2015, 5:42 PM
jfb retitled this revision from to WebAssembly: update syntax.
jfb added a reviewer: sunfish.
jfb updated this object.
jfb added a subscriber: llvm-commits.
jfb added a comment.Oct 13 2015, 5:43 PM

This is still a work in progress, I'm still playing with a few options and figure uploading something is helpful.

sunfish added inline comments.Oct 14 2015, 6:37 PM
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
252 ↗(On Diff #37304)

Instead of collecting locals as we go and emitting them at the end, it'd be nice to declare them up front.

We can get the set of registers to declare up front by iterating through the vregs (using MRI->getNumVirtRegs(), TargetRegisterInfo::index2VirtReg(i)), use MRI->use_empty(Reg) to test whether a register is actually ever live, and use MRI->getRegClass(Reg) to get the type.

jfb updated this revision to Diff 37526.Oct 15 2015, 3:14 PM
  • Print .local at the start of the function.
jfb marked an inline comment as done.Oct 15 2015, 3:14 PM
jfb updated this revision to Diff 37534.Oct 15 2015, 3:54 PM
  • Use parens for get_local. Kinda hacky, but it makes the end-to-end thing happy. We can figure out what it should look like with wasmate later.
jfb updated this revision to Diff 37535.Oct 15 2015, 4:01 PM
  • Remove @ from tests.
jfb updated this revision to Diff 37537.Oct 15 2015, 4:45 PM
  • Don't print an extra line if there are no locals. Fix call.ll to follow the new syntax.
jfb updated this revision to Diff 37547.Oct 15 2015, 5:50 PM
  • Auto-upgrade returns: find ./test/CodeGen/WebAssembly/ -name '*.ll' | xargs -n1 sed -i 's/return \([0-9]\)/return (get_local \1)/g'
  • s/: \([0-9]\)/: get_local \1/g
  • Fix the other tests.
This revision was automatically updated to reflect the committed changes.