[PATCH] D71741: Add size of FP environment to DataLayout
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 10:52:29 PDT 2020
sepavloff updated this revision to Diff 270450.
sepavloff added a comment.
Updated patch
- Removed alignment info. Alignment of stack must be enough.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71741/new/
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
Index: llvm/unittests/IR/DataLayoutTest.cpp
===================================================================
--- llvm/unittests/IR/DataLayoutTest.cpp
+++ llvm/unittests/IR/DataLayoutTest.cpp
@@ -56,4 +56,10 @@
DL.getValueOrABITypeAlignment(MaybeAlign(), FourByteAlignType));
}
+TEST(DataLayoutTest, FPEnvironmentProperties) {
+ EXPECT_EQ(0, DataLayout("").getFPEnvironmentSize());
+ EXPECT_EQ(0, DataLayout("fe:0").getFPEnvironmentSize());
+ EXPECT_EQ(4, DataLayout("fe:32").getFPEnvironmentSize());
+}
+
} // anonymous namespace
Index: llvm/lib/IR/DataLayout.cpp
===================================================================
--- llvm/lib/IR/DataLayout.cpp
+++ llvm/lib/IR/DataLayout.cpp
@@ -179,6 +179,7 @@
AllocaAddrSpace = 0;
StackNaturalAlign.reset();
ProgramAddrSpace = 0;
+ FPEnvironmentSize = 0;
FunctionPtrAlign.reset();
TheFunctionPtrAlignType = FunctionPtrAlignType::Independent;
ManglingMode = MM_None;
@@ -255,6 +256,18 @@
continue;
}
+ if (Tok == "fe") {
+ if (Rest.empty())
+ report_fatal_error(
+ "Missing size specification for FP environment in datalayout string");
+ Split = split(Rest, ':');
+ Rest = Split.second;
+ FPEnvironmentSize = inBytes(getInt(Split.first));
+ if (!Rest.empty())
+ report_fatal_error("Extra item in FP environment specification");
+ continue;
+ }
+
char Specifier = Tok.front();
Tok = Tok.substr(1);
Index: llvm/include/llvm/IR/DataLayout.h
===================================================================
--- llvm/include/llvm/IR/DataLayout.h
+++ llvm/include/llvm/IR/DataLayout.h
@@ -123,6 +123,7 @@
unsigned AllocaAddrSpace;
MaybeAlign StackNaturalAlign;
unsigned ProgramAddrSpace;
+ unsigned FPEnvironmentSize;
MaybeAlign FunctionPtrAlign;
FunctionPtrAlignType TheFunctionPtrAlignType;
@@ -212,6 +213,7 @@
FunctionPtrAlign = DL.FunctionPtrAlign;
TheFunctionPtrAlignType = DL.TheFunctionPtrAlignType;
ProgramAddrSpace = DL.ProgramAddrSpace;
+ FPEnvironmentSize = DL.FPEnvironmentSize;
ManglingMode = DL.ManglingMode;
LegalIntWidths = DL.LegalIntWidths;
Alignments = DL.Alignments;
@@ -285,6 +287,8 @@
unsigned getProgramAddressSpace() const { return ProgramAddrSpace; }
+ unsigned getFPEnvironmentSize() const { return FPEnvironmentSize; }
+
bool hasMicrosoftFastStdCallMangling() const {
return ManglingMode == MM_WinCOFFX86;
}
Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -2376,6 +2376,8 @@
This specifies pointer types with the specified address spaces
as :ref:`Non-Integral Pointer Type <nointptrtype>` s. The ``0``
address space cannot be specified as non-integral.
+``fe:<size>``
+ This specifies the size of floating point environment.
On every specification that takes a ``<abi>:<pref>``, specifying the
``<pref>`` alignment is optional. If omitted, the preceding ``:``
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71741.270450.patch
Type: text/x-patch
Size: 3064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200612/0baeebe2/attachment.bin>
More information about the llvm-commits
mailing list