Page MenuHomePhabricator

[flang][fir] Update the kind mapping class.
ClosedPublic

Authored by schweitz on Feb 9 2021, 11:28 AM.

Details

Summary

The kind mapper provides a portable mechanism to map Fortran type KIND values independent of the front-end to their corresponding MLIR and LLVM types.

Diff Detail

Event Timeline

schweitz created this revision.Feb 9 2021, 11:28 AM
schweitz requested review of this revision.Feb 9 2021, 11:28 AM
schweitz updated this revision to Diff 322501.Feb 9 2021, 2:22 PM

run clang-format on file

mehdi_amini added inline comments.Feb 9 2021, 4:06 PM
flang/include/flang/Optimizer/Support/KindMapping.h
58

There is an implicit size and ordering expectation for defs that seems quite subtle and deserve documentation here.

I also don't see a test which exercise this extra parameter?

flang/lib/Optimizer/Support/KindMapping.cpp
154

somehow unrelated to this patch, but the reference here is unusual, is this needed/useful?

189

Seems like the constructor can fail here, should this be a factory function returning an optional then?
Otherwise the caller can't really know...

268

Nit: if(defs.empty())

schweitz added inline comments.Feb 10 2021, 1:36 PM
flang/include/flang/Optimizer/Support/KindMapping.h
58

Done

flang/lib/Optimizer/Support/KindMapping.cpp
154

It's required. This is the current cursor position walking through the string.

189

Failure here is catastrophic. I'll change this to an error message with abort semantics.

268

+1

schweitz updated this revision to Diff 322814.Feb 10 2021, 1:37 PM
schweitz updated this revision to Diff 322815.Feb 10 2021, 1:39 PM
mehdi_amini added inline comments.Feb 10 2021, 1:40 PM
flang/lib/Optimizer/Support/KindMapping.cpp
189

LG!

jeanPerier accepted this revision.Feb 11 2021, 9:17 AM
This revision is now accepted and ready to land.Feb 11 2021, 9:17 AM
This revision was automatically updated to reflect the committed changes.