[PATCH] D71741: Add size of FP environment to DataLayout

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 22:23:59 PST 2019


sepavloff created this revision.
sepavloff added reviewers: gchatelet, hfinkel, kpn, andrew.w.kaylor.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

This change extends the layout specification with a new item. The item
has the form "fe:<size>:<align>" in which the argument <size> specifies
the size of memory required to store floating point environment, such as
rounding mode, exception behavior etc. Optional argument <align> specifies
required alignment of that memory.

The motivation for this extension is the need to support programs where
different parts are executed in different FP environment. It takes place,
in particular, when '#pragma STDC FENV_ACCESS' is used. When such program
undergoes transformation, it is possible that FP environment must be
saved and then restored. As an example, inlining a function that
requires default FP environment into a function where FP is non-standard
requires saving the FP environment before entry into the inlined
function and resoring it upon return.

Saving/restoring the FP environment requries creation of a variable for
the FP state but the size of this variable depends on the used target. As
this operation occurs at IR level, the size of FP state must be provided
by a component intended to represent target properties in
target-independent pipeline.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71741

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/DataLayout.h
  llvm/lib/IR/DataLayout.cpp
  llvm/unittests/IR/DataLayoutTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71741.234827.patch
Type: text/x-patch
Size: 3979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191220/f5bea945/attachment.bin>


More information about the llvm-commits mailing list