llvm-project/clang/lib/Serialization
Serge Pavlov f7819ce166 [FPEnv] Allow CompoundStmt to keep FP options
This is a recommit of b822efc740,
reverted in dc34d8df4c. The commit caused
fails because the test ast-print-fp-pragmas.c did not specify particular
target, and it failed on targets which do not support constrained
intrinsics. The original commit message is below.

AST does not have special nodes for pragmas. Instead a pragma modifies
some state variables of Sema, which in turn results in modified
attributes of AST nodes. This technique applies to floating point
operations as well. Every AST node that can depend on FP options keeps
current set of them.

This technique works well for options like exception behavior or fast
math options. They represent instructions to the compiler how to modify
code generation for the affected nodes. However treatment of FP control
modes has problems with this technique. Modifying FP control mode
(like rounding direction) usually requires operations on hardware, like
writing to control registers. It must be done prior to the first
operation that depends on the control mode. In particular, such
operations are required for implementation of `pragma STDC FENV_ROUND`,
compiler should set up necessary rounding direction at the beginning of
compound statement where the pragma occurs. As there is no representation
for pragmas in AST, the code generation becomes a complicated task in
this case.

To solve this issue FP options are kept inside CompoundStmt. Unlike to FP
options in expressions, these does not affect any operation on FP values,
but only inform the codegen about the FP options that act in the body of
the statement. As all pragmas that modify FP environment may occurs only
at the start of compound statement or at global level, such solution
works for all relevant pragmas. The options are kept as a difference
from the options in the enclosing compound statement or default options,
it helps codegen to set only changed control modes.

Differential Revision: https://reviews.llvm.org/D123952
2022-07-03 17:06:26 +07:00
..
ASTCommon.cpp [modules] Merge ObjC interface ivars with anonymous types. 2022-04-04 18:48:30 -07:00
ASTCommon.h
ASTReader.cpp [ODRHash diagnostics] Move common code for calculating diag locations in `DiagnoseODRMismatch` into a lambda. NFC. 2022-06-30 19:39:22 -07:00
ASTReaderDecl.cpp Revert "Re-apply "Deferred Concept Instantiation Implementation""" 2022-07-01 11:20:16 -07:00
ASTReaderInternals.h [clang] Remove unused forward declarations (NFC) 2022-01-08 11:56:40 -08:00
ASTReaderStmt.cpp [FPEnv] Allow CompoundStmt to keep FP options 2022-07-03 17:06:26 +07:00
ASTWriter.cpp Revert "Don't use Optional::hasValue (NFC)" 2022-06-25 11:56:50 -07:00
ASTWriterDecl.cpp Revert "Re-apply "Deferred Concept Instantiation Implementation""" 2022-07-01 11:20:16 -07:00
ASTWriterStmt.cpp [FPEnv] Allow CompoundStmt to keep FP options 2022-07-03 17:06:26 +07:00
CMakeLists.txt [openmp] Base of tablegen generated OpenMP common declaration 2020-06-23 10:32:32 -04:00
GeneratePCH.cpp [clang][modules] NFC: Propagate import `SourceLocation` into `HeaderSearch::lookupModule` 2021-10-12 09:31:51 +02:00
GlobalModuleIndex.cpp [Clang] Use std::move in GlobalModuleIndex::readIndex. NFC 2022-04-26 16:45:01 +08:00
InMemoryModuleCache.cpp Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
ModuleFile.cpp
ModuleFileExtension.cpp [modules] Use `HashBuilder` and `MD5` for the module hash. 2021-09-03 11:13:36 -07:00
ModuleManager.cpp unique_ptrify the ModuleManager's VisitState linked list 2022-01-19 09:57:46 -08:00
MultiOnDiskHashTable.h
PCHContainerOperations.cpp