diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2020-09-17 17:50:42 -0400 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2020-09-18 09:55:47 -0400 |
commit | 751a6c5760b8de591cf241effbdad1b1cae67814 (patch) | |
tree | cafb70d01ad906c5796b33ce642519eebbd41826 /llvm/lib/IR/Function.cpp | |
parent | 05c02eda4552076dc08ce34866b3d8ee33bbf842 (diff) | |
download | llvm-751a6c5760b8de591cf241effbdad1b1cae67814.zip llvm-751a6c5760b8de591cf241effbdad1b1cae67814.tar.gz llvm-751a6c5760b8de591cf241effbdad1b1cae67814.tar.bz2 |
IR: Move denormal mode parsing from MachineFunction to Function
This was just inspecting the IR to begin with, and is useful to check
in some places in the IR.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index d03ffbb..ec1000c 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -570,6 +570,21 @@ void Function::addDereferenceableOrNullParamAttr(unsigned ArgNo, setAttributes(PAL); } +DenormalMode Function::getDenormalMode(const fltSemantics &FPType) const { + if (&FPType == &APFloat::IEEEsingle()) { + Attribute Attr = getFnAttribute("denormal-fp-math-f32"); + StringRef Val = Attr.getValueAsString(); + if (!Val.empty()) + return parseDenormalFPAttribute(Val); + + // If the f32 variant of the attribute isn't specified, try to use the + // generic one. + } + + Attribute Attr = getFnAttribute("denormal-fp-math"); + return parseDenormalFPAttribute(Attr.getValueAsString()); +} + const std::string &Function::getGC() const { assert(hasGC() && "Function has no collector"); return getContext().getGC(*this); |