This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] De-template deserialization
ClosedPublic

Authored by antiagainst on Dec 17 2020, 5:45 PM.

Details

Summary

Previously for each op we generate a separate deserialization
method for it. Those deserialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
deserialization method to call into it.

wc -l SPIRVSerialization.inc: before 13290; after: 8304 (So -4986)

Depends On D93489

Diff Detail

Event Timeline

antiagainst created this revision.Dec 17 2020, 5:45 PM
antiagainst requested review of this revision.Dec 17 2020, 5:45 PM

Fix comments

hanchung accepted this revision.Dec 21 2020, 7:07 AM
hanchung added inline comments.
mlir/lib/Target/SPIRV/Deserialization.cpp
2540–2542

drop trivial braces?

2558

[optional] I would move this to the beginning (ie size_t wordIndex = 0), and use wordIndex++ in the if (hasResult) section, so we can avoid magic numbers here.

This revision is now accepted and ready to land.Dec 21 2020, 7:07 AM
ThomasRaoux accepted this revision.Dec 21 2020, 9:17 AM
This revision was automatically updated to reflect the committed changes.
antiagainst marked 2 inline comments as done.