Page MenuHomePhabricator

[WebAssembly] Converted to stack based instructions in MC.
Needs ReviewPublic

Authored by aardappel on Jul 5 2018, 11:48 AM.

Details

Reviewers
dschuff
sunfish
Summary

WIP FOR REVIEW ONLY, DO NOT MERGE

  • Moved Explicit Locals pass to last.
  • Made that pass obligatory.
  • Made it convert from register to stack based instructions, and removed the registers.
  • Many fixes to related code that was expecting register based instructions.
  • Reworked all the tests.

Diff Detail

Event Timeline

aardappel created this revision.Jul 5 2018, 11:48 AM
aardappel edited the summary of this revision. (Show Details)Jul 5 2018, 12:01 PM

So after this patch, is the former register-based form of printing still supported, or the stack-baed form is the only printable form?

So after this patch, is the former register-based form of printing still supported, or the stack-baed form is the only printable form?

After I land https://reviews.llvm.org/D48985 the register based form will be gone permanently from everything after the Explicit Locals pass yes, which includes all text output and parsing.

Why is this WIP and when do you plan to land this? I'm working on tests that may conflict with this, so I'm not sure which format I should target.

lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
201

Can we infer this information from Operands? Looks like OperandVector is a vector of unique_ptr of MCParsedAsmOperand, which has isMem() member function.
Otherwise after we add other atomic read-modify-write instructions we are gonna need them here as well.

lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
130

I added these in D48992 before seeing this. Thanks.

This is WiP because there's a lot of work still to do to make the tests pass, and I wanted to gather input on whether I am doing the right thing.
It may take weeks for me to land this.

If you're doing work that conflicts with this, you're likely best of targeting the old format, and then I will resolve/convert it. Unless of course you think it will take you even longer than me :)

lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
201

I don't have Operands here, only tokens. The Operands/MCInst are generated by the asm matcher, which comes after this.

I'm not deeply familiar with MC's Asm parsing support, but this looks like a good direction to go.

lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
319

With the explicit locals pass going away, we can remove the second sentence of this comment.