This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Made assembler only use stack instruction tablegen defs
ClosedPublic

Authored by aardappel on Sep 4 2018, 3:55 PM.

Details

Summary

This ensures we have the non-register version of the instruction.

The stack version of call_indirect now wants a type index argument,
so that has been added in the existing tests.

Tested:
llvm-lit -v find test -name WebAssembly

Diff Detail

Event Timeline

aardappel created this revision.Sep 4 2018, 3:55 PM
dschuff accepted this revision.Sep 4 2018, 4:04 PM

LGTM to ensure we are using the stack instructions.
It's unfortunate about the type index requirement. That will make it quite a pain to hand-write assembly files. It would be nice if we could eventually figure out a way to symbolize those like the wat format.

This revision is now accepted and ready to land.Sep 4 2018, 4:04 PM
utils/TableGen/AsmMatcherEmitter.cpp
1482

nit: maybe IsWebAssemblyTarget? On first read I'd assumed that WebAssemblyTarget was the string "WebAssembly" and I was confused what Target.getName() was doing in this expression

@dschuff I could also remove the type index argument from the table-gen defs for now, if you think that is better. Though a future assembler can possibly allow parsing symbolic operands and turn them into integers if it has seen a previous type declaration?

aardappel marked an inline comment as done.Sep 4 2018, 4:30 PM
aardappel updated this revision to Diff 163943.Sep 4 2018, 4:37 PM

Addressed review comment.

jgravelle-google accepted this revision.Sep 4 2018, 4:42 PM
This revision was automatically updated to reflect the committed changes.

Would setting the isCodeGenOnly on the non-stack instructions accomplish this as well?

@tlively that is entirely possible, I'll give it a go.