This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Refactor atomic operation definitions (NFC)
ClosedPublic

Authored by aheejin on Feb 17 2019, 5:17 PM.

Details

Summary
  • Make ATOMIC_I, ATOMIC_NRI, AtomicLoad, AtomicStore classes and make other operations inherit from them
  • Factor the common opcode prefix '0xfe' out from the opcodes into the common class
  • Reorder instructions in the order of increasing opcodes

Diff Detail

Repository
rL LLVM

Event Timeline

aheejin created this revision.Feb 17 2019, 5:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2019, 5:17 PM
tlively accepted this revision.Feb 18 2019, 3:27 PM

Nice! LGTM with nits.

lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
22 ↗(On Diff #187184)

It looks like this multiclass isn't used anywhere. Can it be omitted for simplicity?

63 ↗(On Diff #187184)

Why make the kind an argument when it only ever has one value? This could just be a def : Pat<...> instead of a class. Same with other NotifyPat... classes with only one instantiation. If you want to keep the classes for symmetry with other instructions, I think it would still make sense to inline the kind argument.

This revision is now accepted and ready to land.Feb 18 2019, 3:27 PM
aheejin updated this revision to Diff 187284.Feb 18 2019, 4:18 PM
aheejin marked 2 inline comments as done.
  • Delete unnecessary classes for notify patterns
lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
22 ↗(On Diff #187184)

It's now used in D50277, the ever-pending CL. Do you think moving it there is better?

tlively added inline comments.Feb 18 2019, 5:44 PM
lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
22 ↗(On Diff #187184)

Oh I see. No, this seems fine the way it is 👍

This revision was automatically updated to reflect the committed changes.