Page MenuHomePhabricator

[flang][NFC] Move and rework pgmath description used in folding

Authored by jeanPerier on Jul 2 2020, 7:32 AM.



This change prepares usage of lipgmath description in lowering.

  • Removes the static variable templates that were used to abstract libpgmath description
  • Move the description to header and rework the macros so that they can both be used to declare pgmath functions and use them. The way they are to be used is left to user that must define PGMATH_USE_XX macros that will be called for all pgmath functions in
  • In intrinsic-library.cpp define PGMATH_USE_XX macro callbacks in order to capture function pointers to pgmath functions as well as a description of their type. This will be used for constant folding using pgmath.
  • Change atan/atan2 handling to use atan2 instead of atan when there are two

arguments because it is easier to handle in the runtime description.

Also fixes lipgmath linking regression after D78215 cmake changes.

This change is motivated by the need to use a similar pgmath
description in lowering. The difference is that no function pointers will
be taken there, and instead only the function name and type are needed.

Diff Detail

Event Timeline

jeanPerier created this revision.Jul 2 2020, 7:32 AM
Herald added a project: Restricted Project. · View Herald Transcript
schweitz accepted this revision.Jul 2 2020, 7:37 AM
This revision is now accepted and ready to land.Jul 2 2020, 7:37 AM
sscalpone accepted this revision.Jul 2 2020, 8:33 AM
sscalpone added inline comments.

What needs to be fixed?

jeanPerier updated this revision to Diff 275145.Jul 2 2020, 9:24 AM

Removed old FIXME that was actually implemented in

jeanPerier marked an inline comment as done.Jul 2 2020, 9:27 AM
jeanPerier added inline comments.

Old comment. It was a folding regression that was actually fixed by using "atan2" for the "atan" with two arguments (change in

This revision was automatically updated to reflect the committed changes.