[PATCH] D52839: Inform AST's UnaryOperator of FENV_ACCESS

Kevin P. Neal via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 25 09:40:17 PST 2019


kpn added a comment.

In D52839#1263794 <https://reviews.llvm.org/D52839#1263794>, @rsmith wrote:

>




> 2. Track the FP environment somewhere more transient, probably on the `Scope` object. When parsing an operator, store the environment on the expression, and when performing a `TreeTransform`, inherit the state onto the new node.
> 
>   I think option 2 seems cleaner.

In D53157 <https://reviews.llvm.org/D53157> it looks like an API where the IRBuilder has a constrained FP switch is preferred. This way calls to the IRBuilder can remain as one liners.

Going that route, would it make more sense to store the FP environment mode in some place like CompoundStmt so it gets set correctly when traversing the AST emitting IR? I'm not sure how TreeTransform would fit in here, though. The AST is supposed to be immutable once created, right? Can we set bits in a node after the node is created and before construction of the AST is completed?

Another wrinkle is that LLVM needs all FP in a function to be either constrained or non-constrained. This is to prevent code motion between the two modes. So clang would need to set the constrained mode someplace at function scope. I don't know the best place for that. And I'm not 100% sure that this requirement is set in stone yet. But where in the AST would be the proper place for that?

How does that change things?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52839/new/

https://reviews.llvm.org/D52839





More information about the cfe-commits mailing list