This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] De-template serialization
ClosedPublic

Authored by antiagainst on Dec 18 2020, 4:59 AM.

Details

Summary

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

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

wc -l SPIRVSerialization.inc: before 8304; after: 5597 (So -2707)

Depends On D93504

Diff Detail

Event Timeline

antiagainst created this revision.Dec 18 2020, 4:59 AM
antiagainst requested review of this revision.Dec 18 2020, 4:59 AM
hanchung added inline comments.Dec 21 2020, 7:12 AM
mlir/lib/Target/SPIRV/Serialization.cpp
367–379

Use /// for comments.

1944

[optional] I would prefer to declare Location loc = op->getLoc(), so we don't need to call the function three times in this function. :)

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