This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly][NFC] Refactor WasmSymbol type setting code
ClosedPublic

Authored by pmatos on Jan 25 2022, 3:25 AM.

Details

Summary

This refactors some code dealing with setting Wasm symbol types.
Some of the code dealing with types was moved from
WebAssemblyUtilities to WebAssemblyTypeUtilities.

Diff Detail

Event Timeline

pmatos created this revision.Jan 25 2022, 3:25 AM
pmatos requested review of this revision.Jan 25 2022, 3:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2022, 3:25 AM
pmatos updated this revision to Diff 402838.Jan 25 2022, 4:05 AM

@sbc100 Address review comments from D115749.

Make WasmSymbolSetType lower case to match what other functions in
WebAssemblyTypeUtilities do.

Also, this function is shared between MCInstLower and AsmPrinter,
therefore it needs to be in a common Utilities file. Since this
deals with types, it makes sense for that file to be
WebAssemblyTypeUtilities.

@sbc100 I have now addressed all your comments, I feel like it is ready for review.

sbc100 accepted this revision.Jan 26 2022, 11:05 AM

Is this change completely non-functional? If so can you add NFC to the title?

llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
20

Are both WebAssemblyUtilities.h and WebAssemblyTypeUtilities.h needed here?

This revision is now accepted and ready to land.Jan 26 2022, 11:05 AM
pmatos added inline comments.Jan 28 2022, 3:32 AM
llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
20

Yes, WebAssemblyUtilities.h is still needed for getOrCreateFunctionTableSymbol.

pmatos updated this revision to Diff 403957.Jan 28 2022, 3:42 AM
pmatos retitled this revision from [WebAssembly] Refactor WasmSymbol type setting code to [WebAssembly][NFC] Refactor WasmSymbol type setting code.

Added [NFC] to the title, rebased on main and rechecked that tests are fine.

@sbc100 yes, this is NFC. Happy for this to land?

sbc100 accepted this revision.Jan 28 2022, 9:56 AM

LGTM % comment about emitTableType

llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
201

Does removing this block not make this a functional change? Are there no tests that depend on emitTableType here?

pmatos added inline comments.Jan 28 2022, 12:44 PM
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
201

Argh, I missed this. Actually this should be in D118122, in any case apparently we have no test which tests this execution path. I will commit with these lines and change D118122 to remove it instead, so this is truly a NFC. Well done noticing this detail.

pmatos updated this revision to Diff 404238.Jan 28 2022, 11:59 PM

Remove non-NFC change.

This revision was landed with ongoing or failed builds.Jan 29 2022, 12:01 AM
This revision was automatically updated to reflect the committed changes.